gbdev-common_project_tasks 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,11 +3,14 @@ app_vars: &app_vars
3
3
  load_fixtures: true
4
4
  fixtures: 'states,users,permissions'
5
5
  # post_fixture_tasks: some_rake_task_to_run
6
+ # load_sql_file: 'db/sql/roar_production_data_only-2008-07-25.sql'
6
7
 
7
8
  development:
9
+ load_sql_file: '/db/sql/roar_production_data_only-2008-07-25.sql'
8
10
  <<: *app_vars
9
11
 
10
12
  test:
13
+ load_sql_file: '/db/sql/roar_production_data_only-2008-07-25.sql'
11
14
  <<: *app_vars
12
15
 
13
16
  production:
@@ -26,12 +26,27 @@ namespace :app do
26
26
  end
27
27
 
28
28
  unless app_vars[ENV['RAILS_ENV']]['post_fixture_tasks'].nil?
29
- #begin
29
+ begin
30
30
  Rake::Task[app_vars[ENV['RAILS_ENV']]['post_fixture_tasks']].invoke
31
- #rescue
32
- # Fail quietly if the task does not exist
33
- #end
31
+ rescue
32
+ puts 'There was an error invoking the post fixture task. Make sure it exists.'
33
+ end
34
34
  end
35
+
36
+ unless app_vars[ENV['RAILS_ENV']]['load_sql_file'].nil?
37
+ begin
38
+ path_to_sql_file = app_vars[ENV['RAILS_ENV']]['load_sql_file']
39
+ db = database[ENV['RAILS_ENV']]['database']
40
+ username = database[ENV['RAILS_ENV']]['username']
41
+ password = database[ENV['RAILS_ENV']]['password']
42
+ ENV['PGUSER'] = username
43
+ ENV['PGPASSWORD'] = password
44
+ system("psql -d #{db} < #{path_to_sql_file}")
45
+ rescue
46
+ puts 'There was an error loading sql file'
47
+ end
48
+ end
49
+
35
50
  end
36
51
 
37
52
  ##############################################
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gbdev-common_project_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wes Hays
@@ -10,11 +10,12 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-02-05 00:00:00 -08:00
13
+ date: 2009-02-13 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
18
+ type: :runtime
18
19
  version_requirement:
19
20
  version_requirements: !ruby/object:Gem::Requirement
20
21
  requirements: