suspenders 1.54.1 → 1.56.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CONTRIBUTING.md +1 -1
- data/NEWS.md +38 -1
- data/README.md +5 -12
- data/bin/suspenders +29 -2
- data/lib/suspenders/actions/strip_comments_action.rb +254 -0
- data/lib/suspenders/actions.rb +1 -1
- data/lib/suspenders/adapters/heroku.rb +16 -16
- data/lib/suspenders/app_builder.rb +49 -47
- data/lib/suspenders/exit_on_failure.rb +19 -0
- data/lib/suspenders/generators/advisories_generator.rb +1 -1
- data/lib/suspenders/generators/analytics_generator.rb +1 -1
- data/lib/suspenders/generators/app_generator.rb +30 -23
- data/lib/suspenders/generators/base.rb +3 -2
- data/lib/suspenders/generators/db_optimizations_generator.rb +2 -2
- data/lib/suspenders/generators/factories_generator.rb +1 -1
- data/lib/suspenders/generators/jobs_generator.rb +3 -3
- data/lib/suspenders/generators/js_driver_generator.rb +1 -1
- data/lib/suspenders/generators/json_generator.rb +4 -0
- data/lib/suspenders/generators/lint_generator.rb +5 -0
- data/lib/suspenders/generators/production/compression_generator.rb +1 -1
- data/lib/suspenders/generators/production/email_generator.rb +7 -7
- data/lib/suspenders/generators/production/manifest_generator.rb +8 -8
- data/lib/suspenders/generators/production/single_redirect.rb +1 -1
- data/lib/suspenders/generators/production/timeout_generator.rb +2 -2
- data/lib/suspenders/generators/profiler_generator.rb +4 -4
- data/lib/suspenders/generators/runner_generator.rb +4 -4
- data/lib/suspenders/generators/staging/pull_requests_generator.rb +2 -2
- data/lib/suspenders/generators/stylelint_generator.rb +2 -1
- data/lib/suspenders/generators/stylesheet_base_generator.rb +1 -1
- data/lib/suspenders/generators/testing_generator.rb +2 -3
- data/lib/suspenders/version.rb +5 -5
- data/lib/suspenders.rb +2 -1
- data/templates/capybara_silence_puma.rb +1 -1
- data/templates/descriptions/testing.md +1 -1
- data/templates/errors.rb +4 -3
- data/templates/hound.yml +1 -2
- data/templates/oj.rb +3 -0
- data/templates/partials/ci_simplecov.rb +0 -2
- data/templates/partials/email_smtp.rb +0 -1
- data/templates/partials/pull_requests_config.rb +4 -4
- data/templates/partials/runner_setup.rb +1 -2
- data/templates/postgresql_database.yml.erb +1 -0
- data/templates/spec_helper.rb +1 -1
- metadata +64 -89
- data/.gitignore +0 -5
- data/.travis.yml +0 -15
- data/Gemfile +0 -3
- data/Rakefile +0 -8
- data/USAGE +0 -13
- data/bin/rake +0 -16
- data/bin/rspec +0 -16
- data/bin/setup +0 -13
- data/lib/suspenders/generators/preloader_generator.rb +0 -122
- data/spec/adapters/heroku_spec.rb +0 -98
- data/spec/expand_json_spec.rb +0 -89
- data/spec/fakes/bin/heroku +0 -5
- data/spec/fakes/bin/hub +0 -5
- data/spec/features/advisories_spec.rb +0 -24
- data/spec/features/api_spec.rb +0 -18
- data/spec/features/ci_spec.rb +0 -31
- data/spec/features/cli_help_spec.rb +0 -36
- data/spec/features/db_optimizations_spec.rb +0 -19
- data/spec/features/github_spec.rb +0 -16
- data/spec/features/heroku_spec.rb +0 -64
- data/spec/features/inline_svg_spec.rb +0 -10
- data/spec/features/json_spec.rb +0 -15
- data/spec/features/new_project_spec.rb +0 -319
- data/spec/features/preloader_spec.rb +0 -25
- data/spec/features/production/compression_spec.rb +0 -23
- data/spec/features/production/deployment_spec.rb +0 -22
- data/spec/features/production/email_spec.rb +0 -47
- data/spec/features/production/manifest_spec.rb +0 -37
- data/spec/features/production/single_redirect_spec.rb +0 -25
- data/spec/features/profiler_spec.rb +0 -20
- data/spec/features/runner_spec.rb +0 -30
- data/spec/features/staging/pull_requests_spec.rb +0 -22
- data/spec/features/static_spec.rb +0 -17
- data/spec/features/stylelint_spec.rb +0 -60
- data/spec/spec_helper.rb +0 -21
- data/spec/support/be_executable_matcher.rb +0 -7
- data/spec/support/contain_json_matcher.rb +0 -30
- data/spec/support/exist_as_a_file_matcher.rb +0 -7
- data/spec/support/fake_github.rb +0 -21
- data/spec/support/fake_heroku.rb +0 -53
- data/spec/support/generators.rb +0 -5
- data/spec/support/match_contents_matcher.rb +0 -6
- data/spec/support/project_files.rb +0 -25
- data/spec/support/rails_template.rb +0 -1
- data/spec/support/suspenders.rb +0 -185
- data/suspenders.gemspec +0 -35
- data/templates/descriptions/preloader.md +0 -3
- data/templates/spring.rb +0 -6
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "json"
|
4
|
-
|
5
|
-
RSpec::Matchers.define :contain_json do
|
6
|
-
match do
|
7
|
-
@sub_json = expected
|
8
|
-
@filename = actual
|
9
|
-
|
10
|
-
@filepath = File.join(project_path, @filename)
|
11
|
-
@json = JSON.parse(IO.read(@filepath), symbolize_names: true)
|
12
|
-
|
13
|
-
subhash?(@sub_json, @json)
|
14
|
-
end
|
15
|
-
|
16
|
-
failure_message do
|
17
|
-
"in #{@filename}, expected to find\n#{@sub_json.inspect}\n" \
|
18
|
-
"in\n#{@json.inspect}"
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def subhash?(inner, outer)
|
24
|
-
if inner.is_a?(Hash) && outer.is_a?(Hash)
|
25
|
-
inner.all? { |key, value| subhash?(value, outer[key]) }
|
26
|
-
else
|
27
|
-
inner == outer
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/spec/support/fake_github.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
class FakeGithub
|
2
|
-
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'hub_commands'), File.dirname(__FILE__))
|
3
|
-
|
4
|
-
def initialize(args)
|
5
|
-
@args = args
|
6
|
-
end
|
7
|
-
|
8
|
-
def run!
|
9
|
-
File.open(RECORDER, 'a') do |file|
|
10
|
-
file.write @args.join(' ')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.clear!
|
15
|
-
FileUtils.rm_rf RECORDER
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.has_created_repo?(repo_name)
|
19
|
-
File.read(RECORDER) == "create #{repo_name}"
|
20
|
-
end
|
21
|
-
end
|
data/spec/support/fake_heroku.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
class FakeHeroku
|
2
|
-
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__))
|
3
|
-
|
4
|
-
def initialize(args)
|
5
|
-
@args = args
|
6
|
-
end
|
7
|
-
|
8
|
-
def run!
|
9
|
-
if @args.first == "help"
|
10
|
-
puts "pipelines # manage collections of apps in pipelines"
|
11
|
-
end
|
12
|
-
File.open(RECORDER, 'a') do |file|
|
13
|
-
file.puts @args.join(' ')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.clear!
|
18
|
-
FileUtils.rm_rf RECORDER
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.has_gem_included?(project_path, gem_name)
|
22
|
-
gemfile = File.open(File.join(project_path, 'Gemfile'), 'a')
|
23
|
-
|
24
|
-
File.foreach(gemfile).any? do |line|
|
25
|
-
line.match(/#{Regexp.quote(gem_name)}/)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.has_created_app_for?(environment, flags = nil)
|
30
|
-
app_name = "#{SuspendersTestHelpers::APP_NAME.dasherize}-#{environment}"
|
31
|
-
|
32
|
-
command = if flags
|
33
|
-
"create #{app_name} #{flags} --remote #{environment}\n"
|
34
|
-
else
|
35
|
-
"create #{app_name} --remote #{environment}\n"
|
36
|
-
end
|
37
|
-
|
38
|
-
File.foreach(RECORDER).any? { |line| line == command }
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.has_configured_vars?(remote_name, var)
|
42
|
-
commands_ran =~ /^config:add #{var}=.+ --remote #{remote_name}\n/
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.has_setup_pipeline_for?(app_name)
|
46
|
-
commands_ran =~ /^pipelines:create #{app_name} -a #{app_name}-staging --stage staging/ &&
|
47
|
-
commands_ran =~ /^pipelines:add #{app_name} -a #{app_name}-production --stage production/
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.commands_ran
|
51
|
-
@commands_ran ||= File.read(RECORDER)
|
52
|
-
end
|
53
|
-
end
|
data/spec/support/generators.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module ProjectFiles
|
2
|
-
def touch(filename)
|
3
|
-
path = File.join(project_path, filename)
|
4
|
-
dirname = File.dirname(path)
|
5
|
-
FileUtils.mkdir_p(dirname)
|
6
|
-
FileUtils.touch(path)
|
7
|
-
end
|
8
|
-
|
9
|
-
def rm(filename)
|
10
|
-
path = File.join(project_path, filename)
|
11
|
-
FileUtils.rm_rf(path)
|
12
|
-
end
|
13
|
-
|
14
|
-
def copy_file(from_in_templates, to_in_project)
|
15
|
-
destination = File.join(project_path, to_in_project)
|
16
|
-
destination_dirname = File.dirname(destination)
|
17
|
-
|
18
|
-
FileUtils.mkdir_p(destination_dirname)
|
19
|
-
|
20
|
-
FileUtils.cp(
|
21
|
-
File.join(root_path, "templates", from_in_templates),
|
22
|
-
destination,
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
gem "suspenders", path: File.expand_path("../..", __dir__)
|
data/spec/support/suspenders.rb
DELETED
@@ -1,185 +0,0 @@
|
|
1
|
-
module SuspendersTestHelpers
|
2
|
-
APP_NAME = "dummy_app"
|
3
|
-
|
4
|
-
def remove_project_directory
|
5
|
-
FileUtils.rm_rf(project_path)
|
6
|
-
end
|
7
|
-
|
8
|
-
def create_tmp_directory
|
9
|
-
FileUtils.mkdir_p(tmp_path)
|
10
|
-
end
|
11
|
-
|
12
|
-
def run_suspenders(arguments = nil)
|
13
|
-
arguments = "--path=#{root_path} #{arguments}"
|
14
|
-
run_in_tmp do
|
15
|
-
add_fakes_to_path
|
16
|
-
|
17
|
-
with_revision_for_honeybadger do
|
18
|
-
debug `#{suspenders_bin} #{APP_NAME} #{arguments}`
|
19
|
-
end
|
20
|
-
|
21
|
-
Dir.chdir(APP_NAME) do
|
22
|
-
commit_all
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def with_app
|
28
|
-
drop_dummy_database
|
29
|
-
remove_project_directory
|
30
|
-
rails_new
|
31
|
-
setup_app_dependencies
|
32
|
-
|
33
|
-
yield
|
34
|
-
end
|
35
|
-
|
36
|
-
def rails_new
|
37
|
-
run_in_tmp do
|
38
|
-
add_fakes_to_path
|
39
|
-
|
40
|
-
with_revision_for_honeybadger do
|
41
|
-
debug `#{system_rails_bin} new #{APP_NAME} -m #{rails_template_path}`
|
42
|
-
end
|
43
|
-
|
44
|
-
Dir.chdir(APP_NAME) do
|
45
|
-
commit_all
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def generate(generator)
|
51
|
-
run_in_project do
|
52
|
-
with_revision_for_honeybadger do
|
53
|
-
debug `bin/spring stop`
|
54
|
-
debug `#{project_rails_bin} generate #{generator}`
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def destroy(generator)
|
60
|
-
run_in_project do
|
61
|
-
with_revision_for_honeybadger do
|
62
|
-
`bin/spring stop`
|
63
|
-
`#{project_rails_bin} destroy #{generator}`
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def suspenders_help_command
|
69
|
-
run_in_tmp do
|
70
|
-
debug `#{suspenders_bin} -h`
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def setup_app_dependencies
|
75
|
-
run_in_project do
|
76
|
-
debug `bundle check || bundle install`
|
77
|
-
end
|
78
|
-
rescue Errno::ENOENT
|
79
|
-
# The project_path might not exist, in which case we can skip this.
|
80
|
-
end
|
81
|
-
|
82
|
-
def drop_dummy_database
|
83
|
-
run_in_project do
|
84
|
-
debug `#{project_rails_bin} db:drop 2>&1`
|
85
|
-
end
|
86
|
-
rescue Errno::ENOENT
|
87
|
-
# The project_path might not exist, in which case we can skip this.
|
88
|
-
end
|
89
|
-
|
90
|
-
def add_fakes_to_path
|
91
|
-
ENV["PATH"] = "#{support_bin}:#{ENV['PATH']}"
|
92
|
-
end
|
93
|
-
|
94
|
-
def project_path
|
95
|
-
@project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
|
96
|
-
end
|
97
|
-
|
98
|
-
def usage_file
|
99
|
-
@usage_path ||= File.join(root_path, "USAGE")
|
100
|
-
end
|
101
|
-
|
102
|
-
private
|
103
|
-
|
104
|
-
def tmp_path
|
105
|
-
@tmp_path ||= Pathname.new("#{root_path}/tmp")
|
106
|
-
end
|
107
|
-
|
108
|
-
def suspenders_bin
|
109
|
-
File.join(root_path, 'bin', 'suspenders')
|
110
|
-
end
|
111
|
-
|
112
|
-
def system_rails_bin
|
113
|
-
"rails"
|
114
|
-
end
|
115
|
-
|
116
|
-
def project_rails_bin
|
117
|
-
"bin/rails"
|
118
|
-
end
|
119
|
-
|
120
|
-
def support_bin
|
121
|
-
File.join(root_path, "spec", "fakes", "bin")
|
122
|
-
end
|
123
|
-
|
124
|
-
def root_path
|
125
|
-
File.expand_path('../../../', __FILE__)
|
126
|
-
end
|
127
|
-
|
128
|
-
def rails_template_path
|
129
|
-
File.join(root_path, "spec", "support", "rails_template.rb")
|
130
|
-
end
|
131
|
-
|
132
|
-
def commit_all
|
133
|
-
with_env("HOME", tmp_path) do
|
134
|
-
debug `git config user.email suspenders@example.com`
|
135
|
-
debug `git config user.name "Suspenders Boy"`
|
136
|
-
debug `git add .`
|
137
|
-
debug `git commit -m 'Initial commit'`
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def with_env(name, new_value)
|
142
|
-
had_key = ENV.has_key?(name)
|
143
|
-
prior = ENV[name]
|
144
|
-
ENV[name] = new_value.to_s
|
145
|
-
|
146
|
-
yield
|
147
|
-
|
148
|
-
ensure
|
149
|
-
ENV.delete(name)
|
150
|
-
|
151
|
-
if had_key
|
152
|
-
ENV[name] = prior
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def with_revision_for_honeybadger
|
157
|
-
with_env("HEROKU_SLUG_COMMIT", 1) do
|
158
|
-
yield
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
def run_in_tmp
|
163
|
-
Dir.chdir(tmp_path) do
|
164
|
-
Bundler.with_unbundled_env do
|
165
|
-
yield
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def run_in_project
|
171
|
-
Dir.chdir(project_path) do
|
172
|
-
Bundler.with_unbundled_env do
|
173
|
-
yield
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
def debug(output)
|
179
|
-
if ENV["DEBUG"]
|
180
|
-
warn output
|
181
|
-
end
|
182
|
-
|
183
|
-
output
|
184
|
-
end
|
185
|
-
end
|
data/suspenders.gemspec
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path('../lib', __FILE__)
|
3
|
-
require 'suspenders/version'
|
4
|
-
require 'date'
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.required_ruby_version = ">= #{Suspenders::RUBY_VERSION}"
|
8
|
-
s.required_rubygems_version = ">= 2.7.4"
|
9
|
-
s.authors = ['thoughtbot']
|
10
|
-
s.date = Date.today.strftime('%Y-%m-%d')
|
11
|
-
|
12
|
-
s.description = <<-HERE
|
13
|
-
Suspenders is a base Rails project that you can upgrade. It is used by
|
14
|
-
thoughtbot to get a jump start on a working app. Use Suspenders if you're in a
|
15
|
-
rush to build something amazing; don't use it if you like missing deadlines.
|
16
|
-
HERE
|
17
|
-
|
18
|
-
s.email = 'support@thoughtbot.com'
|
19
|
-
s.executables = ['suspenders']
|
20
|
-
s.extra_rdoc_files = %w[README.md LICENSE]
|
21
|
-
s.files = `git ls-files`.split("\n")
|
22
|
-
s.homepage = 'http://github.com/thoughtbot/suspenders'
|
23
|
-
s.license = 'MIT'
|
24
|
-
s.name = 'suspenders'
|
25
|
-
s.rdoc_options = ['--charset=UTF-8']
|
26
|
-
s.require_paths = ['lib']
|
27
|
-
s.summary = "Generate a Rails app using thoughtbot's best practices."
|
28
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
29
|
-
s.version = Suspenders::VERSION
|
30
|
-
|
31
|
-
s.add_dependency 'bitters', '>= 2.0.4'
|
32
|
-
s.add_dependency 'rails', Suspenders::RAILS_VERSION
|
33
|
-
|
34
|
-
s.add_development_dependency 'rspec', '~> 3.2'
|
35
|
-
end
|