welaika-suspenders 1.4.0 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -7
- data/.ruby-version +1 -0
- data/.travis.yml +7 -2
- data/CONTRIBUTING.md +24 -26
- data/Gemfile.lock +94 -69
- data/NEWS.md +183 -0
- data/README.md +21 -127
- data/Rakefile +3 -3
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +13 -0
- data/bin/welaika-suspenders +8 -11
- data/lib/{welaika_suspenders → suspenders}/actions.rb +1 -16
- data/lib/suspenders/app_builder.rb +424 -0
- data/lib/{welaika_suspenders → suspenders}/generators/app_generator.rb +50 -54
- data/lib/suspenders/version.rb +5 -0
- data/lib/suspenders.rb +4 -0
- data/{features/support → spec/fakes}/bin/heroku +0 -0
- data/{features/support → spec/fakes}/bin/hub +0 -0
- data/spec/features/github_spec.rb +10 -0
- data/spec/features/heroku_spec.rb +19 -0
- data/spec/features/new_project_spec.rb +115 -0
- data/spec/spec_helper.rb +24 -0
- data/{features → spec}/support/fake_github.rb +1 -1
- data/spec/support/fake_heroku.rb +38 -0
- data/spec/support/suspenders.rb +49 -0
- data/suspenders.gemspec +36 -0
- data/templates/Gemfile.erb +58 -0
- data/templates/Procfile +1 -2
- data/templates/README.md.erb +28 -2
- data/templates/_flashes.html.slim +4 -3
- data/templates/_javascript.html.slim +3 -0
- data/templates/action_mailer.rb +5 -0
- data/templates/application.css.scss +3 -4
- data/templates/bin_setup.erb +34 -0
- data/templates/config_i18n_tasks.yml +13 -0
- data/templates/config_locales_en.yml.erb +19 -0
- data/templates/database_cleaner_rspec.rb +1 -4
- data/templates/development_seeds.rb +12 -0
- data/templates/errors.rb +22 -16
- data/templates/{factory_girl_syntax_rspec.rb → factory_girl_rspec.rb} +0 -0
- data/templates/i18n.rb +3 -0
- data/templates/newrelic.yml.erb +34 -0
- data/templates/postgresql_database.yml.erb +1 -1
- data/templates/rack_timeout.rb +1 -1
- data/templates/rails_helper.rb +23 -0
- data/templates/sample.env +1 -12
- data/templates/secrets.yml +14 -0
- data/templates/smtp.rb +9 -10
- data/templates/spec_helper.rb +16 -0
- data/templates/staging.rb +5 -0
- data/templates/suspenders_gitignore +10 -9
- data/templates/suspenders_layout.html.slim +14 -0
- data/templates/travis.yml.erb +24 -0
- data/templates/unicorn.rb +12 -9
- metadata +100 -80
- data/.DS_Store +0 -0
- data/features/github_repo.feature +0 -8
- data/features/heroku_true.feature +0 -9
- data/features/rake_clean.feature +0 -15
- data/features/step_definitions/suspenders_steps.rb +0 -69
- data/features/support/env.rb +0 -10
- data/features/support/fake_heroku.rb +0 -21
- data/lib/welaika_suspenders/app_builder.rb +0 -318
- data/lib/welaika_suspenders/version.rb +0 -4
- data/lib/welaika_suspenders/version_check.rb +0 -26
- data/templates/.DS_Store +0 -0
- data/templates/Gemfile_clean +0 -56
- data/templates/bin_setup +0 -11
- data/templates/capybara_selectors.rb +0 -29
- data/templates/config_locales_en.yml +0 -11
- data/templates/create_dragonfly_jobs.rb +0 -9
- data/templates/dragonfly.rb +0 -9
- data/templates/dragonfly_initializer.rb +0 -47
- data/templates/exist_in_db.rb +0 -6
- data/templates/factories_spec.rb +0 -14
- data/templates/factories_spec_rake_task.rb +0 -9
- data/templates/import_common_javascripts +0 -4
- data/templates/model_spec_helper.rb +0 -38
- data/templates/presenters.rb +0 -3
- data/templates/rails_root_definition.rb +0 -2
- data/templates/rspec +0 -2
- data/templates/rspec_config.rb +0 -16
- data/templates/simplecov_init.rb +0 -3
- data/templates/suspenders_layout.html.slim.erb +0 -12
- data/templates/unit_spec_helper.rb +0 -15
- data/welaika-suspenders.gemspec +0 -35
@@ -1,318 +0,0 @@
|
|
1
|
-
module WelaikaSuspenders
|
2
|
-
class AppBuilder < Rails::AppBuilder
|
3
|
-
include WelaikaSuspenders::Actions
|
4
|
-
|
5
|
-
def readme
|
6
|
-
template 'README.md.erb', 'README.md'
|
7
|
-
end
|
8
|
-
|
9
|
-
def remove_public_index
|
10
|
-
remove_file 'public/index.html'
|
11
|
-
end
|
12
|
-
|
13
|
-
def remove_rails_logo_image
|
14
|
-
remove_file 'app/assets/images/rails.png'
|
15
|
-
end
|
16
|
-
|
17
|
-
def raise_on_delivery_errors
|
18
|
-
replace_in_file 'config/environments/development.rb',
|
19
|
-
'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
20
|
-
end
|
21
|
-
|
22
|
-
def raise_on_unpermitted_parameters
|
23
|
-
configure_environment 'development',
|
24
|
-
'config.action_controller.action_on_unpermitted_parameters = :raise'
|
25
|
-
end
|
26
|
-
|
27
|
-
def provide_setup_script
|
28
|
-
copy_file 'bin_setup', 'bin/setup'
|
29
|
-
run 'chmod a+x bin/setup'
|
30
|
-
end
|
31
|
-
|
32
|
-
def configure_generators
|
33
|
-
config = <<-RUBY
|
34
|
-
config.generators do |generate|
|
35
|
-
generate.helper false
|
36
|
-
generate.javascript_engine false
|
37
|
-
generate.request_specs false
|
38
|
-
generate.routing_specs false
|
39
|
-
generate.stylesheets false
|
40
|
-
generate.test_framework :rspec
|
41
|
-
generate.view_specs false
|
42
|
-
end
|
43
|
-
|
44
|
-
RUBY
|
45
|
-
|
46
|
-
inject_into_class 'config/application.rb', 'Application', config
|
47
|
-
end
|
48
|
-
|
49
|
-
def enable_factory_girl_syntax
|
50
|
-
copy_file 'factory_girl_syntax_rspec.rb', 'spec/support/factory_girl.rb'
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_factories_first
|
54
|
-
copy_file 'factories_spec.rb', 'spec/models/factories_spec.rb'
|
55
|
-
append_file 'Rakefile', factories_spec_rake_task
|
56
|
-
end
|
57
|
-
|
58
|
-
def configure_smtp
|
59
|
-
copy_file 'smtp.rb', 'config/initializers/smtp.rb'
|
60
|
-
|
61
|
-
prepend_file 'config/environments/production.rb',
|
62
|
-
"require Rails.root.join('config/initializers/smtp')\n"
|
63
|
-
|
64
|
-
config = <<-RUBY
|
65
|
-
|
66
|
-
config.action_mailer.delivery_method = :smtp
|
67
|
-
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
68
|
-
RUBY
|
69
|
-
|
70
|
-
inject_into_file 'config/environments/production.rb', config,
|
71
|
-
:after => 'config.action_mailer.raise_delivery_errors = false'
|
72
|
-
end
|
73
|
-
|
74
|
-
def setup_staging_environment
|
75
|
-
run 'cp config/environments/production.rb config/environments/staging.rb'
|
76
|
-
|
77
|
-
prepend_file 'config/environments/staging.rb',
|
78
|
-
"Mail.register_interceptor RecipientInterceptor.new(ENV['EMAIL_RECIPIENTS'])\n"
|
79
|
-
end
|
80
|
-
|
81
|
-
def initialize_on_precompile
|
82
|
-
inject_into_file 'config/application.rb',
|
83
|
-
"\n config.assets.initialize_on_precompile = false",
|
84
|
-
:after => 'config.assets.enabled = true'
|
85
|
-
end
|
86
|
-
|
87
|
-
def create_partials_directory
|
88
|
-
empty_directory 'app/views/application'
|
89
|
-
end
|
90
|
-
|
91
|
-
def create_shared_flashes
|
92
|
-
copy_file '_flashes.html.slim', 'app/views/application/_flashes.html.slim'
|
93
|
-
end
|
94
|
-
|
95
|
-
def create_shared_javascripts
|
96
|
-
copy_file '_javascript.html.slim', 'app/views/application/_javascript.html.slim'
|
97
|
-
end
|
98
|
-
|
99
|
-
def create_application_layout
|
100
|
-
remove_file 'app/views/layouts/application.html.erb'
|
101
|
-
template 'suspenders_layout.html.slim.erb',
|
102
|
-
'app/views/layouts/application.html.slim',
|
103
|
-
:force => true
|
104
|
-
end
|
105
|
-
|
106
|
-
def setup_javascripts
|
107
|
-
remove_file 'app/assets/javascripts/application.js'
|
108
|
-
copy_file 'import_common_javascripts', 'app/assets/javascripts/application.js.coffee'
|
109
|
-
end
|
110
|
-
|
111
|
-
def setup_presenters
|
112
|
-
copy_file 'presenters.rb', 'config/initializers/showoff.rb'
|
113
|
-
end
|
114
|
-
|
115
|
-
def use_postgres_config_template
|
116
|
-
template 'postgresql_database.yml.erb', 'config/database.yml',
|
117
|
-
:force => true
|
118
|
-
end
|
119
|
-
|
120
|
-
def create_database
|
121
|
-
bundle_command 'exec rake db:create'
|
122
|
-
end
|
123
|
-
|
124
|
-
def replace_gemfile
|
125
|
-
remove_file 'Gemfile'
|
126
|
-
copy_file 'Gemfile_clean', 'Gemfile'
|
127
|
-
end
|
128
|
-
|
129
|
-
def set_ruby_to_version_being_used
|
130
|
-
inject_into_file 'Gemfile', "\n\nruby '#{RUBY_VERSION}'",
|
131
|
-
after: /source 'https:\/\/rubygems.org'/
|
132
|
-
end
|
133
|
-
|
134
|
-
def enable_database_cleaner
|
135
|
-
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
|
136
|
-
end
|
137
|
-
|
138
|
-
def configure_dragonfly
|
139
|
-
copy_file 'dragonfly_initializer.rb', 'config/initializers/dragonfly.rb'
|
140
|
-
copy_file 'create_dragonfly_jobs.rb', 'db/migrate/20130713151359_create_dragonfly_jobs.rb'
|
141
|
-
end
|
142
|
-
|
143
|
-
def configure_rspec
|
144
|
-
remove_file '.rspec'
|
145
|
-
copy_file 'rspec', '.rspec'
|
146
|
-
prepend_file 'spec/spec_helper.rb', rails_root_definition
|
147
|
-
prepend_file 'spec/spec_helper.rb', simplecov_init
|
148
|
-
|
149
|
-
replace_in_file 'spec/spec_helper.rb', /RSpec.configure do.*end\n/m, ""
|
150
|
-
|
151
|
-
copy_file 'capybara_selectors.rb', 'spec/support/capybara_selectors.rb'
|
152
|
-
copy_file 'exist_in_db.rb', 'spec/support/matchers/exist_in_db.rb'
|
153
|
-
copy_file 'dragonfly.rb', 'spec/support/dragonfly.rb'
|
154
|
-
|
155
|
-
copy_file 'rspec_config.rb', 'spec/support/rspec_config.rb'
|
156
|
-
copy_file 'unit_spec_helper.rb', 'spec/unit_spec_helper.rb'
|
157
|
-
copy_file 'model_spec_helper.rb', 'spec/model_spec_helper.rb'
|
158
|
-
end
|
159
|
-
|
160
|
-
def configure_background_jobs_for_rspec
|
161
|
-
copy_file 'background_jobs_rspec.rb', 'spec/support/background_jobs.rb'
|
162
|
-
end
|
163
|
-
|
164
|
-
def configure_time_zone
|
165
|
-
config = <<-RUBY
|
166
|
-
config.active_record.default_timezone = :utc
|
167
|
-
|
168
|
-
RUBY
|
169
|
-
inject_into_class 'config/application.rb', 'Application', config
|
170
|
-
end
|
171
|
-
|
172
|
-
def configure_time_formats
|
173
|
-
remove_file 'config/locales/en.yml'
|
174
|
-
copy_file 'config_locales_en.yml', 'config/locales/en.yml'
|
175
|
-
end
|
176
|
-
|
177
|
-
def configure_rack_timeout
|
178
|
-
copy_file 'rack_timeout.rb', 'config/initializers/rack_timeout.rb'
|
179
|
-
end
|
180
|
-
|
181
|
-
def configure_action_mailer
|
182
|
-
action_mailer_host 'development', "#{app_name}.local"
|
183
|
-
action_mailer_host 'test', 'www.example.com'
|
184
|
-
action_mailer_host 'staging', "staging.#{app_name}.com"
|
185
|
-
action_mailer_host 'production', "#{app_name}.com"
|
186
|
-
end
|
187
|
-
|
188
|
-
def generate_rspec
|
189
|
-
generate 'rspec:install'
|
190
|
-
end
|
191
|
-
|
192
|
-
def configure_capybara_webkit
|
193
|
-
append_file 'spec/spec_helper.rb' do
|
194
|
-
"\nCapybara.javascript_driver = :webkit\n"
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
def generate_clearance
|
199
|
-
generate 'clearance:install'
|
200
|
-
end
|
201
|
-
|
202
|
-
def configure_unicorn
|
203
|
-
copy_file 'unicorn.rb', 'config/unicorn.rb'
|
204
|
-
end
|
205
|
-
|
206
|
-
def setup_foreman
|
207
|
-
copy_file 'sample.env', '.sample.env'
|
208
|
-
copy_file 'sample.env', '.env'
|
209
|
-
copy_file 'Procfile', 'Procfile'
|
210
|
-
end
|
211
|
-
|
212
|
-
def setup_stylesheets
|
213
|
-
remove_file 'app/assets/stylesheets/application.css'
|
214
|
-
copy_file 'application.css.scss', 'app/assets/stylesheets/application.css.scss'
|
215
|
-
end
|
216
|
-
|
217
|
-
def gitignore_files
|
218
|
-
concat_file 'suspenders_gitignore', '.gitignore'
|
219
|
-
[
|
220
|
-
'app/assets/images',
|
221
|
-
'app/models',
|
222
|
-
'app/presenters',
|
223
|
-
'app/services',
|
224
|
-
'db/migrate',
|
225
|
-
'log',
|
226
|
-
'spec/controllers',
|
227
|
-
'spec/features',
|
228
|
-
'spec/helpers',
|
229
|
-
'spec/lib',
|
230
|
-
'spec/models',
|
231
|
-
'spec/presenters',
|
232
|
-
'spec/services',
|
233
|
-
'spec/support',
|
234
|
-
'spec/support/shared_examples',
|
235
|
-
'spec/support/matchers',
|
236
|
-
'spec/views',
|
237
|
-
].each do |dir|
|
238
|
-
run "mkdir #{dir}"
|
239
|
-
run "touch #{dir}/.gitkeep"
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
|
244
|
-
def init_git
|
245
|
-
run 'git init'
|
246
|
-
end
|
247
|
-
|
248
|
-
def create_heroku_apps
|
249
|
-
path_addition = override_path_for_tests
|
250
|
-
run "#{path_addition} heroku create #{app_name}-production --remote=production"
|
251
|
-
run "#{path_addition} heroku create #{app_name}-staging --remote=staging"
|
252
|
-
run "#{path_addition} heroku config:add RACK_ENV=staging RAILS_ENV=staging --remote=staging"
|
253
|
-
end
|
254
|
-
|
255
|
-
def create_github_repo(repo_name)
|
256
|
-
path_addition = override_path_for_tests
|
257
|
-
run "#{path_addition} hub create #{repo_name}"
|
258
|
-
end
|
259
|
-
|
260
|
-
def copy_miscellaneous_files
|
261
|
-
copy_file 'errors.rb', 'config/initializers/errors.rb'
|
262
|
-
end
|
263
|
-
|
264
|
-
def customize_error_pages
|
265
|
-
meta_tags =<<-EOS
|
266
|
-
<meta charset='utf-8' />
|
267
|
-
<meta name='ROBOTS' content='NOODP' />
|
268
|
-
EOS
|
269
|
-
style_tags =<<-EOS
|
270
|
-
<link href='/assets/application.css' media='all' rel='stylesheet' type='text/css' />
|
271
|
-
EOS
|
272
|
-
|
273
|
-
%w(500 404 422).each do |page|
|
274
|
-
inject_into_file "public/#{page}.html", meta_tags, :after => "<head>\n"
|
275
|
-
replace_in_file "public/#{page}.html", /<style.+>.+<\/style>/mi, style_tags.strip
|
276
|
-
replace_in_file "public/#{page}.html", /<!--.+-->\n/, ''
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
def remove_routes_comment_lines
|
281
|
-
replace_in_file 'config/routes.rb',
|
282
|
-
/Application\.routes\.draw do.*end/m,
|
283
|
-
"Application.routes.draw do\nend"
|
284
|
-
end
|
285
|
-
|
286
|
-
def disable_xml_params
|
287
|
-
copy_file 'disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
|
288
|
-
end
|
289
|
-
|
290
|
-
def setup_default_rake_task
|
291
|
-
append_file 'Rakefile' do
|
292
|
-
"task(:default).clear\ntask :default => [:spec]\n"
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
private
|
297
|
-
|
298
|
-
def override_path_for_tests
|
299
|
-
if ENV['TESTING']
|
300
|
-
support_bin = File.expand_path(File.join('..', '..', '..', 'features', 'support', 'bin'))
|
301
|
-
"PATH=#{support_bin}:$PATH"
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
def factories_spec_rake_task
|
306
|
-
IO.read find_in_source_paths('factories_spec_rake_task.rb')
|
307
|
-
end
|
308
|
-
|
309
|
-
def simplecov_init
|
310
|
-
IO.read find_in_source_paths('simplecov_init.rb')
|
311
|
-
end
|
312
|
-
|
313
|
-
def rails_root_definition
|
314
|
-
IO.read find_in_source_paths('rails_root_definition.rb')
|
315
|
-
end
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
require 'timeout'
|
3
|
-
require 'welaika_suspenders/version'
|
4
|
-
|
5
|
-
module WelaikaSuspenders
|
6
|
-
module VersionCheck
|
7
|
-
ENDPOINT = 'https://rubygems.org/api/v1/versions/welaika-suspenders.json'
|
8
|
-
|
9
|
-
def self.check_if_up_to_date!
|
10
|
-
data = Timeout::timeout(10) do
|
11
|
-
ActiveSupport::JSON.decode(open(ENDPOINT).read)
|
12
|
-
end
|
13
|
-
latest_version = data.first["number"]
|
14
|
-
up_to_date = Gem::Version.new(latest_version) <= Gem::Version.new(WelaikaSuspenders::VERSION)
|
15
|
-
unless up_to_date
|
16
|
-
puts "[WARNING] It looks like welaika-suspenders has been updated (v#{latest_version})! It is strongly suggested to upgrade to the latest version available with the following command:\n\ngem update welaika-suspenders\n\n"
|
17
|
-
puts "To cancel the execution of the command, press CTRL+C. To continue, just press anything.\n\n"
|
18
|
-
gets
|
19
|
-
end
|
20
|
-
rescue SocketError, Timeout::Error
|
21
|
-
puts "[WARNING] I could not check if this is the latest version available of the gem!\n"
|
22
|
-
puts "To cancel the execution of the command, press CTRL+C. To continue, just press anything.\n\n"
|
23
|
-
gets
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/templates/.DS_Store
DELETED
Binary file
|
data/templates/Gemfile_clean
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'airbrake'
|
4
|
-
gem 'bourbon'
|
5
|
-
gem 'dragonfly'
|
6
|
-
gem 'email_validator'
|
7
|
-
gem 'flutie'
|
8
|
-
gem 'jquery-rails'
|
9
|
-
gem 'neat'
|
10
|
-
gem 'pg'
|
11
|
-
gem 'rack-cache'
|
12
|
-
gem 'rack-timeout'
|
13
|
-
gem 'rails', '>= 4.0.0'
|
14
|
-
gem 'recipient_interceptor'
|
15
|
-
gem 'showcase'
|
16
|
-
gem 'simple_form'
|
17
|
-
gem 'slim-rails'
|
18
|
-
gem 'unicorn'
|
19
|
-
|
20
|
-
group :assets do
|
21
|
-
gem 'coffee-rails'
|
22
|
-
gem 'sass-rails'
|
23
|
-
gem 'uglifier'
|
24
|
-
end
|
25
|
-
|
26
|
-
group :development do
|
27
|
-
gem 'foreman'
|
28
|
-
gem 'better_errors'
|
29
|
-
gem 'binding_of_caller'
|
30
|
-
gem 'letter_opener'
|
31
|
-
end
|
32
|
-
|
33
|
-
group :staging do
|
34
|
-
gem 'recipient_interceptor'
|
35
|
-
end
|
36
|
-
|
37
|
-
group :development, :test do
|
38
|
-
gem 'factory_girl_rails'
|
39
|
-
gem 'rspec-rails'
|
40
|
-
end
|
41
|
-
|
42
|
-
group :test do
|
43
|
-
gem 'bourne', require: false
|
44
|
-
gem 'capybara-webkit', '>= 0.14.1'
|
45
|
-
gem 'database_cleaner'
|
46
|
-
gem 'launchy'
|
47
|
-
gem 'shoulda-matchers'
|
48
|
-
gem 'simplecov', require: false
|
49
|
-
gem 'timecop'
|
50
|
-
end
|
51
|
-
|
52
|
-
group :staging, :production do
|
53
|
-
gem 'newrelic_rpm', '>= 3.5.7'
|
54
|
-
gem 'rails_12factor'
|
55
|
-
end
|
56
|
-
|
data/templates/bin_setup
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/usr/bin/env sh
|
2
|
-
|
3
|
-
# Set up Rails app. Run this script immediately after cloning the codebase.
|
4
|
-
# https://github.com/thoughtbot/guides/tree/master/protocol
|
5
|
-
|
6
|
-
bundle install --binstubs=bin/stubs
|
7
|
-
bundle exec rake db:setup
|
8
|
-
|
9
|
-
if [ ! -f .env ]; then
|
10
|
-
cp .sample.env .env
|
11
|
-
fi
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Capybara.add_selector :record do
|
2
|
-
xpath do |record|
|
3
|
-
XPath.css("#" + ActionController::RecordIdentifier.dom_id(record))
|
4
|
-
end
|
5
|
-
|
6
|
-
match do |record|
|
7
|
-
record.is_a?(ActiveRecord::Base)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
Capybara.add_selector :alert do
|
12
|
-
xpath do
|
13
|
-
XPath.css(".flash.alert")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Capybara.add_selector :notice do
|
18
|
-
xpath do
|
19
|
-
XPath.css(".flash.notice")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Capybara.add_selector :role do
|
24
|
-
xpath do |role|
|
25
|
-
XPath.css("[role=#{role}]")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
|
data/templates/dragonfly.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'uri'
|
2
|
-
require 'dragonfly'
|
3
|
-
require 'rack/cache'
|
4
|
-
|
5
|
-
app = Dragonfly[:images]
|
6
|
-
app.configure_with(:rails)
|
7
|
-
app.configure_with(:imagemagick)
|
8
|
-
app.define_macro(ActiveRecord::Base, :image_accessor)
|
9
|
-
app.define_macro(ActiveRecord::Base, :file_accessor)
|
10
|
-
|
11
|
-
rack_cache_already_inserted = Rails.application.config.action_controller.perform_caching && Rails.application.config.action_dispatch.rack_cache
|
12
|
-
|
13
|
-
Rails.application.middleware.insert 0, Rack::Cache, {
|
14
|
-
:verbose => false,
|
15
|
-
:metastore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), # URI encoded in case of spaces
|
16
|
-
:entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")
|
17
|
-
} unless rack_cache_already_inserted
|
18
|
-
|
19
|
-
Rails.application.middleware.insert_after Rack::Cache, Dragonfly::Middleware, :images
|
20
|
-
|
21
|
-
if ENV['S3_BUCKET']
|
22
|
-
class DragonflyJob < ActiveRecord::Base
|
23
|
-
before_destroy do |thumb|
|
24
|
-
Dragonfly[:images].datastore.destroy(thumb.uid)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
app.cache_duration = 3600*24*365*3
|
29
|
-
app.configure do |c|
|
30
|
-
c.define_url do |app, job, opts|
|
31
|
-
thumb = DragonflyJob.find_by_job(job.serialize)
|
32
|
-
if !thumb
|
33
|
-
uid = job.store
|
34
|
-
thumb = DragonflyJob.create!(uid: uid, job: job.serialize)
|
35
|
-
end
|
36
|
-
app.datastore.url_for(thumb.uid)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
app.datastore = Dragonfly::DataStorage::S3DataStore.new
|
40
|
-
app.datastore.configure do |c|
|
41
|
-
c.bucket_name = ENV['S3_BUCKET']
|
42
|
-
c.access_key_id = ENV['S3_KEY']
|
43
|
-
c.secret_access_key = ENV['S3_SECRET']
|
44
|
-
c.region = ENV['S3_REGION']
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
data/templates/exist_in_db.rb
DELETED
data/templates/factories_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'model_spec_helper'
|
2
|
-
|
3
|
-
FactoryGirl.factories.map(&:name).each do |factory_name|
|
4
|
-
describe "Factory :#{factory_name}" do
|
5
|
-
it 'is valid' do
|
6
|
-
factory = build(factory_name)
|
7
|
-
|
8
|
-
if factory.respond_to?(:valid?)
|
9
|
-
expect(factory).to be_valid, factory.errors.full_messages.join(',')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'unit_spec_helper'
|
2
|
-
require 'active_record'
|
3
|
-
require 'shoulda-matchers'
|
4
|
-
|
5
|
-
db_yml_file = File.expand_path('config/database.yml')
|
6
|
-
db_config = YAML.load_file(db_yml_file)
|
7
|
-
ActiveRecord::Base.establish_connection(db_config['test'])
|
8
|
-
|
9
|
-
require File.join(RAILS_ROOT, "spec/support/database_cleaner.rb")
|
10
|
-
|
11
|
-
# add activerecord plugins here
|
12
|
-
require 'email_validator'
|
13
|
-
# require 'friendly_id'
|
14
|
-
|
15
|
-
# Needed by rspec-rails to work without the whole Rails dependency
|
16
|
-
unless defined?(Rails)
|
17
|
-
module Rails
|
18
|
-
module VERSION
|
19
|
-
STRING = '4'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
require 'rspec/rails/extensions/active_record/base'
|
25
|
-
|
26
|
-
autoload_paths = ActiveSupport::Dependencies.autoload_paths
|
27
|
-
%w(app/models app/validators).each do |path|
|
28
|
-
autoload_paths.push(path) unless autoload_paths.include?(path)
|
29
|
-
end
|
30
|
-
|
31
|
-
require File.join(RAILS_ROOT, "spec/support/dragonfly.rb")
|
32
|
-
|
33
|
-
# find definitions only if factory girls has not been already required
|
34
|
-
if require 'factory_girl'
|
35
|
-
require File.join(RAILS_ROOT, "spec/support/factory_girl.rb")
|
36
|
-
FactoryGirl.find_definitions
|
37
|
-
end
|
38
|
-
|
data/templates/presenters.rb
DELETED
data/templates/rspec
DELETED
data/templates/rspec_config.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'bourne'
|
2
|
-
|
3
|
-
RSpec.configure do |config|
|
4
|
-
config.expect_with :rspec do |c|
|
5
|
-
c.syntax = :expect
|
6
|
-
end
|
7
|
-
config.mock_with :mocha
|
8
|
-
config.order = "random"
|
9
|
-
config.fail_fast = true
|
10
|
-
if defined?(Rails)
|
11
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
12
|
-
config.use_transactional_fixtures = false
|
13
|
-
config.infer_base_class_for_anonymous_controllers = false
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
data/templates/simplecov_init.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'active_support/dependencies'
|
2
|
-
require 'showcase'
|
3
|
-
|
4
|
-
# add project root to load path
|
5
|
-
RAILS_ROOT = File.expand_path('../../', __FILE__) unless defined?(RAILS_ROOT)
|
6
|
-
$LOAD_PATH.unshift(RAILS_ROOT) unless $LOAD_PATH.include?(RAILS_ROOT)
|
7
|
-
|
8
|
-
require File.join(RAILS_ROOT, "spec/support/rspec_config.rb")
|
9
|
-
|
10
|
-
# push project directories to load
|
11
|
-
autoload_paths = ActiveSupport::Dependencies.autoload_paths
|
12
|
-
%w(app/presenters).each do |path|
|
13
|
-
autoload_paths.push(path) unless autoload_paths.include?(path)
|
14
|
-
end
|
15
|
-
|