seed_migrations 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +38 -0
- data/lib/generators/seed_migrations/seed_migration_generator.rb +11 -0
- data/lib/generators/seed_migrations/templates/seed_migration.rb +7 -0
- data/lib/seed_migrations.rb +8 -0
- data/lib/seed_migrations/railties.rb +6 -0
- data/lib/seed_migrations/seed_migration.rb +60 -0
- data/lib/seed_migrations/version.rb +3 -0
- data/lib/tasks/seed_migrations_tasks.rake +15 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/plant.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +56 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120604133203_create_plants.rb +11 -0
- data/test/dummy/db/schema.rb +19 -0
- data/test/dummy/db/seed/20120604133720_add_plant.rb +7 -0
- data/test/dummy/db/seed/20120604133721_add_one_more_plant.rb +7 -0
- data/test/dummy/db/seed/20120604133722_add_one_more_plant_failing.rb +9 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +23 -0
- data/test/dummy/log/test.log +580 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/seed_migration_generator_test.rb +20 -0
- data/test/seed_migrations_test.rb +37 -0
- data/test/test_helper.rb +32 -0
- metadata +160 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SeedMigrationGeneratorTest < Rails::Generators::TestCase
|
4
|
+
tests SeedMigrationGenerator
|
5
|
+
destination File.expand_path("../tmp/", File.dirname(__FILE__))
|
6
|
+
setup :prepare_destination
|
7
|
+
|
8
|
+
test "Assert all files are properly created" do
|
9
|
+
run_generator %w{ big_elephant }
|
10
|
+
timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
|
11
|
+
base_name = "#{timestamp}_big_elephant"
|
12
|
+
assert_file "db/seed/#{base_name}.rb"
|
13
|
+
|
14
|
+
run_generator %w{ SmallElephant }
|
15
|
+
timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
|
16
|
+
base_name = "#{timestamp}_small_elephant"
|
17
|
+
assert_file "db/seed/#{base_name}.rb"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SeedMigrationsTest < ActiveSupport::TestCase
|
4
|
+
class SeedMigrations::Nope < StandardError; end
|
5
|
+
|
6
|
+
setup do
|
7
|
+
Rake.application.rake_require "tasks/seed_migrations_tasks"
|
8
|
+
Rake::Task.define_task(:environment)
|
9
|
+
Rake::Task['db:seed'].reenable
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
test 'loading seeds is possible' do
|
14
|
+
assert_difference("Plant.count", 2) do
|
15
|
+
assert_raise(SeedMigrations::Nope) { Rake::Task['db:seed'].invoke }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
test 'loading seeds happens only once' do
|
20
|
+
assert_difference("Plant.count", 2) do
|
21
|
+
assert_raise(SeedMigrations::Nope) { Rake::Task['db:seed'].invoke }
|
22
|
+
end
|
23
|
+
Rake::Task['db:seed'].reenable
|
24
|
+
assert_difference("Plant.count", 0) do
|
25
|
+
assert_raise(SeedMigrations::Nope) { Rake::Task['db:seed'].invoke }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
test 'reloading the last seed is possible' do
|
30
|
+
assert_difference("Plant.count", 2) do
|
31
|
+
assert_raise(SeedMigrations::Nope) { Rake::Task['db:seed'].invoke }
|
32
|
+
end
|
33
|
+
assert_difference("Plant.count", 1) do
|
34
|
+
Rake::Task['db:seed:last'].invoke
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
if RUBY_VERSION >= '1.9'
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
if artifacts_dir = ENV['CC_BUILD_ARTIFACTS']
|
5
|
+
coverage_dir Pathname.new(artifacts_dir).relative_path_from(Pathname.new(SimpleCov.root)).to_s
|
6
|
+
end
|
7
|
+
add_filter '/test/'
|
8
|
+
add_filter 'vendor'
|
9
|
+
end
|
10
|
+
|
11
|
+
SimpleCov.at_exit do
|
12
|
+
SimpleCov.result.format!
|
13
|
+
if result = SimpleCov.result
|
14
|
+
File.open(File.join(SimpleCov.coverage_path, 'coverage_percent.txt'), 'w') { |f| f << result.covered_percent.to_s }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
# Configure Rails Environment
|
19
|
+
ENV["RAILS_ENV"] = "test"
|
20
|
+
|
21
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
22
|
+
require "rails/test_help"
|
23
|
+
|
24
|
+
Rails.backtrace_cleaner.remove_silencers!
|
25
|
+
|
26
|
+
# Load support files
|
27
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
28
|
+
|
29
|
+
# Load fixtures from the engine
|
30
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
31
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: seed_migrations
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dustin Eversmann
|
9
|
+
- onrooby GmbH
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-06-12 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
requirement: &2151927980 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.2.3
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2151927980
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: sqlite3
|
28
|
+
requirement: &2151927480 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2151927480
|
37
|
+
description: Handle seeding like migrating
|
38
|
+
email:
|
39
|
+
- admin@onrooby.com
|
40
|
+
executables: []
|
41
|
+
extensions: []
|
42
|
+
extra_rdoc_files: []
|
43
|
+
files:
|
44
|
+
- lib/generators/seed_migrations/seed_migration_generator.rb
|
45
|
+
- lib/generators/seed_migrations/templates/seed_migration.rb
|
46
|
+
- lib/seed_migrations/railties.rb
|
47
|
+
- lib/seed_migrations/seed_migration.rb
|
48
|
+
- lib/seed_migrations/version.rb
|
49
|
+
- lib/seed_migrations.rb
|
50
|
+
- lib/tasks/seed_migrations_tasks.rake
|
51
|
+
- MIT-LICENSE
|
52
|
+
- Rakefile
|
53
|
+
- README.rdoc
|
54
|
+
- test/dummy/app/assets/javascripts/application.js
|
55
|
+
- test/dummy/app/assets/stylesheets/application.css
|
56
|
+
- test/dummy/app/controllers/application_controller.rb
|
57
|
+
- test/dummy/app/helpers/application_helper.rb
|
58
|
+
- test/dummy/app/models/plant.rb
|
59
|
+
- test/dummy/app/views/layouts/application.html.erb
|
60
|
+
- test/dummy/config/application.rb
|
61
|
+
- test/dummy/config/boot.rb
|
62
|
+
- test/dummy/config/database.yml
|
63
|
+
- test/dummy/config/environment.rb
|
64
|
+
- test/dummy/config/environments/development.rb
|
65
|
+
- test/dummy/config/environments/production.rb
|
66
|
+
- test/dummy/config/environments/test.rb
|
67
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
68
|
+
- test/dummy/config/initializers/inflections.rb
|
69
|
+
- test/dummy/config/initializers/mime_types.rb
|
70
|
+
- test/dummy/config/initializers/secret_token.rb
|
71
|
+
- test/dummy/config/initializers/session_store.rb
|
72
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
73
|
+
- test/dummy/config/locales/en.yml
|
74
|
+
- test/dummy/config/routes.rb
|
75
|
+
- test/dummy/config.ru
|
76
|
+
- test/dummy/db/development.sqlite3
|
77
|
+
- test/dummy/db/migrate/20120604133203_create_plants.rb
|
78
|
+
- test/dummy/db/schema.rb
|
79
|
+
- test/dummy/db/seed/20120604133720_add_plant.rb
|
80
|
+
- test/dummy/db/seed/20120604133721_add_one_more_plant.rb
|
81
|
+
- test/dummy/db/seed/20120604133722_add_one_more_plant_failing.rb
|
82
|
+
- test/dummy/db/test.sqlite3
|
83
|
+
- test/dummy/log/development.log
|
84
|
+
- test/dummy/log/test.log
|
85
|
+
- test/dummy/public/404.html
|
86
|
+
- test/dummy/public/422.html
|
87
|
+
- test/dummy/public/500.html
|
88
|
+
- test/dummy/public/favicon.ico
|
89
|
+
- test/dummy/Rakefile
|
90
|
+
- test/dummy/README.rdoc
|
91
|
+
- test/dummy/script/rails
|
92
|
+
- test/seed_migration_generator_test.rb
|
93
|
+
- test/seed_migrations_test.rb
|
94
|
+
- test/test_helper.rb
|
95
|
+
homepage: http://rubygems.org/gems/seed_migrations
|
96
|
+
licenses: []
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 1.8.11
|
116
|
+
signing_key:
|
117
|
+
specification_version: 3
|
118
|
+
summary: Extension of seed behaviour for rails applications
|
119
|
+
test_files:
|
120
|
+
- test/dummy/app/assets/javascripts/application.js
|
121
|
+
- test/dummy/app/assets/stylesheets/application.css
|
122
|
+
- test/dummy/app/controllers/application_controller.rb
|
123
|
+
- test/dummy/app/helpers/application_helper.rb
|
124
|
+
- test/dummy/app/models/plant.rb
|
125
|
+
- test/dummy/app/views/layouts/application.html.erb
|
126
|
+
- test/dummy/config/application.rb
|
127
|
+
- test/dummy/config/boot.rb
|
128
|
+
- test/dummy/config/database.yml
|
129
|
+
- test/dummy/config/environment.rb
|
130
|
+
- test/dummy/config/environments/development.rb
|
131
|
+
- test/dummy/config/environments/production.rb
|
132
|
+
- test/dummy/config/environments/test.rb
|
133
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
134
|
+
- test/dummy/config/initializers/inflections.rb
|
135
|
+
- test/dummy/config/initializers/mime_types.rb
|
136
|
+
- test/dummy/config/initializers/secret_token.rb
|
137
|
+
- test/dummy/config/initializers/session_store.rb
|
138
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
139
|
+
- test/dummy/config/locales/en.yml
|
140
|
+
- test/dummy/config/routes.rb
|
141
|
+
- test/dummy/config.ru
|
142
|
+
- test/dummy/db/development.sqlite3
|
143
|
+
- test/dummy/db/migrate/20120604133203_create_plants.rb
|
144
|
+
- test/dummy/db/schema.rb
|
145
|
+
- test/dummy/db/seed/20120604133720_add_plant.rb
|
146
|
+
- test/dummy/db/seed/20120604133721_add_one_more_plant.rb
|
147
|
+
- test/dummy/db/seed/20120604133722_add_one_more_plant_failing.rb
|
148
|
+
- test/dummy/db/test.sqlite3
|
149
|
+
- test/dummy/log/development.log
|
150
|
+
- test/dummy/log/test.log
|
151
|
+
- test/dummy/public/404.html
|
152
|
+
- test/dummy/public/422.html
|
153
|
+
- test/dummy/public/500.html
|
154
|
+
- test/dummy/public/favicon.ico
|
155
|
+
- test/dummy/Rakefile
|
156
|
+
- test/dummy/README.rdoc
|
157
|
+
- test/dummy/script/rails
|
158
|
+
- test/seed_migration_generator_test.rb
|
159
|
+
- test/seed_migrations_test.rb
|
160
|
+
- test/test_helper.rb
|