gb-firestarter 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.metrics +13 -0
- data/.metrics.reek +3 -0
- data/.rspec +1 -0
- data/.rubocop.yml +64 -0
- data/.ruby-version +1 -1
- data/.travis.yml +5 -6
- data/Gemfile.lock +30 -11
- data/README.md +3 -1
- data/Rakefile +5 -5
- data/firestarter.gemspec +23 -20
- data/lib/firestarter.rb +4 -4
- data/lib/firestarter/actions.rb +1 -1
- data/lib/firestarter/app_builder.rb +108 -89
- data/lib/firestarter/generators/app_generator.rb +41 -41
- data/lib/firestarter/version.rb +2 -2
- data/spec/features/new_project_spec.rb +18 -20
- data/spec/spec_helper.rb +4 -9
- data/spec/support/firestarter.rb +16 -6
- data/templates/Gemfile.erb +35 -42
- data/templates/database_cleaner_rspec.rb +1 -1
- data/templates/development_seeds.rb +3 -3
- data/templates/factories_spec.rb +3 -3
- data/templates/factories_spec_rake_task.rb +4 -4
- data/templates/lint_rake_task.rb +5 -5
- data/templates/metrics +13 -0
- data/templates/metrics.reek +3 -0
- data/templates/puma.rb +5 -5
- data/templates/rack_timeout.rb +3 -1
- data/templates/{secret_token.rb → secret_token.rb.erb} +1 -1
- data/templates/smtp.rb +5 -5
- data/templates/spec_helper.rb +11 -12
- data/templates/staging.rb +1 -3
- data/templates/unobtrusive_pry.rb +2 -2
- metadata +27 -8
- data/templates/errors.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03053b2acd6e4cbecc4aa068c6ef8dc386be6f13
|
4
|
+
data.tar.gz: 62d088f98dbfba8005228f061bb3b81e4111f04f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa3b5dd3772961295cd82752ff691edb19da7758da002dbd91b10fa25d1ed6e21d2350b17b232b0f3967e6f690457ac8158037cfd4cb87cdb05eef189b023e41
|
7
|
+
data.tar.gz: f42f30c606678c3382b3a4cb565371b6bd860709f4c2d7d6e3d21a1dd251343e99ee6292cd68cf4ff58e4ed75b411f483e3f1762da9eb9e5b96d95781e173ebb
|
data/.gitignore
CHANGED
data/.metrics
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
MetricFu::Configuration.run do |config|
|
2
|
+
config.configure_metric(:cane) do |cane|
|
3
|
+
cane.no_doc = 'y'
|
4
|
+
end
|
5
|
+
|
6
|
+
config.configure_metric(:churn) do |churn|
|
7
|
+
churn.ignore_files = %w(Gemfile Gemfile.lock)
|
8
|
+
end
|
9
|
+
|
10
|
+
config.configure_metric(:reek) do |reek|
|
11
|
+
reek.config_file_pattern = '.metrics.reek'
|
12
|
+
end
|
13
|
+
end
|
data/.metrics.reek
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- "**/Rakefile"
|
4
|
+
- "**/config.ru"
|
5
|
+
Exclude:
|
6
|
+
- "db/**/*"
|
7
|
+
- "config/**/*"
|
8
|
+
- "script/**/*"
|
9
|
+
- "bin/**/*"
|
10
|
+
- "vendor/**/*"
|
11
|
+
- "node_modules/**/*"
|
12
|
+
- "spec/factories.rb"
|
13
|
+
- "slack_bot/**/*"
|
14
|
+
TargetRubyVersion: 2.3
|
15
|
+
|
16
|
+
Metrics/LineLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/AlignParameters:
|
20
|
+
EnforcedStyle: with_fixed_indentation
|
21
|
+
|
22
|
+
Style/ClassAndModuleChildren:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/Documentation:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/DotPosition:
|
29
|
+
EnforcedStyle: trailing
|
30
|
+
|
31
|
+
Style/IfUnlessModifier:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/PredicateName:
|
35
|
+
NamePrefixBlacklist:
|
36
|
+
- is_
|
37
|
+
- have_
|
38
|
+
|
39
|
+
Style/StringLiterals:
|
40
|
+
EnforcedStyle: double_quotes
|
41
|
+
|
42
|
+
Style/NumericLiterals:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/SingleLineBlockParams:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/MultilineOperationIndentation:
|
49
|
+
EnforcedStyle: indented
|
50
|
+
|
51
|
+
Style/MultilineMethodCallIndentation:
|
52
|
+
EnforcedStyle: indented
|
53
|
+
|
54
|
+
Style/TrailingCommaInArguments:
|
55
|
+
EnforcedStyleForMultiline: comma
|
56
|
+
|
57
|
+
Style/TrailingCommaInLiteral:
|
58
|
+
EnforcedStyleForMultiline: comma
|
59
|
+
|
60
|
+
Style/FrozenStringLiteralComment:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/MutableConstant:
|
64
|
+
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/.travis.yml
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- 2.3.0
|
3
4
|
- 2.2.0
|
4
5
|
- ruby-head
|
5
6
|
env:
|
6
|
-
- "RAILS_VERSION=4.2.
|
7
|
-
- "RAILS_VERSION=master"
|
7
|
+
- "RAILS_VERSION=4.2.6"
|
8
8
|
matrix:
|
9
9
|
allow_failures:
|
10
10
|
- rvm: ruby-head
|
11
|
-
- env: "RAILS_VERSION=master"
|
12
11
|
before_install:
|
13
|
-
-
|
14
|
-
- git config --global user.name
|
15
|
-
- git config --global user.email
|
12
|
+
- gem install bundler -v 1.11.2
|
13
|
+
- git config --global user.name "Travis CI"
|
14
|
+
- git config --global user.email "travis-ci@example.com"
|
16
15
|
install:
|
17
16
|
- bundle install
|
18
17
|
notifications:
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gb-firestarter (0.
|
4
|
+
gb-firestarter (0.4.0)
|
5
5
|
bundler (~> 1.3)
|
6
6
|
rails (= 4.2.0)
|
7
7
|
|
@@ -48,6 +48,7 @@ GEM
|
|
48
48
|
childprocess (>= 0.3.6)
|
49
49
|
cucumber (>= 1.1.1)
|
50
50
|
rspec-expectations (>= 2.7.0)
|
51
|
+
ast (2.3.0)
|
51
52
|
builder (3.2.2)
|
52
53
|
capybara (2.4.4)
|
53
54
|
mime-types (>= 1.16)
|
@@ -58,6 +59,7 @@ GEM
|
|
58
59
|
childprocess (0.5.6)
|
59
60
|
ffi (~> 1.0, >= 1.0.11)
|
60
61
|
coderay (1.1.0)
|
62
|
+
concurrent-ruby (1.0.2)
|
61
63
|
cucumber (2.0.0)
|
62
64
|
builder (>= 2.1.2)
|
63
65
|
cucumber-core (~> 1.1.3)
|
@@ -78,16 +80,19 @@ GEM
|
|
78
80
|
json (1.8.3)
|
79
81
|
loofah (2.0.3)
|
80
82
|
nokogiri (>= 1.5.9)
|
81
|
-
mail (2.6.
|
82
|
-
mime-types (>= 1.16, <
|
83
|
+
mail (2.6.4)
|
84
|
+
mime-types (>= 1.16, < 4)
|
83
85
|
method_source (0.8.2)
|
84
86
|
mime-types (2.4.3)
|
85
87
|
mini_portile (0.6.2)
|
86
|
-
minitest (5.
|
88
|
+
minitest (5.9.0)
|
87
89
|
multi_json (1.11.0)
|
88
90
|
multi_test (0.1.2)
|
89
91
|
nokogiri (1.6.6.2)
|
90
92
|
mini_portile (~> 0.6.0)
|
93
|
+
parser (2.3.1.2)
|
94
|
+
ast (~> 2.2)
|
95
|
+
powerpack (0.1.1)
|
91
96
|
pry (0.10.1)
|
92
97
|
coderay (~> 1.1.0)
|
93
98
|
method_source (~> 0.8.1)
|
@@ -112,14 +117,15 @@ GEM
|
|
112
117
|
activesupport (>= 4.2.0.beta, < 5.0)
|
113
118
|
nokogiri (~> 1.6.0)
|
114
119
|
rails-deprecated_sanitizer (>= 1.0.1)
|
115
|
-
rails-html-sanitizer (1.0.
|
120
|
+
rails-html-sanitizer (1.0.3)
|
116
121
|
loofah (~> 2.0)
|
117
122
|
railties (4.2.0)
|
118
123
|
actionpack (= 4.2.0)
|
119
124
|
activesupport (= 4.2.0)
|
120
125
|
rake (>= 0.8.7)
|
121
126
|
thor (>= 0.18.1, < 2.0)
|
122
|
-
|
127
|
+
rainbow (2.1.0)
|
128
|
+
rake (11.2.2)
|
123
129
|
rspec (2.99.0)
|
124
130
|
rspec-core (~> 2.99.0)
|
125
131
|
rspec-expectations (~> 2.99.0)
|
@@ -128,17 +134,26 @@ GEM
|
|
128
134
|
rspec-expectations (2.99.2)
|
129
135
|
diff-lcs (>= 1.1.3, < 2.0)
|
130
136
|
rspec-mocks (2.99.3)
|
137
|
+
rubocop (0.40.0)
|
138
|
+
parser (>= 2.3.1.0, < 3.0)
|
139
|
+
powerpack (~> 0.1)
|
140
|
+
rainbow (>= 1.99.1, < 3.0)
|
141
|
+
ruby-progressbar (~> 1.7)
|
142
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
143
|
+
ruby-progressbar (1.8.1)
|
131
144
|
slop (3.6.0)
|
132
|
-
sprockets (3.
|
145
|
+
sprockets (3.6.1)
|
146
|
+
concurrent-ruby (~> 1.0)
|
133
147
|
rack (> 1, < 3)
|
134
|
-
sprockets-rails (
|
135
|
-
actionpack (>=
|
136
|
-
activesupport (>=
|
137
|
-
sprockets (>=
|
148
|
+
sprockets-rails (3.0.4)
|
149
|
+
actionpack (>= 4.0)
|
150
|
+
activesupport (>= 4.0)
|
151
|
+
sprockets (>= 3.0.0)
|
138
152
|
thor (0.19.1)
|
139
153
|
thread_safe (0.3.5)
|
140
154
|
tzinfo (1.2.2)
|
141
155
|
thread_safe (~> 0.1)
|
156
|
+
unicode-display_width (1.0.5)
|
142
157
|
xpath (2.0.0)
|
143
158
|
nokogiri (~> 1.3)
|
144
159
|
|
@@ -151,3 +166,7 @@ DEPENDENCIES
|
|
151
166
|
gb-firestarter!
|
152
167
|
pry
|
153
168
|
rspec (~> 2.0)
|
169
|
+
rubocop (~> 0.40.0)
|
170
|
+
|
171
|
+
BUNDLED WITH
|
172
|
+
1.11.2
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
# Firestarter
|
1
|
+
# Firestarter
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/subvisual/firestarter.svg?branch=master)](https://travis-ci.org/subvisual/firestarter) [![Code Climate](https://codeclimate.com/github/subvisual/firestarter/badges/gpa.svg)](https://codeclimate.com/github/subvisual/firestarter)
|
2
4
|
|
3
5
|
Firestarter is the base Rails application used at [Group Buddies](http://groupbuddies.com).
|
4
6
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "bundler/setup"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "rspec/core/rake_task"
|
4
4
|
|
5
5
|
RSpec::Core::RakeTask.new(:rspec)
|
6
6
|
|
7
|
-
desc
|
8
|
-
task :
|
7
|
+
desc "Run the test suite"
|
8
|
+
task default: :rspec
|
data/firestarter.gemspec
CHANGED
@@ -1,34 +1,37 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
2
|
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "firestarter/version"
|
4
|
+
require "date"
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
7
|
+
s.name = "gb-firestarter"
|
8
8
|
s.version = Firestarter::VERSION
|
9
9
|
s.summary = "Generate a Rails app using groupbuddies's best practices and opinions."
|
10
10
|
s.description = <<-HERE
|
11
11
|
Firestarter is the way to get great apps up and running in a heartbeat. It's
|
12
|
-
what we use at
|
12
|
+
what we use at Subvisual.
|
13
13
|
HERE
|
14
|
-
s.authors = [
|
15
|
-
s.email =
|
14
|
+
s.authors = ["Subvisual"]
|
15
|
+
s.email = "contact@subvisual.co"
|
16
|
+
|
16
17
|
s.files = `git ls-files`.split("\n")
|
17
|
-
s.
|
18
|
-
s.
|
19
|
-
s.
|
18
|
+
s.executables = ["firestarter"]
|
19
|
+
s.homepage = "http://github.com/groupbuddies/firestarter"
|
20
|
+
s.extra_rdoc_files = %w(README.md LICENSE)
|
21
|
+
s.license = "MIT"
|
20
22
|
|
21
|
-
s.executables = [
|
22
|
-
s.rdoc_options = [
|
23
|
-
s.require_paths = [
|
23
|
+
s.executables = ["firestarter"]
|
24
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
25
|
+
s.require_paths = ["lib"]
|
24
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
-
s.required_ruby_version =
|
26
|
-
s.date = Date.today.strftime(
|
27
|
+
s.required_ruby_version = ">= 1.9.2"
|
28
|
+
s.date = Date.today.strftime("%Y-%m-%d")
|
27
29
|
|
28
|
-
s.add_dependency
|
29
|
-
s.add_dependency
|
30
|
+
s.add_dependency "bundler", "~> 1.3"
|
31
|
+
s.add_dependency "rails", Firestarter::RAILS_VERSION
|
30
32
|
|
31
|
-
s.add_development_dependency
|
32
|
-
s.add_development_dependency
|
33
|
-
s.add_development_dependency
|
33
|
+
s.add_development_dependency "aruba", "~> 0.5.4"
|
34
|
+
s.add_development_dependency "rspec", "~> 2.0"
|
35
|
+
s.add_development_dependency "capybara", "~> 2.2", ">= 2.2.0"
|
36
|
+
s.add_development_dependency "rubocop", "~> 0.40.0"
|
34
37
|
end
|
data/lib/firestarter.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "firestarter/generators/app_generator"
|
2
|
+
require "firestarter/actions"
|
3
|
+
require "firestarter/app_builder"
|
4
|
+
require "firestarter/version"
|
data/lib/firestarter/actions.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
module Firestarter
|
2
|
-
class AppBuilder < Rails::AppBuilder
|
2
|
+
class AppBuilder < Rails::AppBuilder # rubocop:disable Metrics/ClassLength
|
3
3
|
include Firestarter::Actions
|
4
4
|
|
5
5
|
def readme
|
6
|
-
template
|
6
|
+
template "README.md.erb", "README.md"
|
7
7
|
end
|
8
8
|
|
9
9
|
def rakefile
|
10
|
-
template
|
10
|
+
template "Rakefile.erb", "Rakefile"
|
11
11
|
end
|
12
12
|
|
13
13
|
def raise_on_delivery_errors
|
14
|
-
replace_in_file
|
15
|
-
|
14
|
+
replace_in_file "config/environments/development.rb",
|
15
|
+
"raise_delivery_errors = false", "raise_delivery_errors = true"
|
16
16
|
end
|
17
17
|
|
18
18
|
def raise_on_unpermitted_parameters
|
@@ -25,21 +25,21 @@ module Firestarter
|
|
25
25
|
inject_into_file(
|
26
26
|
"config/environments/development.rb",
|
27
27
|
action_on_unpermitted_parameters,
|
28
|
-
before: "\nend"
|
28
|
+
before: "\nend",
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
32
32
|
def provide_setup_script
|
33
|
-
remove_file
|
34
|
-
copy_file
|
35
|
-
run
|
33
|
+
remove_file "bin/setup"
|
34
|
+
copy_file "bin_setup", "bin/setup"
|
35
|
+
run "chmod a+x bin/setup"
|
36
36
|
end
|
37
37
|
|
38
38
|
def provide_dev_prime_task
|
39
|
-
copy_file
|
39
|
+
copy_file "development_seeds.rb", "lib/tasks/development_seeds.rake"
|
40
40
|
end
|
41
41
|
|
42
|
-
def configure_generators
|
42
|
+
def configure_generators # rubocop:disable Metrics/MethodLength
|
43
43
|
config = <<-RUBY
|
44
44
|
config.generators do |generate|
|
45
45
|
generate.helper false
|
@@ -53,22 +53,22 @@ module Firestarter
|
|
53
53
|
|
54
54
|
RUBY
|
55
55
|
|
56
|
-
inject_into_class
|
56
|
+
inject_into_class "config/application.rb", "Application", config
|
57
57
|
end
|
58
58
|
|
59
59
|
def enable_factory_girl_syntax
|
60
|
-
copy_file
|
60
|
+
copy_file "factory_girl_syntax_rspec.rb", "spec/support/factory_girl.rb"
|
61
61
|
end
|
62
62
|
|
63
63
|
def test_factories_first
|
64
|
-
copy_file
|
65
|
-
append_file
|
64
|
+
copy_file "factories_spec.rb", "spec/models/factories_spec.rb"
|
65
|
+
append_file "Rakefile", factories_spec_rake_task
|
66
66
|
end
|
67
67
|
|
68
68
|
def configure_smtp
|
69
|
-
copy_file
|
69
|
+
copy_file "smtp.rb", "config/initializers/smtp.rb"
|
70
70
|
|
71
|
-
prepend_file
|
71
|
+
prepend_file "config/environments/production.rb",
|
72
72
|
"require Rails.root.join('config/initializers/smtp')\n"
|
73
73
|
|
74
74
|
config = <<-RUBY
|
@@ -77,8 +77,8 @@ module Firestarter
|
|
77
77
|
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
78
78
|
RUBY
|
79
79
|
|
80
|
-
inject_into_file
|
81
|
-
:
|
80
|
+
inject_into_file "config/environments/production.rb", config,
|
81
|
+
after: "config.action_mailer.raise_delivery_errors = false"
|
82
82
|
end
|
83
83
|
|
84
84
|
def enable_rack_deflater
|
@@ -88,13 +88,13 @@ module Firestarter
|
|
88
88
|
config.middleware.use Rack::Deflater
|
89
89
|
RUBY
|
90
90
|
|
91
|
-
inject_into_file
|
92
|
-
:
|
91
|
+
inject_into_file "config/environments/production.rb", config,
|
92
|
+
after: "config.serve_static_assets = false\n"
|
93
93
|
end
|
94
94
|
|
95
95
|
def setup_staging_environment
|
96
|
-
staging_file =
|
97
|
-
copy_file
|
96
|
+
staging_file = "config/environments/staging.rb"
|
97
|
+
copy_file "staging.rb", staging_file
|
98
98
|
|
99
99
|
config = <<-RUBY
|
100
100
|
|
@@ -107,74 +107,92 @@ end
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def setup_secret_token
|
110
|
-
template
|
111
|
-
|
112
|
-
:
|
110
|
+
template "secret_token.rb.erb",
|
111
|
+
"config/initializers/secret_token.rb",
|
112
|
+
force: true
|
113
113
|
end
|
114
114
|
|
115
115
|
def create_partials_directory
|
116
|
-
empty_directory
|
116
|
+
empty_directory "app/views/application"
|
117
117
|
end
|
118
118
|
|
119
119
|
def create_shared_flashes
|
120
|
-
copy_file
|
120
|
+
copy_file "_flashes.slim", "app/views/application/_flashes.slim"
|
121
121
|
end
|
122
122
|
|
123
123
|
def create_shared_javascripts
|
124
|
-
copy_file
|
124
|
+
copy_file "_javascript.slim", "app/views/application/_javascript.slim"
|
125
125
|
end
|
126
126
|
|
127
127
|
def create_application_layout
|
128
|
-
remove_file
|
129
|
-
template
|
130
|
-
|
128
|
+
remove_file "app/views/layouts/application.html.erb"
|
129
|
+
template "firestarter_layout.slim.erb",
|
130
|
+
"app/views/layouts/application.slim",
|
131
131
|
force: true
|
132
132
|
end
|
133
133
|
|
134
134
|
def remove_turbolinks
|
135
|
-
replace_in_file
|
136
|
-
|
137
|
-
|
135
|
+
replace_in_file "app/assets/javascripts/application.js",
|
136
|
+
%r{//= require turbolinks\n},
|
137
|
+
""
|
138
|
+
end
|
139
|
+
|
140
|
+
def remove_require_tree
|
141
|
+
replace_in_file "app/assets/javascripts/application.js",
|
142
|
+
%r{//= require_tree .\n},
|
143
|
+
""
|
144
|
+
end
|
145
|
+
|
146
|
+
def add_retina_tag
|
147
|
+
append_to_file "app/assets/javascripts/application.js",
|
148
|
+
"//= require retina_tag\n"
|
138
149
|
end
|
139
150
|
|
140
151
|
def use_postgres_config_template
|
141
|
-
template
|
152
|
+
template "postgresql_database.yml.erb", "config/database.yml",
|
142
153
|
force: true
|
143
154
|
end
|
144
155
|
|
156
|
+
def use_rubocop_config
|
157
|
+
download_file(
|
158
|
+
"https://github.com/subvisual/guides/blob/master/linters/ruby/.rubocop.yml",
|
159
|
+
".rubocop.yml"
|
160
|
+
)
|
161
|
+
end
|
162
|
+
|
145
163
|
def create_database
|
146
|
-
bundle_command
|
164
|
+
bundle_command "exec rake db:create db:migrate"
|
147
165
|
end
|
148
166
|
|
149
167
|
def replace_gemfile
|
150
|
-
remove_file
|
151
|
-
template
|
168
|
+
remove_file "Gemfile"
|
169
|
+
template "Gemfile.erb", "Gemfile"
|
152
170
|
end
|
153
171
|
|
154
172
|
def set_ruby_to_version_being_used
|
155
|
-
template
|
173
|
+
template "ruby-version.erb", ".ruby-version"
|
156
174
|
end
|
157
175
|
|
158
176
|
def enable_unobtrusive_pry_in_specs
|
159
|
-
copy_file
|
177
|
+
copy_file "unobtrusive_pry.rb", "spec/support/pry.rb"
|
160
178
|
end
|
161
179
|
|
162
180
|
def enable_database_cleaner
|
163
|
-
copy_file
|
181
|
+
copy_file "database_cleaner_rspec.rb", "spec/support/database_cleaner.rb"
|
164
182
|
end
|
165
183
|
|
166
184
|
def configure_spec_support_features
|
167
|
-
empty_directory_with_keep_file
|
168
|
-
empty_directory_with_keep_file
|
185
|
+
empty_directory_with_keep_file "spec/features"
|
186
|
+
empty_directory_with_keep_file "spec/support/features"
|
169
187
|
end
|
170
188
|
|
171
189
|
def configure_rspec
|
172
|
-
remove_file
|
173
|
-
copy_file
|
190
|
+
remove_file "spec/spec_helper.rb"
|
191
|
+
copy_file "spec_helper.rb", "spec/spec_helper.rb"
|
174
192
|
end
|
175
193
|
|
176
194
|
def configure_i18n_in_specs
|
177
|
-
copy_file
|
195
|
+
copy_file "i18n.rb", "spec/support/i18n.rb"
|
178
196
|
end
|
179
197
|
|
180
198
|
def configure_time_zone
|
@@ -182,27 +200,27 @@ end
|
|
182
200
|
config.active_record.default_timezone = :utc
|
183
201
|
|
184
202
|
RUBY
|
185
|
-
inject_into_class
|
203
|
+
inject_into_class "config/application.rb", "Application", config
|
186
204
|
end
|
187
205
|
|
188
206
|
def configure_time_formats
|
189
|
-
remove_file
|
190
|
-
copy_file
|
207
|
+
remove_file "config/locales/en.yml"
|
208
|
+
copy_file "config_locales_en.yml", "config/locales/en.yml"
|
191
209
|
end
|
192
210
|
|
193
211
|
def configure_rack_timeout
|
194
|
-
copy_file
|
212
|
+
copy_file "rack_timeout.rb", "config/initializers/rack_timeout.rb"
|
195
213
|
end
|
196
214
|
|
197
215
|
def configure_slim
|
198
|
-
copy_file
|
216
|
+
copy_file "slim.rb", "config/initializers/slim.rb"
|
199
217
|
end
|
200
218
|
|
201
219
|
def configure_action_mailer
|
202
|
-
action_mailer_host
|
203
|
-
action_mailer_host
|
204
|
-
action_mailer_host
|
205
|
-
action_mailer_host
|
220
|
+
action_mailer_host "development", "#{app_name}.local"
|
221
|
+
action_mailer_host "test", "www.example.com"
|
222
|
+
action_mailer_host "staging", "staging.#{app_name}.com"
|
223
|
+
action_mailer_host "production", "#{app_name}.com"
|
206
224
|
end
|
207
225
|
|
208
226
|
def fix_i18n_deprecation_warning
|
@@ -210,39 +228,39 @@ end
|
|
210
228
|
config.i18n.enforce_available_locales = true
|
211
229
|
|
212
230
|
RUBY
|
213
|
-
inject_into_class
|
231
|
+
inject_into_class "config/application.rb", "Application", config
|
214
232
|
end
|
215
233
|
|
216
234
|
def generate_rspec
|
217
|
-
generate
|
235
|
+
generate "rspec:install"
|
218
236
|
end
|
219
237
|
|
220
238
|
def configure_puma
|
221
|
-
copy_file
|
239
|
+
copy_file "puma.rb", "config/puma.rb", force: true
|
222
240
|
end
|
223
241
|
|
224
242
|
def setup_foreman
|
225
|
-
copy_file
|
226
|
-
copy_file
|
243
|
+
copy_file "sample.env", ".sample.env"
|
244
|
+
copy_file "Procfile", "Procfile"
|
227
245
|
end
|
228
246
|
|
229
247
|
def setup_stylesheets
|
230
|
-
remove_file
|
231
|
-
copy_file
|
232
|
-
|
248
|
+
remove_file "app/assets/stylesheets/application.css"
|
249
|
+
copy_file "application.sass",
|
250
|
+
"app/assets/stylesheets/application.sass"
|
233
251
|
end
|
234
252
|
|
235
|
-
def gitignore_files
|
236
|
-
remove_file
|
237
|
-
copy_file
|
253
|
+
def gitignore_files # rubocop:disable Metrics/MethodLength
|
254
|
+
remove_file ".gitignore"
|
255
|
+
copy_file "firestarter_gitignore", ".gitignore"
|
238
256
|
[
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
257
|
+
"app/views/pages",
|
258
|
+
"spec/lib",
|
259
|
+
"spec/controllers",
|
260
|
+
"spec/helpers",
|
261
|
+
"spec/support/matchers",
|
262
|
+
"spec/support/mixins",
|
263
|
+
"spec/support/shared_examples",
|
246
264
|
].each do |dir|
|
247
265
|
run "mkdir #{dir}"
|
248
266
|
run "touch #{dir}/.keep"
|
@@ -250,56 +268,57 @@ end
|
|
250
268
|
end
|
251
269
|
|
252
270
|
def init_git
|
253
|
-
run
|
254
|
-
end
|
255
|
-
|
256
|
-
def copy_miscellaneous_files
|
257
|
-
copy_file 'errors.rb', 'config/initializers/errors.rb'
|
271
|
+
run "git init"
|
258
272
|
end
|
259
273
|
|
260
274
|
def customize_error_pages
|
261
|
-
meta_tags
|
275
|
+
meta_tags = <<-EOS
|
262
276
|
<meta charset='utf-8' />
|
263
277
|
<meta name='ROBOTS' content='NOODP' />
|
264
278
|
EOS
|
265
279
|
|
266
280
|
%w(500 404 422).each do |page|
|
267
|
-
inject_into_file "public/#{page}.html", meta_tags, :
|
268
|
-
replace_in_file "public/#{page}.html", /<!--.+-->\n/,
|
281
|
+
inject_into_file "public/#{page}.html", meta_tags, after: "<head>\n"
|
282
|
+
replace_in_file "public/#{page}.html", /<!--.+-->\n/, ""
|
269
283
|
end
|
270
284
|
end
|
271
285
|
|
272
286
|
def remove_routes_comment_lines
|
273
|
-
replace_in_file
|
287
|
+
replace_in_file "config/routes.rb",
|
274
288
|
/Rails.application\.routes\.draw do.*end/m,
|
275
289
|
"Rails.application.routes.draw do\nend"
|
276
290
|
end
|
277
291
|
|
278
292
|
def disable_xml_params
|
279
|
-
copy_file
|
293
|
+
copy_file "disable_xml_params.rb", "config/initializers/disable_xml_params.rb"
|
280
294
|
end
|
281
295
|
|
282
296
|
def scss_lint_config
|
283
|
-
copy_file
|
297
|
+
copy_file "scss-lint.yml", ".scss-lint.yml"
|
284
298
|
end
|
285
299
|
|
286
300
|
def setup_default_rake_task
|
287
|
-
append_file
|
301
|
+
append_file "Rakefile" do
|
288
302
|
"task(:default).clear\ntask :default => [:spec]\n"
|
289
303
|
end
|
290
304
|
end
|
291
305
|
|
306
|
+
def setup_metrics
|
307
|
+
copy_file "metrics", ".metrics"
|
308
|
+
copy_file "metrics.reek", ".metrics.reek"
|
309
|
+
end
|
310
|
+
|
292
311
|
private
|
293
312
|
|
294
313
|
def override_path_for_tests
|
295
|
-
if ENV[
|
296
|
-
support_bin = File.expand_path(File.join(
|
314
|
+
if ENV["TESTING"]
|
315
|
+
support_bin = File.expand_path(File.join("..", "..", "spec", "fakes", "bin"))
|
297
316
|
"PATH=#{support_bin}:$PATH"
|
298
317
|
end
|
299
318
|
end
|
300
319
|
|
301
320
|
def factories_spec_rake_task
|
302
|
-
IO.read find_in_source_paths(
|
321
|
+
IO.read find_in_source_paths("factories_spec_rake_task.rb")
|
303
322
|
end
|
304
323
|
|
305
324
|
def generate_secret
|