@@ -8,23 +8,23 @@ Bundler::GemHelper.install_tasks
8
8
9
9
desc "Copy the database.DB.yml per ENV['DB']"
10
10
task :install_database_yml do
11
- puts format ( "installing database.yml for %s" , ENV . fetch ( "DB" , nil ) )
11
+ puts format ( "installing database.yml for %s" , ENV [ "DB" ] )
12
12
13
13
# It's tempting to use `git clean` here, but this rake task will be run by
14
14
# people working on changes that haven't been committed yet, so we have to
15
15
# be more selective with what we delete.
16
16
FileUtils . rm ( "spec/dummy_app/db/database.yml" , force : true )
17
17
18
18
FileUtils . cp (
19
- "spec/dummy_app/config/database.#{ ENV . fetch ( 'DB' , nil ) } .yml" ,
19
+ "spec/dummy_app/config/database.#{ ENV [ 'DB' ] } .yml" ,
20
20
"spec/dummy_app/config/database.yml"
21
21
)
22
22
end
23
23
24
24
desc "Delete generated files and databases"
25
25
task :clean do
26
- puts format ( "dropping %s database" , ENV . fetch ( "DB" , nil ) )
27
- case ENV . fetch ( "DB" , nil )
26
+ puts format ( "dropping %s database" , ENV [ "DB" ] )
27
+ case ENV [ "DB" ]
28
28
when "mysql"
29
29
# TODO: only works locally. doesn't respect database.yml
30
30
system "mysqladmin drop -f paper_trail_test > /dev/null 2>&1"
@@ -34,14 +34,14 @@ task :clean do
34
34
when nil , "sqlite"
35
35
FileUtils . rm ( Dir . glob ( "spec/dummy_app/db/*.sqlite3" ) )
36
36
else
37
- raise "Don't know how to clean specified RDBMS: #{ ENV . fetch ( 'DB' , nil ) } "
37
+ raise "Don't know how to clean specified RDBMS: #{ ENV [ 'DB' ] } "
38
38
end
39
39
end
40
40
41
41
desc "Create the database."
42
42
task :create_db do
43
- puts format ( "creating %s database" , ENV . fetch ( "DB" , nil ) )
44
- case ENV . fetch ( "DB" , nil )
43
+ puts format ( "creating %s database" , ENV [ "DB" ] )
44
+ case ENV [ "DB" ]
45
45
when "mysql"
46
46
# TODO: only works locally. doesn't respect database.yml
47
47
system "mysqladmin create paper_trail_test"
@@ -52,7 +52,7 @@ task :create_db do
52
52
# noop. test.sqlite3 will be created when migration happens
53
53
nil
54
54
else
55
- raise "Don't know how to create specified DB: #{ ENV . fetch ( 'DB' , nil ) } "
55
+ raise "Don't know how to create specified DB: #{ ENV [ 'DB' ] } "
56
56
end
57
57
end
58
58
0 commit comments