suspenders 1.15.0 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/NEWS.md +14 -0
- data/README.md +4 -5
- data/lib/suspenders/actions.rb +4 -0
- data/lib/suspenders/app_builder.rb +20 -5
- data/lib/suspenders/generators/app_generator.rb +2 -1
- data/lib/suspenders/version.rb +1 -1
- data/spec/features/new_project_spec.rb +22 -0
- data/suspenders.gemspec +1 -1
- data/templates/Gemfile.erb +3 -2
- data/templates/README.md.erb +12 -2
- data/templates/_flashes.html.erb +7 -5
- data/templates/{bin_setup → bin_setup.erb} +7 -1
- data/templates/config_i18n_tasks.yml +12 -0
- data/templates/development_seeds.rb +0 -1
- data/templates/spec_helper.rb +2 -2
- metadata +8 -8
- data/templates/Brewfile +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca9b05977b2bd1059a7d8f10ddfc7c797cdb6e54
|
4
|
+
data.tar.gz: 0854bdf533abed015ced2096ff37d44cf7830e8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5677d15f7c00172890b334718abdb2c9f09e9ec4c7415032684dab5f4bee688b94b1dd245a82f33417bff3a7e3c5089d7011c239fe516c322d9b70cdf15e455
|
7
|
+
data.tar.gz: 5a564a4598fe4baafcd7168c3a5d3ce868d054f12a64a2d0bee140b84d0675dac8f5e418272567aabf677e430664f418582218367fa1cb67abd94af5cd4f8399
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
suspenders (1.
|
5
|
-
bitters
|
4
|
+
suspenders (1.16.0)
|
5
|
+
bitters (~> 0.10.0)
|
6
6
|
bundler (~> 1.3)
|
7
7
|
rails (= 4.1.4)
|
8
8
|
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
gherkin (2.12.2)
|
69
69
|
multi_json (~> 1.3)
|
70
70
|
hike (1.2.3)
|
71
|
-
i18n (0.6.
|
71
|
+
i18n (0.6.11)
|
72
72
|
json (1.8.1)
|
73
73
|
mail (2.5.4)
|
74
74
|
mime-types (~> 1.16)
|
@@ -108,7 +108,7 @@ GEM
|
|
108
108
|
rspec-expectations (2.99.0)
|
109
109
|
diff-lcs (>= 1.1.3, < 2.0)
|
110
110
|
rspec-mocks (2.99.0)
|
111
|
-
sass (3.3.
|
111
|
+
sass (3.3.14)
|
112
112
|
sprockets (2.12.1)
|
113
113
|
hike (~> 1.2)
|
114
114
|
multi_json (~> 1.0)
|
@@ -124,7 +124,7 @@ GEM
|
|
124
124
|
treetop (1.4.15)
|
125
125
|
polyglot
|
126
126
|
polyglot (>= 0.3.1)
|
127
|
-
tzinfo (1.2.
|
127
|
+
tzinfo (1.2.2)
|
128
128
|
thread_safe (~> 0.1)
|
129
129
|
xpath (2.0.0)
|
130
130
|
nokogiri (~> 1.3)
|
data/NEWS.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
1.16.0 (August 16, 2014)
|
2
|
+
|
3
|
+
* Use the 3.x series of RSpec.
|
4
|
+
* Use the 0.10.x series of Bitters.
|
5
|
+
* Improve documentation in generated README for machine setup via `bin/setup`
|
6
|
+
and https://github.com/thoughtbot/laptop script.
|
7
|
+
* Remove Foreman from `Gemfile`.
|
8
|
+
* Use i18n-tasks for missing or unused translations.
|
9
|
+
* Raise on missing translations in development environment. Fail fast!
|
10
|
+
* Prevent empty div when there are no flashes.
|
11
|
+
* Pick random port when generating Rails app so multiple apps can be run via
|
12
|
+
Foreman on a development machine at the same time.
|
13
|
+
* Add `normalize-rails` gem for resetting browser styles.
|
14
|
+
|
1
15
|
1.15.0 (July 9, 2014)
|
2
16
|
|
3
17
|
* Use Rails 4.1.4.
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Suspenders [![Build Status](https://secure.travis-ci.org/thoughtbot/suspenders.png?branch=master)](http://travis-ci.org/thoughtbot/suspenders)
|
2
2
|
|
3
|
-
Suspenders is the base Rails application used at
|
3
|
+
Suspenders is the base Rails application used at
|
4
|
+
[thoughtbot](http://thoughtbot.com).
|
4
5
|
|
5
6
|
![Suspenders boy](http://media.tumblr.com/1TEAMALpseh5xzf0Jt6bcwSMo1_400.png)
|
6
7
|
|
@@ -17,9 +18,6 @@ Then run:
|
|
17
18
|
|
18
19
|
This will create a Rails app in `projectname` using the latest version of Rails.
|
19
20
|
|
20
|
-
By default this script creates a new git repository. See below if you
|
21
|
-
want to use it against an existing repo.
|
22
|
-
|
23
21
|
Gemfile
|
24
22
|
-------
|
25
23
|
|
@@ -41,6 +39,7 @@ It includes application gems like:
|
|
41
39
|
* [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages
|
42
40
|
* [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery
|
43
41
|
* [Neat](https://github.com/thoughtbot/neat) for semantic grids
|
42
|
+
* [Normalize](https://necolas.github.io/normalize.css/) for resetting browser styles
|
44
43
|
* [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
|
45
44
|
* [Rack Timeout](https://github.com/kch/rack-timeout) to abort requests that are
|
46
45
|
taking too long
|
@@ -177,7 +176,7 @@ Contributing
|
|
177
176
|
|
178
177
|
To update Suspenders' Ruby version, change `.ruby-version` and `.travis.yml`.
|
179
178
|
|
180
|
-
Please see CONTRIBUTING.md for further details.
|
179
|
+
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for further details.
|
181
180
|
|
182
181
|
Credits
|
183
182
|
-------
|
data/lib/suspenders/actions.rb
CHANGED
@@ -9,6 +9,10 @@ module Suspenders
|
|
9
9
|
File.open(path, "w") { |file| file.write(contents) }
|
10
10
|
end
|
11
11
|
|
12
|
+
def uncomment_in_file(path, uncommented)
|
13
|
+
replace_in_file(path, "# #{uncommented}", uncommented)
|
14
|
+
end
|
15
|
+
|
12
16
|
def action_mailer_host(rails_env, host)
|
13
17
|
host_config = "config.action_mailer.default_url_options = { host: '#{host}' }"
|
14
18
|
configure_environment(rails_env, host_config)
|
@@ -15,7 +15,7 @@ module Suspenders
|
|
15
15
|
action_on_unpermitted_parameters = <<-RUBY
|
16
16
|
|
17
17
|
# Raise an ActionController::UnpermittedParameters exception when
|
18
|
-
# a parameter is not
|
18
|
+
# a parameter is not explicitly permitted but is passed anyway.
|
19
19
|
config.action_controller.action_on_unpermitted_parameters = :raise
|
20
20
|
RUBY
|
21
21
|
inject_into_file(
|
@@ -26,7 +26,7 @@ module Suspenders
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def provide_setup_script
|
29
|
-
|
29
|
+
template 'bin_setup.erb', 'bin/setup', port_number: port_number
|
30
30
|
run 'chmod a+x bin/setup'
|
31
31
|
end
|
32
32
|
|
@@ -183,8 +183,13 @@ end
|
|
183
183
|
template 'travis.yml.erb', '.travis.yml'
|
184
184
|
end
|
185
185
|
|
186
|
-
def
|
187
|
-
|
186
|
+
def configure_i18n_for_development_environment
|
187
|
+
raise_on_missing_translations_in("development")
|
188
|
+
end
|
189
|
+
|
190
|
+
def configure_i18n_tasks
|
191
|
+
run "cp $(i18n-tasks gem-path)/templates/rspec/i18n_spec.rb spec/"
|
192
|
+
copy_file "config_i18n_tasks.yml", "config/i18n-tasks.yml"
|
188
193
|
end
|
189
194
|
|
190
195
|
def configure_background_jobs_for_rspec
|
@@ -214,7 +219,7 @@ end
|
|
214
219
|
end
|
215
220
|
|
216
221
|
def configure_action_mailer
|
217
|
-
action_mailer_host 'development', "
|
222
|
+
action_mailer_host 'development', "localhost:#{port_number}"
|
218
223
|
action_mailer_host 'test', 'www.example.com'
|
219
224
|
action_mailer_host 'staging', "staging.#{app_name}.com"
|
220
225
|
action_mailer_host 'production', "#{app_name}.com"
|
@@ -356,6 +361,12 @@ fi
|
|
356
361
|
|
357
362
|
private
|
358
363
|
|
364
|
+
def raise_on_missing_translations_in(environment)
|
365
|
+
config = 'config.action_view.raise_on_missing_translations = true'
|
366
|
+
|
367
|
+
uncomment_in_file("config/environments/#{environment}.rb", config)
|
368
|
+
end
|
369
|
+
|
359
370
|
def override_path_for_tests
|
360
371
|
if ENV['TESTING']
|
361
372
|
support_bin = File.expand_path(File.join('..', '..', 'spec', 'fakes', 'bin'))
|
@@ -370,5 +381,9 @@ fi
|
|
370
381
|
def generate_secret
|
371
382
|
SecureRandom.hex(64)
|
372
383
|
end
|
384
|
+
|
385
|
+
def port_number
|
386
|
+
@port_number ||= [3000, 4000, 5000, 6000, 7000, 8000, 9000].sample
|
387
|
+
end
|
373
388
|
end
|
374
389
|
end
|
@@ -71,6 +71,7 @@ module Suspenders
|
|
71
71
|
build :provide_setup_script
|
72
72
|
build :provide_dev_prime_task
|
73
73
|
build :configure_generators
|
74
|
+
build :configure_i18n_for_development_environment
|
74
75
|
end
|
75
76
|
|
76
77
|
def setup_test_environment
|
@@ -82,7 +83,7 @@ module Suspenders
|
|
82
83
|
build :enable_database_cleaner
|
83
84
|
build :configure_spec_support_features
|
84
85
|
build :configure_travis
|
85
|
-
build :
|
86
|
+
build :configure_i18n_tasks
|
86
87
|
build :configure_action_mailer_in_specs
|
87
88
|
end
|
88
89
|
|
data/lib/suspenders/version.rb
CHANGED
@@ -62,6 +62,28 @@ feature 'Suspend a new project with default configuration' do
|
|
62
62
|
to include(%{window.analytics.load("<%= ENV["SEGMENT_IO_KEY"] %>");})
|
63
63
|
end
|
64
64
|
|
65
|
+
scenario "raises on missing translations in development" do
|
66
|
+
run_suspenders
|
67
|
+
|
68
|
+
environment_file =
|
69
|
+
IO.read("#{project_path}/config/environments/development.rb")
|
70
|
+
expect(environment_file).to match(
|
71
|
+
/^ +config.action_view.raise_on_missing_translations = true$/
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
scenario "specs for missing or unused translations" do
|
76
|
+
run_suspenders
|
77
|
+
|
78
|
+
expect(File).to exist("#{project_path}/spec/i18n_spec.rb")
|
79
|
+
end
|
80
|
+
|
81
|
+
scenario "config file for i18n tasks" do
|
82
|
+
run_suspenders
|
83
|
+
|
84
|
+
expect(File).to exist("#{project_path}/config/i18n-tasks.yml")
|
85
|
+
end
|
86
|
+
|
65
87
|
def analytics_partial
|
66
88
|
IO.read("#{project_path}/app/views/application/_analytics.html.erb")
|
67
89
|
end
|
data/suspenders.gemspec
CHANGED
@@ -27,7 +27,7 @@ rush to build something amazing; don't use it if you like missing deadlines.
|
|
27
27
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
28
28
|
s.version = Suspenders::VERSION
|
29
29
|
|
30
|
-
s.add_dependency 'bitters'
|
30
|
+
s.add_dependency 'bitters', '~> 0.10.0'
|
31
31
|
s.add_dependency 'bundler', '~> 1.3'
|
32
32
|
s.add_dependency 'rails', Suspenders::RAILS_VERSION
|
33
33
|
|
data/templates/Gemfile.erb
CHANGED
@@ -9,8 +9,10 @@ gem "delayed_job_active_record"
|
|
9
9
|
gem "email_validator"
|
10
10
|
gem "flutie"
|
11
11
|
gem "high_voltage"
|
12
|
+
gem "i18n-tasks"
|
12
13
|
gem "jquery-rails"
|
13
14
|
gem "neat", "~> 1.5.1"
|
15
|
+
gem "normalize-rails", "~> 3.0.0"
|
14
16
|
gem "pg"
|
15
17
|
gem "rack-timeout"
|
16
18
|
gem "rails", "<%= Suspenders::RAILS_VERSION %>"
|
@@ -22,7 +24,6 @@ gem "uglifier"
|
|
22
24
|
gem "unicorn"
|
23
25
|
|
24
26
|
group :development do
|
25
|
-
gem "foreman"
|
26
27
|
gem "spring"
|
27
28
|
gem "spring-commands-rspec"
|
28
29
|
end
|
@@ -33,7 +34,7 @@ group :development, :test do
|
|
33
34
|
gem "dotenv-rails"
|
34
35
|
gem "factory_girl_rails"
|
35
36
|
gem "pry-rails"
|
36
|
-
gem "rspec-rails", "~>
|
37
|
+
gem "rspec-rails", "~> 3.0.0"
|
37
38
|
end
|
38
39
|
|
39
40
|
group :test do
|
data/templates/README.md.erb
CHANGED
@@ -4,15 +4,25 @@
|
|
4
4
|
Getting Started
|
5
5
|
---------------
|
6
6
|
|
7
|
-
|
7
|
+
After you have cloned this repo, run this setup script to set up your machine
|
8
|
+
with the necessary dependencies to run and test this app:
|
8
9
|
|
9
10
|
% ./bin/setup
|
10
11
|
|
12
|
+
It assumes you have a machine equipped with Ruby, Postgres, etc. If not, set up
|
13
|
+
your machine with [this script].
|
14
|
+
|
15
|
+
[this script]: https://github.com/thoughtbot/laptop
|
16
|
+
|
11
17
|
After setting up, you can run the application using [foreman]:
|
12
18
|
|
13
19
|
% foreman start
|
14
20
|
|
15
|
-
[foreman]
|
21
|
+
If you don't have `foreman`, see [Foreman's install instructions][foreman]. It
|
22
|
+
is [purposefully excluded from the project's `Gemfile`][exclude].
|
23
|
+
|
24
|
+
[foreman]: https://github.com/ddollar/foreman
|
25
|
+
[exclude]: https://github.com/ddollar/foreman/pull/437#issuecomment-41110407
|
16
26
|
|
17
27
|
Guidelines
|
18
28
|
----------
|
data/templates/_flashes.html.erb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<% if flash.any? %>
|
2
|
+
<div id="flash">
|
3
|
+
<% flash.each do |key, value| -%>
|
4
|
+
<div id="flash_<%= key %>"><%= value %></div>
|
5
|
+
<% end -%>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
@@ -21,4 +21,10 @@ bundle exec rake dev:prime
|
|
21
21
|
mkdir -p .git/safe
|
22
22
|
|
23
23
|
# Pick a port for Foreman
|
24
|
-
echo "port:
|
24
|
+
echo "port: <%= config[:port_number] %>" > .foreman
|
25
|
+
|
26
|
+
# Print warning if Foreman is not installed
|
27
|
+
if ! command -v foreman &>/dev/null; then
|
28
|
+
echo "foreman is not installed."
|
29
|
+
echo "See https://github.com/ddollar/foreman for install instructions."
|
30
|
+
fi
|
data/templates/spec_helper.rb
CHANGED
@@ -10,6 +10,7 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |file| require file }
|
|
10
10
|
|
11
11
|
module Features
|
12
12
|
# Extend this module in spec/support/features/*.rb
|
13
|
+
include Formulaic::Dsl
|
13
14
|
end
|
14
15
|
|
15
16
|
RSpec.configure do |config|
|
@@ -18,10 +19,9 @@ RSpec.configure do |config|
|
|
18
19
|
end
|
19
20
|
|
20
21
|
config.include Features, type: :feature
|
21
|
-
config.include Formulaic::Dsl, type: :feature
|
22
22
|
config.infer_base_class_for_anonymous_controllers = false
|
23
|
+
config.infer_spec_type_from_file_location!
|
23
24
|
config.order = "random"
|
24
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
25
25
|
config.use_transactional_fixtures = false
|
26
26
|
end
|
27
27
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suspenders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitters
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.10.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.10.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,7 +155,6 @@ files:
|
|
155
155
|
- spec/support/fake_heroku.rb
|
156
156
|
- spec/support/suspenders.rb
|
157
157
|
- suspenders.gemspec
|
158
|
-
- templates/Brewfile
|
159
158
|
- templates/Gemfile.erb
|
160
159
|
- templates/Procfile
|
161
160
|
- templates/README.md.erb
|
@@ -165,7 +164,8 @@ files:
|
|
165
164
|
- templates/action_mailer.rb
|
166
165
|
- templates/application.css.scss
|
167
166
|
- templates/background_jobs_rspec.rb
|
168
|
-
- templates/bin_setup
|
167
|
+
- templates/bin_setup.erb
|
168
|
+
- templates/config_i18n_tasks.yml
|
169
169
|
- templates/config_locales_en.yml
|
170
170
|
- templates/database_cleaner_rspec.rb
|
171
171
|
- templates/development_seeds.rb
|
data/templates/Brewfile
DELETED