gimbal 0.0.6 → 0.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 +4 -4
- data/.hound.yml +2 -0
- data/.ruby-style.yml +243 -0
- data/CHANGELOG.md +38 -0
- data/README.md +2 -1
- data/gimbal.gemspec +1 -1
- data/lib/gimbal/app_builder.rb +56 -1
- data/lib/gimbal/generators/app_generator.rb +72 -17
- data/lib/gimbal/version.rb +1 -1
- data/spec/features/new_project_spec.rb +121 -99
- data/templates/Gemfile.erb +2 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 758b0dd4097f6945f03810776ce2367fe74bcf10
|
4
|
+
data.tar.gz: f7b92490af5fcd69d231603ebcd9650c7bfb446e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c94c583490b75534deddf1b0c3c2e661263e6209664844b97a927e2fe80d0f9288dfabb8b5336dc3007e442a4cceef85ee946d8e0e34df6930b52e94130dc14c
|
7
|
+
data.tar.gz: 09c0244b34d78aea2edbebbc51f533723a5e7a643b33ff4af1e13dabcf58af1c14c1f9e27e9a49552aa4ad3753ab8667ab5c4e7a5960cccf80af7c96da5a9ce3
|
data/.hound.yml
ADDED
data/.ruby-style.yml
ADDED
@@ -0,0 +1,243 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- "vendor/**/*"
|
4
|
+
- "db/schema.rb"
|
5
|
+
UseCache: false
|
6
|
+
Style/CollectionMethods:
|
7
|
+
Description: Preferred collection methods.
|
8
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
|
9
|
+
Enabled: true
|
10
|
+
PreferredMethods:
|
11
|
+
collect: map
|
12
|
+
collect!: map!
|
13
|
+
find: detect
|
14
|
+
find_all: select
|
15
|
+
reduce: inject
|
16
|
+
Style/DotPosition:
|
17
|
+
Description: Checks the position of the dot in multi-line method calls.
|
18
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
|
19
|
+
Enabled: true
|
20
|
+
EnforcedStyle: trailing
|
21
|
+
SupportedStyles:
|
22
|
+
- leading
|
23
|
+
- trailing
|
24
|
+
Style/FileName:
|
25
|
+
Description: Use snake_case for source file names.
|
26
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
|
27
|
+
Enabled: false
|
28
|
+
Exclude: []
|
29
|
+
Style/GuardClause:
|
30
|
+
Description: Check for conditionals that can be replaced with guard clauses
|
31
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
32
|
+
Enabled: false
|
33
|
+
MinBodyLength: 1
|
34
|
+
Style/IfUnlessModifier:
|
35
|
+
Description: Favor modifier if/unless usage when you have a single-line body.
|
36
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
|
37
|
+
Enabled: false
|
38
|
+
MaxLineLength: 80
|
39
|
+
Style/OptionHash:
|
40
|
+
Description: Don't use option hashes when you can use keyword arguments.
|
41
|
+
Enabled: false
|
42
|
+
Style/PercentLiteralDelimiters:
|
43
|
+
Description: Use `%`-literal delimiters consistently
|
44
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
|
45
|
+
Enabled: false
|
46
|
+
PreferredDelimiters:
|
47
|
+
"%": "()"
|
48
|
+
"%i": "()"
|
49
|
+
"%q": "()"
|
50
|
+
"%Q": "()"
|
51
|
+
"%r": "{}"
|
52
|
+
"%s": "()"
|
53
|
+
"%w": "()"
|
54
|
+
"%W": "()"
|
55
|
+
"%x": "()"
|
56
|
+
Style/PredicateName:
|
57
|
+
Description: Check the names of predicate methods.
|
58
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
59
|
+
Enabled: true
|
60
|
+
NamePrefix:
|
61
|
+
- is_
|
62
|
+
- has_
|
63
|
+
- have_
|
64
|
+
NamePrefixBlacklist:
|
65
|
+
- is_
|
66
|
+
Exclude:
|
67
|
+
- spec/**/*
|
68
|
+
Style/RaiseArgs:
|
69
|
+
Description: Checks the arguments passed to raise/fail.
|
70
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
|
71
|
+
Enabled: false
|
72
|
+
EnforcedStyle: exploded
|
73
|
+
SupportedStyles:
|
74
|
+
- compact
|
75
|
+
- exploded
|
76
|
+
Style/SignalException:
|
77
|
+
Description: Checks for proper usage of fail and raise.
|
78
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
|
79
|
+
Enabled: false
|
80
|
+
EnforcedStyle: semantic
|
81
|
+
SupportedStyles:
|
82
|
+
- only_raise
|
83
|
+
- only_fail
|
84
|
+
- semantic
|
85
|
+
Style/SingleLineBlockParams:
|
86
|
+
Description: Enforces the names of some block params.
|
87
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
|
88
|
+
Enabled: false
|
89
|
+
Methods:
|
90
|
+
- reduce:
|
91
|
+
- a
|
92
|
+
- e
|
93
|
+
- inject:
|
94
|
+
- a
|
95
|
+
- e
|
96
|
+
Style/SingleLineMethods:
|
97
|
+
Description: Avoid single-line methods.
|
98
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
|
99
|
+
Enabled: false
|
100
|
+
AllowIfMethodIsEmpty: true
|
101
|
+
Style/StringLiterals:
|
102
|
+
Description: Checks if uses of quotes match the configured preference.
|
103
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
|
104
|
+
Enabled: true
|
105
|
+
EnforcedStyle: single_quotes
|
106
|
+
SupportedStyles:
|
107
|
+
- single_quotes
|
108
|
+
- double_quotes
|
109
|
+
Style/StringLiteralsInInterpolation:
|
110
|
+
Description: Checks if uses of quotes inside expressions in interpolated strings
|
111
|
+
match the configured preference.
|
112
|
+
Enabled: true
|
113
|
+
EnforcedStyle: single_quotes
|
114
|
+
SupportedStyles:
|
115
|
+
- single_quotes
|
116
|
+
- double_quotes
|
117
|
+
Style/TrailingCommaInArguments:
|
118
|
+
Description: 'Checks for trailing comma in argument lists.'
|
119
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
120
|
+
Enabled: false
|
121
|
+
EnforcedStyleForMultiline: no_comma
|
122
|
+
SupportedStyles:
|
123
|
+
- comma
|
124
|
+
- consistent_comma
|
125
|
+
- no_comma
|
126
|
+
Style/TrailingCommaInLiteral:
|
127
|
+
Description: 'Checks for trailing comma in array and hash literals.'
|
128
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
129
|
+
Enabled: false
|
130
|
+
EnforcedStyleForMultiline: no_comma
|
131
|
+
SupportedStyles:
|
132
|
+
- comma
|
133
|
+
- consistent_comma
|
134
|
+
- no_comma
|
135
|
+
Metrics/AbcSize:
|
136
|
+
Description: A calculated magnitude based on number of assignments, branches, and
|
137
|
+
conditions.
|
138
|
+
Enabled: false
|
139
|
+
Max: 15
|
140
|
+
Metrics/ClassLength:
|
141
|
+
Description: Avoid classes longer than 100 lines of code.
|
142
|
+
Enabled: false
|
143
|
+
CountComments: false
|
144
|
+
Max: 100
|
145
|
+
Metrics/ModuleLength:
|
146
|
+
CountComments: false
|
147
|
+
Max: 100
|
148
|
+
Description: Avoid modules longer than 100 lines of code.
|
149
|
+
Enabled: false
|
150
|
+
Metrics/CyclomaticComplexity:
|
151
|
+
Description: A complexity metric that is strongly correlated to the number of test
|
152
|
+
cases needed to validate a method.
|
153
|
+
Enabled: false
|
154
|
+
Max: 6
|
155
|
+
Metrics/MethodLength:
|
156
|
+
Description: Avoid methods longer than 10 lines of code.
|
157
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
158
|
+
Enabled: false
|
159
|
+
CountComments: false
|
160
|
+
Max: 10
|
161
|
+
Metrics/ParameterLists:
|
162
|
+
Description: Avoid parameter lists longer than three or four parameters.
|
163
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
|
164
|
+
Enabled: false
|
165
|
+
Max: 5
|
166
|
+
CountKeywordArgs: true
|
167
|
+
Metrics/PerceivedComplexity:
|
168
|
+
Description: A complexity metric geared towards measuring complexity for a human
|
169
|
+
reader.
|
170
|
+
Enabled: false
|
171
|
+
Max: 7
|
172
|
+
Lint/AssignmentInCondition:
|
173
|
+
Description: Don't use assignment in conditions.
|
174
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
|
175
|
+
Enabled: false
|
176
|
+
AllowSafeAssignment: true
|
177
|
+
Style/InlineComment:
|
178
|
+
Description: Avoid inline comments.
|
179
|
+
Enabled: false
|
180
|
+
Style/AccessorMethodName:
|
181
|
+
Description: Check the naming of accessor methods for get_/set_.
|
182
|
+
Enabled: false
|
183
|
+
Style/Alias:
|
184
|
+
Description: Use alias_method instead of alias.
|
185
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
|
186
|
+
Enabled: false
|
187
|
+
Style/Documentation:
|
188
|
+
Description: Document classes and non-namespace modules.
|
189
|
+
Enabled: false
|
190
|
+
Style/DoubleNegation:
|
191
|
+
Description: Checks for uses of double negation (!!).
|
192
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
|
193
|
+
Enabled: false
|
194
|
+
Style/EachWithObject:
|
195
|
+
Description: Prefer `each_with_object` over `inject` or `reduce`.
|
196
|
+
Enabled: false
|
197
|
+
Style/EmptyLiteral:
|
198
|
+
Description: Prefer literals to Array.new/Hash.new/String.new.
|
199
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
|
200
|
+
Enabled: false
|
201
|
+
Style/ModuleFunction:
|
202
|
+
Description: Checks for usage of `extend self` in modules.
|
203
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
|
204
|
+
Enabled: false
|
205
|
+
Style/OneLineConditional:
|
206
|
+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
207
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
208
|
+
Enabled: false
|
209
|
+
Style/PerlBackrefs:
|
210
|
+
Description: Avoid Perl-style regex back references.
|
211
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
|
212
|
+
Enabled: false
|
213
|
+
Style/Send:
|
214
|
+
Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
|
215
|
+
may overlap with existing methods.
|
216
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
|
217
|
+
Enabled: false
|
218
|
+
Style/SpecialGlobalVars:
|
219
|
+
Description: Avoid Perl-style global variables.
|
220
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
|
221
|
+
Enabled: false
|
222
|
+
Style/VariableInterpolation:
|
223
|
+
Description: Don't interpolate global, instance and class variables directly in
|
224
|
+
strings.
|
225
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
|
226
|
+
Enabled: false
|
227
|
+
Style/WhenThen:
|
228
|
+
Description: Use when x then ... for one-line cases.
|
229
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
|
230
|
+
Enabled: false
|
231
|
+
Lint/EachWithObjectArgument:
|
232
|
+
Description: Check for immutable argument given to each_with_object.
|
233
|
+
Enabled: true
|
234
|
+
Lint/HandleExceptions:
|
235
|
+
Description: Don't suppress exception.
|
236
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
|
237
|
+
Enabled: false
|
238
|
+
Lint/LiteralInCondition:
|
239
|
+
Description: Checks of literals used in conditions.
|
240
|
+
Enabled: false
|
241
|
+
Lint/LiteralInInterpolation:
|
242
|
+
Description: Checks for literals used in interpolation.
|
243
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
master
|
2
|
+
|
3
|
+
* Add devise gem and configure for User model
|
4
|
+
* Upgrade RSpec to 3.4
|
5
|
+
|
6
|
+
0.0.6 (9th May 2016)
|
7
|
+
|
8
|
+
* Add test coverage for help output
|
9
|
+
|
10
|
+
0.0.5 (9th May 2016)
|
11
|
+
|
12
|
+
* Make help output specific to Gimbal rather than Rails
|
13
|
+
* Enable analytics with Segment
|
14
|
+
* Use HAML templates
|
15
|
+
|
16
|
+
0.0.4 (9th May 2016)
|
17
|
+
|
18
|
+
* Fix travis ruby version
|
19
|
+
* Make Rails version requirements less pessimistic
|
20
|
+
* Use RACK_ENV instead of RAILS_ENV
|
21
|
+
* Increase ruby version to 2.2.4
|
22
|
+
* Fix GitHub spec
|
23
|
+
* Ignore JetBrains workspaces
|
24
|
+
|
25
|
+
0.0.3 (1st December 2015)
|
26
|
+
|
27
|
+
* Add letter_opener gem
|
28
|
+
* Add action mailer test helper
|
29
|
+
* Copy various templates and gems from Suspenders
|
30
|
+
|
31
|
+
0.0.2 (1st December 2015)
|
32
|
+
|
33
|
+
* Setup basic application generator
|
34
|
+
|
35
|
+
0.0.1 (1st December 2015)
|
36
|
+
|
37
|
+
* Initial build to secure gem name
|
38
|
+
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# gimbal [](https://travis-ci.org/pacso/gimbal)
|
1
|
+
# gimbal [](https://travis-ci.org/pacso/gimbal) [](https://badge.fury.io/rb/gimbal) [](https://gemnasium.com/github.com/pacso/gimbal)
|
2
|
+
|
2
3
|
|
3
4
|
Gimbal is the base Rails application I use when starting new projects. It was mostly copied from thoughtbot's Suspenders project, but modified for my needs.
|
4
5
|
|
data/gimbal.gemspec
CHANGED
data/lib/gimbal/app_builder.rb
CHANGED
@@ -41,6 +41,7 @@ module Gimbal
|
|
41
41
|
|
42
42
|
def add_bullet_gem_configuration
|
43
43
|
config = <<-RUBY
|
44
|
+
|
44
45
|
config.after_initialize do
|
45
46
|
Bullet.enable = true
|
46
47
|
Bullet.bullet_logger = true
|
@@ -72,6 +73,7 @@ module Gimbal
|
|
72
73
|
generate.javascript_engine false
|
73
74
|
generate.request_specs false
|
74
75
|
generate.routing_specs false
|
76
|
+
generate.skip_routes true
|
75
77
|
generate.stylesheets false
|
76
78
|
generate.test_framework :rspec
|
77
79
|
generate.view_specs false
|
@@ -82,6 +84,10 @@ module Gimbal
|
|
82
84
|
inject_into_class 'config/application.rb', 'Application', config
|
83
85
|
end
|
84
86
|
|
87
|
+
def enable_devise_gem
|
88
|
+
uncomment_lines('Gemfile', 'gem "devise"')
|
89
|
+
end
|
90
|
+
|
85
91
|
def configure_i18n_for_missing_translations
|
86
92
|
raise_on_missing_translations_in("development")
|
87
93
|
raise_on_missing_translations_in("test")
|
@@ -120,7 +126,7 @@ module Gimbal
|
|
120
126
|
end
|
121
127
|
|
122
128
|
def generate_rspec
|
123
|
-
generate
|
129
|
+
bundle_command 'exec rails generate rspec:install'
|
124
130
|
end
|
125
131
|
|
126
132
|
def configure_puma
|
@@ -153,6 +159,41 @@ module Gimbal
|
|
153
159
|
copy_file "spec_helper.rb", "spec/spec_helper.rb"
|
154
160
|
end
|
155
161
|
|
162
|
+
def install_devise
|
163
|
+
bundle_command 'exec rails generate devise:install'
|
164
|
+
end
|
165
|
+
|
166
|
+
def generate_devise_model
|
167
|
+
bundle_command 'exec rails generate devise User'
|
168
|
+
bundle_command 'exec rails generate devise:views'
|
169
|
+
end
|
170
|
+
|
171
|
+
def configure_devise
|
172
|
+
inject_into_file 'app/models/user.rb',
|
173
|
+
"\n :confirmable, :lockable, :timeoutable,",
|
174
|
+
after: 'devise :database_authenticatable, :registerable,'
|
175
|
+
|
176
|
+
devise_migration = Dir['db/migrate/*devise_create*.rb'].first
|
177
|
+
|
178
|
+
uncomment_lines(devise_migration, 't.string :confirmation_token')
|
179
|
+
uncomment_lines(devise_migration, 't.datetime :confirmed_at')
|
180
|
+
uncomment_lines(devise_migration, 't.datetime :confirmation_sent_at')
|
181
|
+
uncomment_lines(devise_migration, 't.string :unconfirmed_email')
|
182
|
+
|
183
|
+
uncomment_lines(devise_migration, 't.integer :failed_attempts')
|
184
|
+
uncomment_lines(devise_migration, 't.string :unlock_token')
|
185
|
+
uncomment_lines(devise_migration, 't.datetime :locked_at')
|
186
|
+
|
187
|
+
uncomment_lines(devise_migration, 'add_index :users, :confirmation_token')
|
188
|
+
uncomment_lines(devise_migration, 'add_index :users, :unlock_token')
|
189
|
+
|
190
|
+
inject_into_file(
|
191
|
+
"config/environments/development.rb",
|
192
|
+
"config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }\n",
|
193
|
+
after: "config.action_mailer.delivery_method = :letter_opener\n",
|
194
|
+
)
|
195
|
+
end
|
196
|
+
|
156
197
|
def create_partials_directory
|
157
198
|
empty_directory 'app/views/application'
|
158
199
|
end
|
@@ -181,6 +222,20 @@ module Gimbal
|
|
181
222
|
bundle_command 'exec rake db:create db:migrate'
|
182
223
|
end
|
183
224
|
|
225
|
+
def migrate_database
|
226
|
+
bundle_command 'exec rake db:migrate'
|
227
|
+
end
|
228
|
+
|
229
|
+
def generate_homepage
|
230
|
+
bundle_command 'exec rails generate controller pages homepage'
|
231
|
+
|
232
|
+
inject_into_file(
|
233
|
+
'config/routes.rb',
|
234
|
+
"\n root to: 'pages#homepage'",
|
235
|
+
after: 'devise_for :users'
|
236
|
+
)
|
237
|
+
end
|
238
|
+
|
184
239
|
def configure_time_formats
|
185
240
|
remove_file "config/locales/en.yml"
|
186
241
|
template "config_locales_en.yml.erb", "config/locales/en.yml"
|
@@ -3,33 +3,65 @@ require 'rails/generators/rails/app/app_generator'
|
|
3
3
|
|
4
4
|
module Gimbal
|
5
5
|
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
-
class_option :database,
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
desc: "
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
6
|
+
class_option :database,
|
7
|
+
type: :string,
|
8
|
+
aliases: '-d',
|
9
|
+
default: 'mysql',
|
10
|
+
desc: "Configure for selected database
|
11
|
+
(options: #{DATABASES.join('/')})"
|
12
|
+
|
13
|
+
class_option :github,
|
14
|
+
type: :string,
|
15
|
+
aliases: '-G',
|
16
|
+
default: nil,
|
17
|
+
desc: 'Create Github repository and
|
18
|
+
add remote origin pointed to repo'
|
19
|
+
|
20
|
+
class_option :skip_test_unit,
|
21
|
+
type: :boolean,
|
22
|
+
aliases: '-T',
|
23
|
+
default: true,
|
24
|
+
desc: 'Skip Test::Unit files'
|
25
|
+
|
26
|
+
class_option :skip_turbolinks,
|
27
|
+
type: :boolean,
|
28
|
+
default: true,
|
29
|
+
desc: 'Skip turbolinks gem'
|
30
|
+
|
31
|
+
class_option :skip_bundle,
|
32
|
+
type: :boolean,
|
33
|
+
aliases: '-B',
|
34
|
+
default: true,
|
19
35
|
desc: "Don't run bundle install"
|
20
36
|
|
21
|
-
class_option :
|
22
|
-
|
23
|
-
|
24
|
-
|
37
|
+
class_option :skip_devise,
|
38
|
+
type: :boolean,
|
39
|
+
default: false,
|
40
|
+
desc: 'Skip devise gem and setup'
|
41
|
+
|
42
|
+
class_option :version,
|
43
|
+
type: :boolean,
|
44
|
+
aliases: '-v',
|
45
|
+
group: :gimbal,
|
46
|
+
desc: 'Show Gimbal version number and quit'
|
47
|
+
|
48
|
+
class_option :help,
|
49
|
+
type: :boolean,
|
50
|
+
aliases: '-h',
|
51
|
+
group: :gimbal,
|
25
52
|
desc: 'Show this help message and quit'
|
26
53
|
|
27
54
|
def finish_template
|
28
55
|
say 'Finishing template'
|
56
|
+
invoke :stop_spring
|
29
57
|
invoke :gimbal_customisation
|
30
58
|
super
|
31
59
|
end
|
32
60
|
|
61
|
+
def stop_spring
|
62
|
+
run('spring stop')
|
63
|
+
end
|
64
|
+
|
33
65
|
def gimbal_customisation
|
34
66
|
say 'Gimbal Customisation'
|
35
67
|
invoke :customise_gemfile
|
@@ -40,10 +72,13 @@ module Gimbal
|
|
40
72
|
invoke :configure_app
|
41
73
|
invoke :setup_git
|
42
74
|
invoke :setup_database
|
75
|
+
invoke :setup_devise
|
43
76
|
invoke :create_github_repo
|
44
77
|
invoke :setup_analytics
|
45
78
|
invoke :setup_bundler_audit
|
46
79
|
invoke :setup_spring
|
80
|
+
invoke :migrate_database
|
81
|
+
invoke :generate_basic_homepage
|
47
82
|
end
|
48
83
|
|
49
84
|
def customise_gemfile
|
@@ -51,9 +86,15 @@ module Gimbal
|
|
51
86
|
build :replace_gemfile
|
52
87
|
build :set_ruby_to_version_being_used
|
53
88
|
|
89
|
+
build :enable_devise_gem unless options[:skip_devise]
|
90
|
+
|
54
91
|
bundle_command 'install'
|
55
92
|
end
|
56
93
|
|
94
|
+
def generate_basic_homepage
|
95
|
+
build :generate_homepage
|
96
|
+
end
|
97
|
+
|
57
98
|
def setup_database
|
58
99
|
say 'Setting up database'
|
59
100
|
|
@@ -62,6 +103,20 @@ module Gimbal
|
|
62
103
|
build :create_database
|
63
104
|
end
|
64
105
|
|
106
|
+
def migrate_database
|
107
|
+
build :migrate_database
|
108
|
+
end
|
109
|
+
|
110
|
+
def setup_devise
|
111
|
+
unless options[:skip_devise]
|
112
|
+
say 'Setting up Devise'
|
113
|
+
|
114
|
+
build :install_devise
|
115
|
+
build :generate_devise_model
|
116
|
+
build :configure_devise
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
65
120
|
def setup_development_environment
|
66
121
|
say 'Setting up the development environment'
|
67
122
|
build :raise_on_delivery_errors
|
data/lib/gimbal/version.rb
CHANGED
@@ -1,136 +1,158 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe 'Create a new project
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
RSpec.describe 'Create a new project' do
|
4
|
+
context 'skipping devise' do
|
5
|
+
before(:all) do
|
6
|
+
drop_dummy_database
|
7
|
+
remove_project_directory
|
8
|
+
run_gimbal('--skip-devise')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'leaves the devise gem disabled' do
|
12
|
+
gemfile = IO.read("#{project_path}/Gemfile")
|
13
|
+
expect(gemfile).to match(/^\# gem "devise"$/)
|
14
|
+
end
|
8
15
|
end
|
9
16
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
17
|
+
context 'with default config' do
|
18
|
+
before(:all) do
|
19
|
+
drop_dummy_database
|
20
|
+
remove_project_directory
|
21
|
+
run_gimbal
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'ensures project specs pass' do
|
25
|
+
Dir.chdir(project_path) do
|
26
|
+
Bundler.with_clean_env do
|
27
|
+
expect(`rake`).to match(/0 failures/)
|
28
|
+
end
|
14
29
|
end
|
15
30
|
end
|
16
|
-
end
|
17
31
|
|
18
|
-
|
19
|
-
|
32
|
+
it 'configs missing assets to raise in test' do
|
33
|
+
test_config = IO.read("#{project_path}/config/environments/test.rb")
|
20
34
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
35
|
+
expect(test_config).to match(
|
36
|
+
/^ +config.assets.raise_runtime_errors = true$/
|
37
|
+
)
|
38
|
+
end
|
25
39
|
|
26
|
-
|
27
|
-
|
40
|
+
it 'configs raise_on_delivery errors in development' do
|
41
|
+
dev_config = IO.read("#{project_path}/config/environments/development.rb")
|
28
42
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
43
|
+
expect(dev_config).to match(
|
44
|
+
/^ +config.action_mailer.raise_delivery_errors = true$/,
|
45
|
+
)
|
46
|
+
end
|
33
47
|
|
34
|
-
|
35
|
-
|
48
|
+
it 'configs development to send mail using letter_opener' do
|
49
|
+
dev_config = IO.read("#{project_path}/config/environments/development.rb")
|
36
50
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
51
|
+
expect(dev_config).to match(
|
52
|
+
/^ +config.action_mailer.delivery_method = :letter_opener/,
|
53
|
+
)
|
54
|
+
end
|
41
55
|
|
42
|
-
|
43
|
-
|
56
|
+
it 'configs development to raise on missing translations' do
|
57
|
+
dev_config = IO.read("#{project_path}/config/environments/development.rb")
|
44
58
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
59
|
+
expect(dev_config).to match(
|
60
|
+
/^ +config.action_view.raise_on_missing_translations = true/
|
61
|
+
)
|
62
|
+
end
|
49
63
|
|
50
|
-
|
51
|
-
|
64
|
+
it 'configs test to raise on missing translations' do
|
65
|
+
dev_config = IO.read("#{project_path}/config/environments/test.rb")
|
52
66
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
67
|
+
expect(dev_config).to match(
|
68
|
+
/^ +config.action_view.raise_on_missing_translations = true/
|
69
|
+
)
|
70
|
+
end
|
57
71
|
|
58
|
-
|
59
|
-
|
72
|
+
it 'configs bullet gem in development' do
|
73
|
+
dev_config = IO.read("#{project_path}/config/environments/development.rb")
|
60
74
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
75
|
+
expect(dev_config).to match(/^ +Bullet.enable = true$/)
|
76
|
+
expect(dev_config).to match(/^ +Bullet.bullet_logger = true$/)
|
77
|
+
expect(dev_config).to match(/^ +Bullet.rails_logger = true$/)
|
78
|
+
end
|
65
79
|
|
66
|
-
|
67
|
-
|
80
|
+
it 'enables the devise gem' do
|
81
|
+
gemfile = IO.read("#{project_path}/Gemfile")
|
82
|
+
expect(gemfile).to match(/^gem "devise"$/)
|
83
|
+
end
|
68
84
|
|
69
|
-
|
70
|
-
|
71
|
-
)
|
72
|
-
end
|
85
|
+
it 'raises on unpermitted parameters in all environments' do
|
86
|
+
result = IO.read("#{project_path}/config/application.rb")
|
73
87
|
|
74
|
-
|
75
|
-
|
88
|
+
expect(result).to match(
|
89
|
+
/^ +config.action_controller.action_on_unpermitted_parameters = :raise$/
|
90
|
+
)
|
91
|
+
end
|
76
92
|
|
77
|
-
|
78
|
-
|
79
|
-
expect(result).to match(/^ +generate.request_specs false$/)
|
80
|
-
expect(result).to match(/^ +generate.routing_specs false$/)
|
81
|
-
expect(result).to match(/^ +generate.stylesheets false$/)
|
82
|
-
expect(result).to match(/^ +generate.test_framework :rspec/)
|
83
|
-
expect(result).to match(/^ +generate.view_specs false/)
|
84
|
-
end
|
93
|
+
it 'configures generators' do
|
94
|
+
result = IO.read("#{project_path}/config/application.rb")
|
85
95
|
|
86
|
-
|
87
|
-
|
88
|
-
|
96
|
+
expect(result).to match(/^ +generate.helper false$/)
|
97
|
+
expect(result).to match(/^ +generate.javascript_engine false$/)
|
98
|
+
expect(result).to match(/^ +generate.request_specs false$/)
|
99
|
+
expect(result).to match(/^ +generate.routing_specs false$/)
|
100
|
+
expect(result).to match(/^ +generate.stylesheets false$/)
|
101
|
+
expect(result).to match(/^ +generate.test_framework :rspec/)
|
102
|
+
expect(result).to match(/^ +generate.view_specs false/)
|
103
|
+
end
|
89
104
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
105
|
+
it 'removes the default erb layout' do
|
106
|
+
expect(File).not_to exist(
|
107
|
+
"#{project_path}/app/views/layouts/application.html.erb"
|
108
|
+
)
|
109
|
+
end
|
95
110
|
|
96
|
-
|
97
|
-
|
98
|
-
|
111
|
+
it 'configures language in html element' do
|
112
|
+
layout_path = '/app/views/layouts/application.html.haml'
|
113
|
+
layout_file = IO.read("#{project_path}#{layout_path}")
|
114
|
+
expect(layout_file).to match(/%html\{lang: 'en'\}/)
|
115
|
+
end
|
99
116
|
|
100
|
-
|
101
|
-
|
117
|
+
it 'evaluates en.yml.erb' do
|
118
|
+
locales_en_file = IO.read("#{project_path}/config/locales/en.yml")
|
119
|
+
app_name = GimbalTestHelpers::APP_NAME
|
102
120
|
|
103
|
-
|
104
|
-
|
105
|
-
end
|
121
|
+
expect(locales_en_file).to match(/application: #{app_name.humanize}/)
|
122
|
+
end
|
106
123
|
|
107
|
-
|
108
|
-
|
109
|
-
|
124
|
+
it 'adds support file for action mailer' do
|
125
|
+
expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
|
126
|
+
end
|
110
127
|
|
111
|
-
|
112
|
-
|
113
|
-
|
128
|
+
it 'adds support file for factory girl' do
|
129
|
+
expect(File).to exist("#{project_path}/spec/support/factory_girl.rb")
|
130
|
+
end
|
114
131
|
|
115
|
-
|
116
|
-
|
117
|
-
|
132
|
+
it 'adds support file for database cleaner' do
|
133
|
+
expect(File).to exist("#{project_path}/spec/support/database_cleaner.rb")
|
134
|
+
end
|
118
135
|
|
119
|
-
|
120
|
-
|
121
|
-
|
136
|
+
it 'adds support file for database cleaner' do
|
137
|
+
expect(File).to exist("#{project_path}/spec/support/shoulda_matchers.rb")
|
138
|
+
end
|
122
139
|
|
123
|
-
|
124
|
-
|
125
|
-
|
140
|
+
it 'adds support file for i18n' do
|
141
|
+
expect(File).to exist("#{project_path}/spec/support/i18n.rb")
|
142
|
+
end
|
126
143
|
|
127
|
-
|
128
|
-
|
129
|
-
|
144
|
+
it 'adds specs for missing or unused translations' do
|
145
|
+
expect(File).to exist("#{project_path}/spec/i18n_spec.rb")
|
146
|
+
end
|
130
147
|
|
131
|
-
|
132
|
-
|
148
|
+
it 'configs i18n-tasks' do
|
149
|
+
expect(File).to exist("#{project_path}/config/i18n-tasks.yml")
|
150
|
+
end
|
133
151
|
|
134
|
-
|
152
|
+
it 'creates .ruby-version from Gimbal .ruby-version' do
|
153
|
+
ruby_version_file = IO.read("#{project_path}/.ruby-version")
|
154
|
+
|
155
|
+
expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
|
156
|
+
end
|
135
157
|
end
|
136
158
|
end
|
data/templates/Gemfile.erb
CHANGED
@@ -6,6 +6,7 @@ ruby "<%= Gimbal::RUBY_VERSION %>"
|
|
6
6
|
gem "autoprefixer-rails"
|
7
7
|
gem "coffee-rails", "~> 4.1.0"
|
8
8
|
# gem "delayed_job_active_record"
|
9
|
+
# gem "devise"
|
9
10
|
gem "flutie"
|
10
11
|
gem "haml-rails", "~> 0.9"
|
11
12
|
# gem "high_voltage"
|
@@ -38,7 +39,7 @@ group :development, :test do
|
|
38
39
|
gem "factory_girl_rails"
|
39
40
|
gem "i18n-tasks"
|
40
41
|
gem "pry-rails"
|
41
|
-
gem "rspec-rails", "~> 3.
|
42
|
+
gem "rspec-rails", "~> 3.4"
|
42
43
|
end
|
43
44
|
|
44
45
|
group :test do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gimbal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Pascoe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.4'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.4'
|
55
55
|
description: |
|
56
56
|
Based on Suspenders from thoughtbot, Gimbal is a base Rails project I use
|
57
57
|
to streamline the beginning of my Rails projects.
|
@@ -64,8 +64,11 @@ extra_rdoc_files:
|
|
64
64
|
- LICENSE
|
65
65
|
files:
|
66
66
|
- ".gitignore"
|
67
|
+
- ".hound.yml"
|
68
|
+
- ".ruby-style.yml"
|
67
69
|
- ".ruby-version"
|
68
70
|
- ".travis.yml"
|
71
|
+
- CHANGELOG.md
|
69
72
|
- Gemfile
|
70
73
|
- LICENSE
|
71
74
|
- README.md
|