whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/2] Commit ee8520f: make whimsy-test an alternate source for mail
Date Fri, 15 Jan 2016 16:05:13 GMT
Commit ee8520f3eae4c70639f482b68faacdeed341a05c:
    make whimsy-test an alternate source for mail


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
www/secmail/Rakefile                                         | +++++++++++ -
www/secmail/config.rb                                        | ++++ ----
www/secmail/views/index.js.rb                                | ++++ --
------------------------------------------------------------
44 changes: 33 additions, 11 deletions.
------------------------------------------------------------


diff --git a/www/secmail/Rakefile b/www/secmail/Rakefile
index a0137cb..3d8893d 100644
--- a/www/secmail/Rakefile
+++ b/www/secmail/Rakefile
@@ -25,7 +25,27 @@ task :fetch => :bundle do
   ruby 'parsemail.rb', '--fetch'
 end
 
-desc 'Fetch parse latest month only'
+desc 'create /srv/mail with the appropriate permissions'
+file '/srv/mail' do
+  begin
+    mkdir_p '/srv/mail'
+
+    require 'etc'
+    if Etc.getpwent.uid == 0
+      user = Etc.getpwnam(Etc.getlogin)
+      chown user.uid, user.gid, '/srv/mail'
+    end
+  rescue Errno::EACCES
+    sh 'sudo rake /srv/mail'
+  end
+end
+
+desc 'download mail from whimsy-vm2'
+task 'sync' => '/srv/mail' do
+  sh 'rsync -av --delete whimsy-vm2.apache.org:/srv/mail/ /srv/mail'
+end
+
+desc 'Fetch and parse latest month only'
 task :fetch1 => :bundle do
   ruby 'parsemail.rb', '--fetch1'
 end
diff --git a/www/secmail/config.rb b/www/secmail/config.rb
index 2b1aa87..98b9389 100644
--- a/www/secmail/config.rb
+++ b/www/secmail/config.rb
@@ -1,14 +1,14 @@
 #
-# Where to find the archive
+# Where to find the archive (remote and local)
 #
 
-SOURCE = 'minotaur.apache.org:/home/apmail/private-arch/officers-secretary'
-
-#
-# Where to save the archive locally
-#
-
-ARCHIVE = (Dir.exist?('/srv/mail') ? '/srv/mail' : File.basename(SOURCE))
+if Dir.exist? '/srv/mail'
+  SOURCE = 'whimsy-vm2.apache.org:/srv/mail'
+  ARCHIVE = '/srv/mail'
+else
+  SOURCE = 'minotaur.apache.org:/home/apmail/private-arch/officers-secretary'
+  ARCHIVE = File.basename(SOURCE)
+end
 
 #
 # GPG's work directory override
diff --git a/www/secmail/views/index.js.rb b/www/secmail/views/index.js.rb
index 90d35f7..ca079c2 100644
--- a/www/secmail/views/index.js.rb
+++ b/www/secmail/views/index.js.rb
@@ -44,8 +44,10 @@ def render
         onClick: self.fetch_month
     end
 
-    _button.btn.btn_success 'check for new mail', onClick: self.refresh,
-      disabled: @checking
+    unless window.location.hostname =~ /^whimsy(-test)?\.apache\.org$/
+      _button.btn.btn_success 'check for new mail', onClick: self.refresh,
+        disabled: @checking
+    end
 
     unless Status.undoStack.empty?
       _button.btn.btn_info 'undo delete', onClick: self.undo

Mime
View raw message