aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/environments/development.rb9
-rw-r--r--config/environments/production.rb6
-rw-r--r--lib/tasks/demo.rake20
3 files changed, 31 insertions, 4 deletions
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 12618b1ed..6b2f29f66 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -30,14 +30,17 @@ ChouetteIhm::Application.configure do
config.assets.debug = true
config.active_record.mass_assignment_sanitizer = :strict
-
- # uncomment to show chouette error view in development
+
+ # uncomment to show chouette error view in development
#config.consider_all_requests_local = false
config.active_record.auto_explain_threshold_in_seconds = (RUBY_PLATFORM == "java" ? nil : 0.5)
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+ # file to data for demo
+ config.demo_data = "tmp/demo.zip"
+
ActionMailer::Base.smtp_settings = {
:address => "mail.dryade.priv",
:domain => "dryade.priv"
@@ -56,5 +59,5 @@ ChouetteIhm::Application.configure do
Chouette::Command.command = "true"
end
end
-
+
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index e3005ee4a..014b611f4 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -77,6 +77,8 @@ ChouetteIhm::Application.configure do
config.action_mailer.default_url_options = { :host => 'chouette.dryade.net/chouette2' }
+
+
# mailer configuration :
# by default : set to smtp on windows platforms and sendmail on unix one
# may be changed as convenience
@@ -100,10 +102,12 @@ ChouetteIhm::Application.configure do
:domain => "cityway.fr",
:user_name => "jdleca@cityway.fr",
:password => "waycity",
- :authentication => "plain"
+ :authentication => "plain"
}
end
+ # file to data for demo
+ config.demo_data = "/var/lib/chouette/demo.zip"
# paths for external resources
if ENV['OS'] == 'Windows_NT'
diff --git a/lib/tasks/demo.rake b/lib/tasks/demo.rake
new file mode 100644
index 000000000..092bd317d
--- /dev/null
+++ b/lib/tasks/demo.rake
@@ -0,0 +1,20 @@
+namespace :demo do
+ desc "restore demo account"
+ task :restore => :environment do
+ puts "A" * 40
+ oo = Organisation.find_by_name("demo").destroy
+ if oo
+ oo.users.each &:destroy
+ end
+
+ o = Organisation.create!(:name => "demo")
+ u = o.users.build( :name => "Demo", :email => "demo@chouette.mobi", :password => "chouette", :password_confirmation =>"chouette")
+ u.save
+ u.confirm!
+ r = o.referentials.create( :name => "Tatrobus", :slug => "tatrobus", :prefix => "TAT")
+
+ res = Rack::Test::UploadedFile.new( Rails.application.config.demo_data, 'application/zip', false)
+ i = r.imports.create( :resources => res, :referential_id => r.id)
+ end
+end
+