seedbank 0.3.0.pre → 0.3.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/Gemfile +2 -6
- data/README.md +7 -0
- data/gemfiles/rake0.9.gemfile +14 -0
- data/gemfiles/rake10.gemfile +15 -0
- data/lib/seedbank/dsl.rb +11 -1
- data/lib/seedbank/version.rb +1 -1
- data/lib/tasks/seed.rake +5 -1
- data/test/lib/tasks/seed_rake_test.rb +4 -4
- metadata +4 -2
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,14 +3,10 @@ source "http://rubygems.org"
|
|
3
3
|
# Specify your gem's dependencies in seedbank.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
group :test
|
7
|
-
gem 'rake'
|
8
|
-
end
|
6
|
+
gem 'rake', :group => :test
|
9
7
|
|
10
8
|
# for CRuby, Rubinius, including Windows and RubyInstaller
|
11
9
|
gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
|
12
10
|
|
13
11
|
# for JRuby
|
14
|
-
platform :jruby
|
15
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
16
|
-
end
|
12
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
data/README.md
CHANGED
@@ -137,6 +137,13 @@ git log | grep Author | sort | uniq
|
|
137
137
|
* Philip Arndt
|
138
138
|
* Peter Suschlik
|
139
139
|
* Joost Baaij
|
140
|
+
* Justin Smestad
|
141
|
+
* Peter Suschlik
|
142
|
+
* Philip Arndt
|
143
|
+
* Tim Galeckas
|
144
|
+
* lulalala
|
145
|
+
* pivotal-cloudplanner
|
146
|
+
* vkill
|
140
147
|
|
141
148
|
Note on Patches/Pull Request
|
142
149
|
============================
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in seedbank.gemspec
|
4
|
+
gemspec :path => "../"
|
5
|
+
|
6
|
+
gem 'rake', '~>0.9.0', :group => :test
|
7
|
+
|
8
|
+
# for CRuby, Rubinius, including Windows and RubyInstaller
|
9
|
+
gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
|
10
|
+
|
11
|
+
# for JRuby
|
12
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
13
|
+
|
14
|
+
gem 'seedbank', :path => '../'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in seedbank.gemspec
|
4
|
+
gemspec :path=>"../"
|
5
|
+
|
6
|
+
gem 'rake', '~>10.0', :group => :test
|
7
|
+
|
8
|
+
# for CRuby, Rubinius, including Windows and RubyInstaller
|
9
|
+
gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
|
10
|
+
|
11
|
+
# for JRuby
|
12
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
13
|
+
|
14
|
+
gem 'seedbank', :path => '../'
|
15
|
+
|
data/lib/seedbank/dsl.rb
CHANGED
@@ -4,7 +4,7 @@ module Seedbank
|
|
4
4
|
def override_seed_task(*args)
|
5
5
|
task_name, arg_names, deps = Rake.application.resolve_args(args)
|
6
6
|
seed_task = Rake::Task.task_defined?(task_name) ? Rake::Task[task_name].clear : Rake::Task.define_task(task_name)
|
7
|
-
seed_task
|
7
|
+
add_comment_to(seed_task, Rake.application.last_description)
|
8
8
|
seed_task.enhance deps
|
9
9
|
end
|
10
10
|
|
@@ -46,5 +46,15 @@ module Seedbank
|
|
46
46
|
Pathname.new Seedbank.seeds_root
|
47
47
|
end
|
48
48
|
|
49
|
+
private
|
50
|
+
|
51
|
+
def add_comment_to(seed_task, comment)
|
52
|
+
if seed_task.respond_to?(:clear_comments)
|
53
|
+
seed_task.comment = comment
|
54
|
+
else
|
55
|
+
seed_task.send :instance_variable_set, '@full_comment', comment
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
49
59
|
end
|
50
60
|
end
|
data/lib/seedbank/version.rb
CHANGED
data/lib/tasks/seed.rake
CHANGED
@@ -26,7 +26,11 @@ namespace :db do
|
|
26
26
|
override_dependency << "db:seed:#{environment}" if defined?(Rails) && Rails.env == environment
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
if Rails.version > '4'
|
30
|
+
original_seeds_file = Rails.application.paths["db/seeds.rb"].existent.first
|
31
|
+
else
|
32
|
+
original_seeds_file = Rails.application.paths["db/seeds"].existent.first
|
33
|
+
end
|
30
34
|
define_seed_task original_seeds_file, :original if original_seeds_file
|
31
35
|
end
|
32
36
|
|
@@ -4,7 +4,7 @@ describe 'Seedbank rake.task' do
|
|
4
4
|
|
5
5
|
describe "seeds with dependency" do
|
6
6
|
|
7
|
-
subject { Rake.application.tasks_in_scope %w[db seed] }
|
7
|
+
subject { Rake.application.tasks_in_scope(defined?(Rake::Scope) ? Rake::Scope.new('db:seed') : %w[db seed]) }
|
8
8
|
|
9
9
|
it "creates all the seed tasks" do
|
10
10
|
seeds = %w(db:seed:circular1 db:seed:circular2 db:seed:common db:seed:dependency db:seed:dependency2
|
@@ -22,7 +22,7 @@ describe 'Seedbank rake.task' do
|
|
22
22
|
|
23
23
|
describe seed do
|
24
24
|
|
25
|
-
subject { Rake.application.lookup(
|
25
|
+
subject { Rake.application.lookup(['db', 'seed', seed].join(':')) }
|
26
26
|
|
27
27
|
it "is dependent on db:abort_if_pending_migrations" do
|
28
28
|
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations]
|
@@ -76,7 +76,7 @@ describe 'Seedbank rake.task' do
|
|
76
76
|
|
77
77
|
describe seed do
|
78
78
|
|
79
|
-
subject { Rake.application.lookup(
|
79
|
+
subject { Rake.application.lookup(['db', 'seed', environment, seed].join(':')) }
|
80
80
|
|
81
81
|
it "is dependent on db:abort_if_pending_migrations" do
|
82
82
|
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations]
|
@@ -87,7 +87,7 @@ describe 'Seedbank rake.task' do
|
|
87
87
|
|
88
88
|
describe "db:seed:#{environment}" do
|
89
89
|
|
90
|
-
subject { Rake.application.lookup(
|
90
|
+
subject { Rake.application.lookup(['db', 'seed', environment].join(':')) }
|
91
91
|
|
92
92
|
it "is dependent on the seeds in the environment directory" do
|
93
93
|
prerequisite_seeds = Dir[File.expand_path("../../../dummy/db/seeds/#{environment}/*.seeds.rb", __FILE__)].sort.map do |seed_file|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seedbank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.
|
4
|
+
version: 0.3.0.pre2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -75,6 +75,8 @@ files:
|
|
75
75
|
- README.md
|
76
76
|
- Rakefile
|
77
77
|
- TODO.txt
|
78
|
+
- gemfiles/rake0.9.gemfile
|
79
|
+
- gemfiles/rake10.gemfile
|
78
80
|
- lib/seedbank.rb
|
79
81
|
- lib/seedbank/dsl.rb
|
80
82
|
- lib/seedbank/railtie.rb
|