genesis 1.7.0 → 1.8.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.
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/lib/genesis/tasks/genesis.rake +29 -4
- data/lib/genesis/version.rb +1 -1
- metadata +3 -2
- data/.rvmrc +0 -2
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
genesis
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p392
|
@@ -2,8 +2,11 @@ namespace :db do
|
|
2
2
|
|
3
3
|
desc "Loads seed data for the current environment."
|
4
4
|
task :genesis => :environment do
|
5
|
+
dry_run = ENV['DRY_RUN']
|
6
|
+
|
5
7
|
Genesis::Seeder.verify_or_create_version_table
|
6
|
-
ignores = %w(genesis_common.rb
|
8
|
+
ignores = %w(genesis_common.rb
|
9
|
+
genesis_callbacks.rb)
|
7
10
|
seeds = Dir[File.join( Rails.root, 'db', 'seeds', '*.rb' )] +
|
8
11
|
Dir[File.join( Rails.root, 'db', 'seeds', Rails.env, '*.rb') ]
|
9
12
|
|
@@ -16,13 +19,35 @@ namespace :db do
|
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
19
|
-
|
20
|
-
|
21
22
|
puts "", message( contexts, :using_contexts => using_contexts, :start => true ), ""
|
22
|
-
|
23
|
+
if dry_run
|
24
|
+
r = ActiveRecord::Base.connection.execute( "SELECT `schema_seeds`.* FROM `schema_seeds`" )
|
25
|
+
versions = []
|
26
|
+
executes = []
|
27
|
+
r.each_hash { |rec| versions << rec['version'] }
|
28
|
+
|
29
|
+
puts '-- DRY RUN --', 'Will execute seeds:', ''
|
30
|
+
seeds.reject! { |s| ignores.any? { |i| s.include?( i ) } }
|
31
|
+
|
32
|
+
seeds.each do |s|
|
33
|
+
match = s.match( /^.*\/((\d*)_.*\.rb)$/ )
|
34
|
+
if match
|
35
|
+
executes << match[1] unless versions.include?( match[2] )
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
puts executes.sort.join( "\n" )
|
40
|
+
puts ''
|
41
|
+
else
|
42
|
+
Genesis::Seeder.run( seeds, ENV['VERSION'] || nil, ignores )
|
43
|
+
end
|
23
44
|
puts message( contexts, :using_contexts => using_contexts ), "", ""
|
24
45
|
end
|
25
46
|
|
47
|
+
desc "Loads seed data for the current environment."
|
48
|
+
task :genesis => :environment do
|
49
|
+
end
|
50
|
+
|
26
51
|
desc "Recreates the databse by migrating down to VERSION=0 and then db:migrate and db:seed"
|
27
52
|
task :mulligan => :environment do
|
28
53
|
raise 'Cannot seed production' if ENV['RAILS_ENV'] == 'production' || Rails.env.production?
|
data/lib/genesis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genesis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -166,7 +166,8 @@ files:
|
|
166
166
|
- .document
|
167
167
|
- .gitignore
|
168
168
|
- .rspec
|
169
|
-
- .
|
169
|
+
- .ruby-gemset
|
170
|
+
- .ruby-version
|
170
171
|
- Gemfile
|
171
172
|
- Guardfile
|
172
173
|
- LICENSE
|
data/.rvmrc
DELETED