germinator 2.1.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 +7 -0
- data/LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +32 -0
- data/lib/generators/germination_generator.rb +5 -0
- data/lib/generators/germinator_generator.rb +28 -0
- data/lib/generators/install_germinator_generator.rb +21 -0
- data/lib/germinator/base.rb +58 -0
- data/lib/germinator/errors.rb +19 -0
- data/lib/germinator/railtie.rb +11 -0
- data/lib/germinator/seed.rb +168 -0
- data/lib/germinator/seed_config.rb +22 -0
- data/lib/germinator/seed_file.rb +75 -0
- data/lib/germinator/seeder.rb +307 -0
- data/lib/germinator/version.rb +7 -0
- data/lib/germinator.rb +23 -0
- data/lib/tasks/germinator_tasks.rake +67 -0
- data/lib/templates/seed.rb +55 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +23 -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 +78 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/germinator_test.rb +7 -0
- data/test/test_helper.rb +18 -0
- metadata +170 -0
@@ -0,0 +1,307 @@
|
|
1
|
+
require 'germinator/version'
|
2
|
+
require 'germinator/base'
|
3
|
+
require 'germinator/errors'
|
4
|
+
|
5
|
+
module Germinator
|
6
|
+
##
|
7
|
+
# A class to manage the seeding process.
|
8
|
+
#
|
9
|
+
class Seeder < Germinator::Base
|
10
|
+
|
11
|
+
##
|
12
|
+
# Germinates the database by finding unseeded files in the germinate/
|
13
|
+
# directory and attempting to execute their germinate method.
|
14
|
+
#
|
15
|
+
# ==== Parameters:
|
16
|
+
#
|
17
|
+
# *step:* => A maximum number of seeds to germinate. nil or 0 will execute all unseeded files in the germinate directory. (default: nil)
|
18
|
+
#
|
19
|
+
def germinate p={}
|
20
|
+
Base::confirm_database_table
|
21
|
+
|
22
|
+
step = p.has_key?(:step) ? p[:step].to_i : nil
|
23
|
+
step = nil if step==0
|
24
|
+
|
25
|
+
i = 0
|
26
|
+
_seeds = unseeded
|
27
|
+
|
28
|
+
_seeds.keys.sort.each do |seed_name|
|
29
|
+
germinate_by_seed_name seed_name
|
30
|
+
i += 1
|
31
|
+
break if step and i >= step
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Executes a seed file's germinate method using the name of the seed file.
|
37
|
+
# The germinate method is only executed if it has not been executed previously.
|
38
|
+
#
|
39
|
+
def germinate_by_name name
|
40
|
+
Base::confirm_database_table
|
41
|
+
include_seeds
|
42
|
+
_seeds = seeds.select{ |seed_name, seed| seed.name == name }
|
43
|
+
return if _seeds.size == 0
|
44
|
+
seed_name, seed = _seeds.first
|
45
|
+
germinate_by_seed_name seed_name
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Executes a seed file's germinate method using the version of the seed file.
|
50
|
+
# The germinate method is only executed if it has not been executed previously.
|
51
|
+
#
|
52
|
+
def germinate_by_version version
|
53
|
+
_seeds = seeds.select{ |seed_name, seed| seed.version == version }
|
54
|
+
return if _seeds.size == 0
|
55
|
+
seed_name, seed = _seeds.first
|
56
|
+
germinate_by_seed_name seed_name
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
##
|
61
|
+
# Executes a seed file's germinate method using the seed_name (version_name) of
|
62
|
+
# the seed file. The germinate method is only executed if it has not been executed
|
63
|
+
# previously.
|
64
|
+
#
|
65
|
+
def germinate_by_seed_name seed_name
|
66
|
+
Base::confirm_database_table
|
67
|
+
include_seeds
|
68
|
+
_seeds = unseeded
|
69
|
+
return unless _seeds.has_key?(seed_name)
|
70
|
+
|
71
|
+
seed = _seeds[seed_name]
|
72
|
+
|
73
|
+
puts "== #{seed}: GERMINATE ==========", 0
|
74
|
+
begin
|
75
|
+
|
76
|
+
seed_object = get_seed_object seed
|
77
|
+
output_config seed_object
|
78
|
+
seed_object.migrate :up
|
79
|
+
|
80
|
+
add_seeded_version seed.version, seed.name, seed_object.response, seed_object.message, seed_object.config.to_hash
|
81
|
+
rescue Germinator::Errors::InvalidSeedEnvironment => e
|
82
|
+
puts e.message
|
83
|
+
add_seeded_version seed.version, seed.name, seed_object.response, seed_object.message, seed_object.config.to_hash
|
84
|
+
rescue Germinator::Errors::InvalidSeedModel => e
|
85
|
+
puts e.message
|
86
|
+
return if seed_object.config.stop_on_invalid_model
|
87
|
+
add_seeded_version seed.version, seed.name, seed_object.response, seed_object.message, seed_object.config.to_hash
|
88
|
+
puts "Moving on..."
|
89
|
+
rescue Exception => e
|
90
|
+
puts ""
|
91
|
+
puts_error e
|
92
|
+
puts ""
|
93
|
+
puts "There was an error while executing the seeds. Germination stopped!", 0
|
94
|
+
puts ""
|
95
|
+
raise e if !seed_object || seed_object.config.stop_on_error
|
96
|
+
add_seeded_version seed.version, seed.name, seed_object.response, seed_object.message, seed_object.config.to_hash
|
97
|
+
ensure
|
98
|
+
puts "== #{seed}: END ==========", 0
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Shrivels the database by finding seeded files in the germinate/
|
104
|
+
# directory and attempting to execute their shrivel method.
|
105
|
+
#
|
106
|
+
# ==== Parameters:
|
107
|
+
#
|
108
|
+
# *step:* => A maximum number of seeds to shrivel. nil or 0 will execute all unseeded files in the germinate directory. (default: 1)
|
109
|
+
#
|
110
|
+
def shrivel p={}
|
111
|
+
Base::confirm_database_table
|
112
|
+
|
113
|
+
step = p.has_key?(:step) ? p[:step].to_i : 1
|
114
|
+
step = nil if step==0
|
115
|
+
|
116
|
+
i = 0
|
117
|
+
_seeds = seeded
|
118
|
+
|
119
|
+
_seeds.keys.sort.reverse.each do |seed_name|
|
120
|
+
shrivel_by_seed_name seed_name
|
121
|
+
i += 1
|
122
|
+
break if step and i >= step
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
##
|
128
|
+
# Executes a seed file's germinate method using the name of the seed file.
|
129
|
+
# The germinate method is only executed if it has not been executed previously.
|
130
|
+
#
|
131
|
+
def shrivel_by_name name
|
132
|
+
_seeds = seeds.select{ |seed_name, seed| seed.name == name }
|
133
|
+
return if _seeds.size == 0
|
134
|
+
seed_name, seed = _seeds.first
|
135
|
+
shrivel_by_seed_name seed_name
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
##
|
140
|
+
# Executes a seed file's germinate method using the version of the seed file.
|
141
|
+
# The germinate method is only executed if it has not been executed previously.
|
142
|
+
#
|
143
|
+
def shrivel_by_version version
|
144
|
+
_seeds = seeds.select{ |seed_name, seed| seed.version == version }
|
145
|
+
return if _seeds.size == 0
|
146
|
+
seed_name, seed = _seeds.first
|
147
|
+
shrivel_by_seed_name seed_name
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
##
|
152
|
+
# Executes a seed file's germinate method using the seed_name (version_name) of
|
153
|
+
# the seed file. The germinate method is only executed if it has not been executed
|
154
|
+
# previously.
|
155
|
+
#
|
156
|
+
def shrivel_by_seed_name seed_name
|
157
|
+
Base::confirm_database_table
|
158
|
+
include_seeds
|
159
|
+
|
160
|
+
_seeds = seeded
|
161
|
+
return unless _seeds.has_key?(seed_name)
|
162
|
+
|
163
|
+
seed = _seeds[seed_name]
|
164
|
+
|
165
|
+
begin
|
166
|
+
puts "== #{seed}: SHRIVEL ==========", 0
|
167
|
+
seed_object = get_seed_object seed
|
168
|
+
output_config seed_object
|
169
|
+
seed_object.migrate :down
|
170
|
+
puts "== #{seed}: END ==========", 0
|
171
|
+
|
172
|
+
remove_seeded_version seed.version
|
173
|
+
rescue Germinator::Errors::InvalidSeedEnvironment => e
|
174
|
+
puts e.message
|
175
|
+
remove_seeded_version seed.version
|
176
|
+
rescue Germinator::Errors::InvalidSeedModel => e
|
177
|
+
puts e.message
|
178
|
+
return if seed_object && seed_object.config.stop_on_invalid_model
|
179
|
+
remove_seeded_version seed.version
|
180
|
+
puts "Moving on..."
|
181
|
+
rescue Exception => e
|
182
|
+
puts ""
|
183
|
+
puts_error e
|
184
|
+
puts ""
|
185
|
+
puts "There was an error while executing the seeds.", 0
|
186
|
+
puts ""
|
187
|
+
raise e if !seed_object || seed_object.config.stop_on_error
|
188
|
+
puts "Moving on..."
|
189
|
+
remove_seeded_version seed.version
|
190
|
+
ensure
|
191
|
+
puts "== #{seed}: END ==========", 0
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
|
196
|
+
##
|
197
|
+
# Shrivels and then germinates the database by finding seeded files in the germinate/
|
198
|
+
# directory and attempting to execute their shrivel and germinate methods. The germinate
|
199
|
+
# methods get called in order after all of the shrivel methods have been call.
|
200
|
+
#
|
201
|
+
# ==== Parameters:
|
202
|
+
#
|
203
|
+
# *step:* => A maximum number of seeds to reseed. nil or 0 will execute all unseeded files in the germinate directory. (default: nil)
|
204
|
+
#
|
205
|
+
def reseed p={}
|
206
|
+
step = p.has_key?(:step) ? p[:step].to_i : 1
|
207
|
+
step = nil if step==0
|
208
|
+
|
209
|
+
puts "Reseeding the database...", 0
|
210
|
+
puts ""
|
211
|
+
|
212
|
+
shrivel step: step
|
213
|
+
germinate step: step
|
214
|
+
end
|
215
|
+
|
216
|
+
private
|
217
|
+
##
|
218
|
+
# A helper method to include the seed classes into the code so they can be instantiated.
|
219
|
+
#
|
220
|
+
def include_seeds
|
221
|
+
Dir["#{Rails.root}/#{Germinator::SEED_PATH}/*.rb"].each {|file| require file.gsub(/\.rb/, "") }
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
private
|
226
|
+
##
|
227
|
+
# A helper method to instantiate a seed object by class name.
|
228
|
+
#
|
229
|
+
def get_seed_object seed
|
230
|
+
seed_class = "#{seed.class_name}Seeder".constantize
|
231
|
+
seed_object = seed_class.new
|
232
|
+
return seed_object
|
233
|
+
end
|
234
|
+
|
235
|
+
|
236
|
+
private
|
237
|
+
##
|
238
|
+
# Returns a hash of all germinator files as SeedFile objects keyed by seed name.
|
239
|
+
#
|
240
|
+
def seeds
|
241
|
+
hash = {}
|
242
|
+
|
243
|
+
germinate_directory = "#{Rails.root}/#{SEED_PATH}/*.rb"
|
244
|
+
files = Dir[germinate_directory]
|
245
|
+
|
246
|
+
files.each do |file|
|
247
|
+
seed_file = SeedFile.new(file)
|
248
|
+
hash[seed_file.seed_name] = seed_file
|
249
|
+
end
|
250
|
+
|
251
|
+
hash
|
252
|
+
end
|
253
|
+
|
254
|
+
|
255
|
+
private
|
256
|
+
##
|
257
|
+
# Returns a hash of seeded germinator files as SeedFile objects keyed by seed name.
|
258
|
+
#
|
259
|
+
def seeded
|
260
|
+
versions = seeded_versions
|
261
|
+
seeds.select{ |key, seed| versions.include?(seed.version.to_s) }
|
262
|
+
end
|
263
|
+
|
264
|
+
|
265
|
+
private
|
266
|
+
##
|
267
|
+
# Returns a hash of unseeded germinator files as SeedFile objects keyed by seed name.
|
268
|
+
def unseeded
|
269
|
+
versions = seeded_versions
|
270
|
+
seeds.select{ |key, seed| !versions.include?(seed.version.to_s) }
|
271
|
+
end
|
272
|
+
|
273
|
+
|
274
|
+
private
|
275
|
+
##
|
276
|
+
# Requests a list of all of the seeded versions from the database. Returns an array of the
|
277
|
+
# verison numbers.
|
278
|
+
#
|
279
|
+
def seeded_versions
|
280
|
+
#ActiveRecord::Base.establish_connection
|
281
|
+
version_records = ActiveRecord::Base.connection.execute("SELECT * FROM `#{Germinator::VERSION_2_TABLE_NAME}` ORDER BY `version`")
|
282
|
+
|
283
|
+
versions = version_records.map{ |vr| vr[0] }
|
284
|
+
|
285
|
+
versions.sort
|
286
|
+
end
|
287
|
+
|
288
|
+
|
289
|
+
private
|
290
|
+
##
|
291
|
+
# Inserts a seeded version number into the database.
|
292
|
+
#
|
293
|
+
def add_seeded_version version, name, response, message, configuration={}
|
294
|
+
return unless version and (version.to_i > 0)
|
295
|
+
ActiveRecord::Base.connection.execute("INSERT INTO `#{Germinator::VERSION_2_TABLE_NAME}` (version, name, response, message, configuration) VALUES ('#{version.to_s}', '#{name.to_s}', '#{response.to_s.truncate(40, omission: "...#{response.to_s.last(25)}")}', '#{message.to_s}', '#{configuration.to_json}')")
|
296
|
+
end
|
297
|
+
|
298
|
+
|
299
|
+
##
|
300
|
+
# Deletes a seeded version number from the database
|
301
|
+
#
|
302
|
+
def remove_seeded_version version
|
303
|
+
return unless version and (version.to_i > 0)
|
304
|
+
ActiveRecord::Base.connection.execute("DELETE FROM `#{Germinator::VERSION_2_TABLE_NAME}` WHERE `version`='#{version.to_s}'")
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
data/lib/germinator.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Germinator
|
2
|
+
require 'germinator/railtie' if defined?(Rails)
|
3
|
+
|
4
|
+
require 'germinator/base'
|
5
|
+
require 'germinator/seeder'
|
6
|
+
require 'germinator/seed_config'
|
7
|
+
require 'germinator/seed'
|
8
|
+
require 'germinator/seed_file'
|
9
|
+
|
10
|
+
# Default seed path for the germinate files.
|
11
|
+
SEED_PATH = "db/germinate"
|
12
|
+
|
13
|
+
def Germinator.germinate name
|
14
|
+
seeder = Germinator::Seeder.new
|
15
|
+
seeder.germinate_by_name name
|
16
|
+
end
|
17
|
+
|
18
|
+
def Germinator.shrivel name
|
19
|
+
seeder = Germinator::Seeder.new
|
20
|
+
seeder.shrivel_by_name name
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# desc "Explaining what the task does"
|
2
|
+
# task :germinator do
|
3
|
+
# # Task goes here
|
4
|
+
# end
|
5
|
+
|
6
|
+
namespace :db do
|
7
|
+
|
8
|
+
# desc "Executes all available germination files since the last germinate call."
|
9
|
+
task :germinate, [:step] => [:environment] do |t,args|
|
10
|
+
args.with_defaults(:step => nil)
|
11
|
+
seeder = Germinator::Seeder.new
|
12
|
+
seeder.germinate step: args.step
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
# desc "Rollback the germination files one step at a time, unless otherwise specified with STEP= parameter."
|
17
|
+
task :shrivel, [:step] => [:environment] do |t,args|
|
18
|
+
args.with_defaults(:step => 1)
|
19
|
+
seeder = Germinator::Seeder.new
|
20
|
+
seeder.shrivel step: args.step
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# desc "Rolls back the database "
|
25
|
+
task :reseed, [:step] => [:environment] do |t,args|
|
26
|
+
args.with_defaults(:step => nil, :force => false)
|
27
|
+
if Rails.env.production? and not args.force
|
28
|
+
puts "This is the production environment. Reseeding can be very dangerous. Are you sure you want to reseed? (Yes/No)"
|
29
|
+
input = STDIN.gets.chomp
|
30
|
+
return unless input.downcase === 'yes'
|
31
|
+
end
|
32
|
+
|
33
|
+
seeder = Germinator::Seeder.new
|
34
|
+
seeder.reseed step: args.step
|
35
|
+
end
|
36
|
+
|
37
|
+
task :germinate_by_name, [:seed_name] => [:environment] do |t,args|
|
38
|
+
args.with_defaults(:seed_name => nil)
|
39
|
+
unless seed_name.nil?
|
40
|
+
puts "You need to specify a seed_name (without timestamp)."
|
41
|
+
puts ""
|
42
|
+
puts 'Usage: rake db:germinate_by_name["name_of_seed_file"]'
|
43
|
+
puts ""
|
44
|
+
end
|
45
|
+
Germinator.germinate(seed_name)
|
46
|
+
end
|
47
|
+
|
48
|
+
task :shrivel_by_name, [:seed_name] => [:environment] do |t,args|
|
49
|
+
args.with_defaults(:seed_name => nil)
|
50
|
+
unless seed_name.nil?
|
51
|
+
puts "You need to specify a seed_name (without timestamp)."
|
52
|
+
puts ""
|
53
|
+
puts 'Usage: rake db:shrivel_by_name["name_of_seed_file"]'
|
54
|
+
puts ""
|
55
|
+
end
|
56
|
+
Germinator.shrivel(seed_name)
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
# desc "DEPRECATED: Execute the plant method of a specific germination file, regardless of whether it's been run previously. (No longer available)"
|
61
|
+
task :plant, [:seed_name] => [:environment] do |t,args|
|
62
|
+
puts ""
|
63
|
+
puts "!! The plant rake task has been removed. Please create a rake task for repeatable database manipulations."
|
64
|
+
puts ""
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class %{class_name}Seeder < Germinator::Seed
|
2
|
+
|
3
|
+
#
|
4
|
+
# Set the configuration for the seed to use during execution.
|
5
|
+
#
|
6
|
+
def configure config
|
7
|
+
# stop_on_error determines if the germination process should stop when a
|
8
|
+
# seed file encounters an error during execution. FALSE = Germinator records
|
9
|
+
# the error and continues. TRUE = Germinator stops at the error and halts
|
10
|
+
# all future germinator execution.
|
11
|
+
|
12
|
+
config.stop_on_error = false # Default: Continue on all errors.
|
13
|
+
# config.stop_on_error = true # Stop on any error.
|
14
|
+
|
15
|
+
|
16
|
+
# valid_models identifies which models and/or methods need to be present to
|
17
|
+
# properly execute this seed file.
|
18
|
+
|
19
|
+
config.valid_models = true # Default: Don't engage model validation.
|
20
|
+
# config.valid_models = { model1: true, model2: true } # Validate that model1 and model2 exist before executing.
|
21
|
+
# config.valid_models = { model1: [ :field1, :field2 ]} # Validate that model1 exists and that it has field1 and field2 accessible.
|
22
|
+
|
23
|
+
|
24
|
+
# stop_on_bad_model determines if the germination process should stop when a
|
25
|
+
# seed file fails the model validation.
|
26
|
+
|
27
|
+
config.stop_on_invalid_model = false # Default: Continue on to the next germinator if the models fail the validation.
|
28
|
+
# config.stop_on_invalid_model = false # Stop the germinators if the models fail the validation.
|
29
|
+
|
30
|
+
|
31
|
+
# environments identifies which environments it is safe to execute this seed
|
32
|
+
# file in.
|
33
|
+
|
34
|
+
config.environments = true # Default: Execute this seed in all evnironments.
|
35
|
+
# config.environments = false # Disable this seed file and prevent it from executing.
|
36
|
+
# config.environments = "development" # Only execute this seed file in the development environment.
|
37
|
+
# config.environments = ["development", "production"] # Only execute this seed file in the development and production environments.
|
38
|
+
# config.environments = "test" # Only execute this seed file in the test environment.
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# Code to execute during the germinate process (up).
|
44
|
+
#
|
45
|
+
def germinate
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
##
|
50
|
+
# Code to execute during the shrivel process (down).
|
51
|
+
#
|
52
|
+
# def shrivel
|
53
|
+
# end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "germinator"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem 'activerecord-jdbcsqlite3-adapter'
|
3
|
+
#
|
4
|
+
# Configure Using Gemfile
|
5
|
+
# gem 'activerecord-jdbcsqlite3-adapter'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
|
10
|
+
development:
|
11
|
+
<<: *default
|
12
|
+
database: db/development.sqlite3
|
13
|
+
|
14
|
+
# Warning: The database defined as "test" will be erased and
|
15
|
+
# re-generated from your development database when you run "rake".
|
16
|
+
# Do not set this db to the same as development or production.
|
17
|
+
test:
|
18
|
+
<<: *default
|
19
|
+
database: db/test.sqlite3
|
20
|
+
|
21
|
+
production:
|
22
|
+
<<: *default
|
23
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
|
30
|
+
# Adds additional error checking when serving assets at runtime.
|
31
|
+
# Checks for improperly declared sprockets dependencies.
|
32
|
+
# Raises helpful error messages.
|
33
|
+
config.assets.raise_runtime_errors = true
|
34
|
+
|
35
|
+
# Raises error for missing translations
|
36
|
+
# config.action_view.raise_on_missing_translations = true
|
37
|
+
end
|