aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/holiday_import.rb12
-rw-r--r--config/.cvsignore3
-rwxr-xr-xconfig/alert-tracks-debian.example (renamed from config/alert-tracks-debian.ugly)0
-rw-r--r--config/deploy.rb2
-rw-r--r--config/initializers/alaveteli.rb2
-rwxr-xr-xconfig/purge-varnish-debian.example (renamed from config/purge-varnish-debian.ugly)0
-rwxr-xr-xconfig/sysvinit-passenger.example (renamed from config/sysvinit-passenger.ugly)0
-rwxr-xr-xconfig/sysvinit-thin.example (renamed from config/sysvinit-thin.ugly)0
-rw-r--r--doc/CHANGES.md6
-rw-r--r--lib/tasks/config_files.rake10
-rw-r--r--public/.cvsignore5
-rwxr-xr-xscript/site-specific-install.sh4
-rw-r--r--spec/models/holiday_import_spec.rb22
13 files changed, 42 insertions, 24 deletions
diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb
index c6019fac0..98a9b96fc 100644
--- a/app/models/holiday_import.rb
+++ b/app/models/holiday_import.rb
@@ -84,10 +84,14 @@ class HolidayImport
end
def populate_from_suggestions
- holiday_info = Holidays.between(start_date, end_date, @country_code.to_sym, :observed)
- holiday_info.each do |holiday_info_hash|
- holidays << Holiday.new(:description => holiday_info_hash[:name],
- :day => holiday_info_hash[:date])
+ begin
+ holiday_info = Holidays.between(start_date, end_date, @country_code.to_sym, :observed)
+ holiday_info.each do |holiday_info_hash|
+ holidays << Holiday.new(:description => holiday_info_hash[:name],
+ :day => holiday_info_hash[:date])
+ end
+ rescue Holidays::UnknownRegionError
+ []
end
end
end
diff --git a/config/.cvsignore b/config/.cvsignore
deleted file mode 100644
index 2539dd3cd..000000000
--- a/config/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-general
-database.yml
-rails_env.rb
diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.example
index a098bc332..a098bc332 100755
--- a/config/alert-tracks-debian.ugly
+++ b/config/alert-tracks-debian.example
diff --git a/config/deploy.rb b/config/deploy.rb
index f4a0b536a..d02488bfa 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -58,6 +58,7 @@ namespace :deploy do
"#{release_path}/log" => "#{shared_path}/log",
"#{release_path}/tmp/pids" => "#{shared_path}/tmp/pids",
"#{release_path}/lib/acts_as_xapian/xapiandbs" => "#{shared_path}/xapiandbs",
+ "#{release_path}/lib/themes" => "#{shared_path}/themes",
}
# "ln -sf <a> <b>" creates a symbolic link but deletes <b> if it already exists
@@ -70,6 +71,7 @@ namespace :deploy do
run "mkdir -p #{shared_path}/log"
run "mkdir -p #{shared_path}/tmp/pids"
run "mkdir -p #{shared_path}/xapiandbs"
+ run "mkdir -p #{shared_path}/themes"
end
end
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb
index d09bfec28..dbd7aace2 100644
--- a/config/initializers/alaveteli.rb
+++ b/config/initializers/alaveteli.rb
@@ -10,7 +10,7 @@ load "debug_helpers.rb"
load "util.rb"
# Application version
-ALAVETELI_VERSION = '0.21.0.23'
+ALAVETELI_VERSION = '0.21.0.25'
# Add new inflection rules using the following format
# (all these examples are active by default):
diff --git a/config/purge-varnish-debian.ugly b/config/purge-varnish-debian.example
index 457a77ed8..457a77ed8 100755
--- a/config/purge-varnish-debian.ugly
+++ b/config/purge-varnish-debian.example
diff --git a/config/sysvinit-passenger.ugly b/config/sysvinit-passenger.example
index 0940a4d63..0940a4d63 100755
--- a/config/sysvinit-passenger.ugly
+++ b/config/sysvinit-passenger.example
diff --git a/config/sysvinit-thin.ugly b/config/sysvinit-thin.example
index 0155ff8c3..0155ff8c3 100755
--- a/config/sysvinit-thin.ugly
+++ b/config/sysvinit-thin.example
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index b9406fac3..f4f75ce2b 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -7,6 +7,12 @@
* HTML 'widgets' advertising requests can be displayed on other sites in iframes.
If 'ENABLE_WIDGETS' is set to true in `general.yml` (the default is false), a link
to the widget code will appear in the right hand sidebar of a request page.
+* Capistrano now caches themes (Henare Degan).
+
+## Upgrade Notes
+
+* Capistrano now caches themes in `shared/themes`. Run the `deploy:setup` task
+ to create the shared directory before making a new code deploy.
# Version 0.21
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 1528d7324..f6b25185e 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -11,7 +11,7 @@ namespace :config_files do
var = $1.to_sym
replacement = replacements[var]
if replacement == nil
- raise "Unhandled variable in .ugly file: $#{var}"
+ raise "Unhandled variable in example file: $#{var}"
else
replacements[var]
end
@@ -21,9 +21,9 @@ namespace :config_files do
converted_lines
end
- desc 'Convert Debian .ugly init script in config to a form suitable for installing in /etc/init.d'
+ desc 'Convert Debian example init script in config to a form suitable for installing in /etc/init.d'
task :convert_init_script => :environment do
- example = 'rake config_files:convert_init_script DEPLOY_USER=deploy VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli SITE=alaveteli SCRIPT_FILE=config/alert-tracks-debian.ugly'
+ example = 'rake config_files:convert_init_script DEPLOY_USER=deploy VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli SITE=alaveteli SCRIPT_FILE=config/alert-tracks-debian.example'
check_for_env_vars(['DEPLOY_USER',
'VHOST_DIR',
'SCRIPT_FILE'], example)
@@ -37,7 +37,7 @@ namespace :config_files do
}
# Use the filename for the $daemon_name ugly variable
- daemon_name = File.basename(ENV['SCRIPT_FILE'], '-debian.ugly')
+ daemon_name = File.basename(ENV['SCRIPT_FILE'], '-debian.example')
replacements.update(:daemon_name => "#{ replacements[:site] }-#{ daemon_name }")
# Generate the template for potential further processing
@@ -57,7 +57,7 @@ namespace :config_files do
end
end
- desc 'Convert Debian .ugly crontab file in config to a form suitable for installing in /etc/cron.d'
+ desc 'Convert Debian example crontab file in config to a form suitable for installing in /etc/cron.d'
task :convert_crontab => :environment do
example = 'rake config_files:convert_crontab DEPLOY_USER=deploy VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli SITE=alaveteli CRONTAB=config/crontab-example MAILTO=cron-alaveteli@example.org'
check_for_env_vars(['DEPLOY_USER',
diff --git a/public/.cvsignore b/public/.cvsignore
deleted file mode 100644
index 9fc54a4a6..000000000
--- a/public/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-down.html
-down.current.html
-foi-live-creation.png
-foi-user-use.png
-google*.html
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index fba164213..ac2280e72 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -208,14 +208,14 @@ echo $DONE_MSG
if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
echo -n "Creating /etc/init.d/$SITE... "
- (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' SCRIPT_FILE=config/sysvinit-thin.ugly" "$UNIX_USER") > /etc/init.d/"$SITE"
+ (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' SCRIPT_FILE=config/sysvinit-thin.example" "$UNIX_USER") > /etc/init.d/"$SITE"
chgrp "$UNIX_USER" /etc/init.d/"$SITE"
chmod 754 /etc/init.d/"$SITE"
echo $DONE_MSG
fi
echo -n "Creating /etc/init.d/$SITE-alert-tracks... "
-(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' SCRIPT_FILE=config/alert-tracks-debian.ugly" "$UNIX_USER") > /etc/init.d/"$SITE-alert-tracks"
+(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' SCRIPT_FILE=config/alert-tracks-debian.example" "$UNIX_USER") > /etc/init.d/"$SITE-alert-tracks"
chgrp "$UNIX_USER" /etc/init.d/"$SITE-alert-tracks"
chmod 754 /etc/init.d/"$SITE-alert-tracks"
echo $DONE_MSG
diff --git a/spec/models/holiday_import_spec.rb b/spec/models/holiday_import_spec.rb
index 21061f63f..7ec5c04d5 100644
--- a/spec/models/holiday_import_spec.rb
+++ b/spec/models/holiday_import_spec.rb
@@ -88,21 +88,35 @@ describe HolidayImport do
describe 'when populating a set of holidays to import from suggestions' do
- before do
- holidays = [ { :date => Date.new(2014, 1, 1), :name => "New Year's Day", :regions => [:gb] } ]
+ it 'should populate holidays from the suggestions' do
+ holidays = [ { :date => Date.new(2014, 1, 1),
+ :name => "New Year's Day",
+ :regions => [:gb] } ]
Holidays.stub!(:between).and_return(holidays)
@holiday_import = HolidayImport.new(:source => 'suggestions')
@holiday_import.populate
- end
- it 'should populate holidays from the suggestions' do
@holiday_import.holidays.size.should == 1
holiday = @holiday_import.holidays.first
holiday.description.should == "New Year's Day"
holiday.day.should == Date.new(2014, 1, 1)
end
+ it 'returns an empty array for an unknown country code' do
+ AlaveteliConfiguration.stub(:iso_country_code).and_return('UNKNOWN_COUNTRY_CODE')
+ @holiday_import = HolidayImport.new(:source => 'suggestions')
+ @holiday_import.populate
+ expect(@holiday_import.holidays).to be_empty
+ end
+
it 'should return a flag that it has been populated' do
+ holidays = [ { :date => Date.new(2014, 1, 1),
+ :name => "New Year's Day",
+ :regions => [:gb] } ]
+ Holidays.stub!(:between).and_return(holidays)
+ @holiday_import = HolidayImport.new(:source => 'suggestions')
+ @holiday_import.populate
+
@holiday_import.populated.should == true
end