bard-rake 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 396110575a1b87f170491679b9b7eed32fd3fc2f
4
- data.tar.gz: 7506bb2cf4d1d225d3721091a163e03c2a579bb5
3
+ metadata.gz: 66246d3540103bd68b8019c91376dbf5e5265431
4
+ data.tar.gz: b80d8fc7cbd7554116d8e7a13a36a7d801572684
5
5
  SHA512:
6
- metadata.gz: d4c243c00054010832b58637bd01555ccc272f4b26b23d985fe6ed01164bf18133c3396c1fa517ae50fdde888ea7bce7ed93abba246521019f940729aef1dd21
7
- data.tar.gz: 1014556e01c052a01d7c8530afadc1c1eb7b12ab8b30eb48fd37069cc8e4914d6184f945a7e9dae2bf81a503aab639fbfe98704c4d7190518f4d7747ca7d50bf
6
+ metadata.gz: 4a47b750888a3506ad116d94a35527c1c671e0a49514adc917d0e6ecc038ff1235ff002f366fb610c194817280504b8c4e45b3dab9b03fc6fc91eb57f0d99e91
7
+ data.tar.gz: cf596e0ffbcd20beb2d7eac04c282a878f90f03da0a5b21539e4b2bd523dd404afa2e6862352b6f9326cef6d04cc86749dc4bc01f7219523752476195d6cd9e3
@@ -6,8 +6,8 @@ end
6
6
  desc "Bootstrap project"
7
7
  task :bootstrap do
8
8
  system "cp config/database.sample.yml config/database.yml" unless File.exist?('config/database.yml') or !File.exist?('config/database.sample.yml')
9
- invoke_task_if_exists "db:create"
10
- invoke_task_if_exists "db:migrate"
9
+ invoke_task_if_exists "db:create:all"
10
+ invoke_task_if_exists "db:migrate:all"
11
11
  if %w(staging production).include?(ENV["RAILS_ENV"])
12
12
  invoke_task_if_exists "assets:precompile"
13
13
  end
@@ -12,3 +12,22 @@ namespace :db do
12
12
  end
13
13
  end
14
14
 
15
+ # FIXME is this necessary? Why can't we just rely on RAILS_ENV?
16
+ if defined?(ActiveRecord)
17
+ namespace :db do
18
+ namespace :create do
19
+ task :current => :load_config do
20
+ config = ActiveRecord::Tasks::DatabaseTasks.current_config
21
+ ActiveRecord::Tasks::DatabaseTasks.create config
22
+ end
23
+ end
24
+
25
+ namespace :drop do
26
+ task :current => :load_config do
27
+ config = ActiveRecord::Tasks::DatabaseTasks.current_config
28
+ ActiveRecord::Tasks::DatabaseTasks.drop config
29
+ end
30
+ end
31
+ end
32
+ end
33
+
@@ -1,27 +1,43 @@
1
1
  if defined?(ActiveRecord)
2
2
  namespace :db do
3
- namespace :migrate do
3
+ namespace :create do
4
4
  task :all => [:load_config] do
5
5
  invoke_task_if_exists :rails_env
6
6
  run_in_all_environments do |config|
7
7
  ActiveRecord::Base.establish_connection(config)
8
- ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
9
- ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration|
10
- ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope)
11
- end
8
+ ActiveRecord::Tasks::DatabaseTasks.create config
12
9
  end
13
10
 
14
- Rake::Task["db:_dump"].invoke
11
+ if includes_test_environment? && !parallel?
12
+ invoke_task_if_exists "parallel:create"
13
+ end
15
14
  end
16
15
  end
17
16
 
18
- namespace :rollback do
17
+ namespace :drop do
19
18
  task :all => [:load_config] do
20
19
  invoke_task_if_exists :rails_env
21
20
  run_in_all_environments do |config|
22
21
  ActiveRecord::Base.establish_connection(config)
23
- step = ENV['STEP'] ? ENV['STEP'].to_i : 1
24
- ActiveRecord::Migrator.rollback(ActiveRecord::Migrator.migrations_paths, step)
22
+ ActiveRecord::Tasks::DatabaseTasks.drop config
23
+ end
24
+
25
+ if includes_test_environment? && !parallel?
26
+ invoke_task_if_exists "parallel:drop"
27
+ end
28
+ end
29
+ end
30
+
31
+ namespace :migrate do
32
+ task :all => [:load_config] do
33
+ invoke_task_if_exists :rails_env
34
+ run_in_all_environments do |config|
35
+ ActiveRecord::Base.establish_connection(config)
36
+ ActiveRecord::Tasks::DatabaseTasks.migrate
37
+ end
38
+
39
+ if includes_test_environment? && !parallel?
40
+ invoke_task_if_exists "parallel:migrate"
25
41
  end
26
42
 
27
43
  Rake::Task["db:_dump"].invoke
@@ -36,52 +52,13 @@ if defined?(ActiveRecord)
36
52
  end
37
53
  end
38
54
 
39
- namespace :drop do
40
- task :current => [:load_config] do
41
- if defined?(ActiveRecord::Tasks::DatabaseTasks)
42
- config = ActiveRecord::Tasks::DatabaseTasks.current_config
43
- ActiveRecord::Tasks::DatabaseTasks.drop config
44
- else
45
- drop_database current_config
46
- end
47
- end
48
- end
49
-
50
- namespace :create do
51
- task :current => [:load_config] do
52
- if defined?(ActiveRecord::Tasks::DatabaseTasks)
53
- config = ActiveRecord::Tasks::DatabaseTasks.current_config
54
- ActiveRecord::Tasks::DatabaseTasks.create config
55
- else
56
- create_database current_config
57
- end
58
- end
59
- end
60
-
61
- def production?
62
- ENV["RAILS_ENV"] == "production"
55
+ def includes_test_environment?
56
+ %w(development test).include?(ENV["RAILS_ENV"])
63
57
  end
64
58
 
65
59
  def parallel?
66
60
  !!ENV["TEST_ENV_NUMBER"]
67
61
  end
68
-
69
- task :create do
70
- unless production? or parallel?
71
- invoke_task_if_exists "parallel:create"
72
- end
73
- end
74
-
75
- task :migrate do
76
- unless production? or parallel?
77
- invoke_task_if_exists "parallel:migrate"
78
- end
79
- end
80
-
81
- task :rollback do
82
- unless production? or parallel?
83
- invoke_task_if_exists "parallel:rollback"
84
- end
85
- end
86
62
  end
87
63
  end
64
+
@@ -1,6 +1,6 @@
1
1
  module Bard
2
2
  module Rake
3
- VERSION = "0.15.0"
3
+ VERSION = "0.16.0"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-12 00:00:00.000000000 Z
11
+ date: 2018-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
- rubygems_version: 2.6.8
116
+ rubygems_version: 2.4.6
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: Rake tasks for all bard projects.