myrails 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/lib/myrails/templates/rails/controller.rb +1 -1
- data/lib/myrails/templates/rspec/router.rb +1 -1
- data/lib/myrails/version.rb +1 -1
- data/lib/myrails.rb +34 -30
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23c01d29604ec2394d097386744bcc2afb1c4efa
|
4
|
+
data.tar.gz: 5a2a3c28899cdf8fd6ad9b18f6ba07c2cdef5aeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4da573dddca6f48725868341a395703b7caef3c99837476e7b91a78b1a8a8e8cac2384a8e0c584addadcefaf2c0909cb34ed921033583dc86184a0abf9f01881
|
7
|
+
data.tar.gz: c28fef380ac5c780e83eec6260559ec2b7e3dd17d39e8fb0d20014ebc7a3ed5a9a2c255f9595989510ca6c061f1cadbe9dfb55b91ac6c7d20449599f2b421a0e
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
This gem was created to make generating rails related files and other rails gem files (that I use) a lot easier. It is a thor backed gem that was designed with rails 5 in mind but most of it "should" work with rails 4.
|
4
4
|
|
5
|
-
This gem is not endorsed by 37signals. I wrote it as a convenience for
|
5
|
+
This gem is not endorsed by 37signals. I wrote it as a convenience for generating files that I would otherwise have written by hand.
|
6
|
+
|
7
|
+
NOTE: This gem is not compatible with ruby 2.3 (yet).
|
6
8
|
|
7
9
|
Here is an example of the gem in action:
|
8
10
|
|
@@ -55,10 +57,13 @@ This generates a PostPresenter class in app/presenters that inherites from app/p
|
|
55
57
|
|
56
58
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
57
59
|
|
58
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
60
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
61
|
+
|
62
|
+
## Releasing
|
63
|
+
To release a new version,
|
59
64
|
* update the version number in `version.rb`
|
60
65
|
* tag the the code `git tag v1.0.0`
|
61
|
-
*
|
66
|
+
* push the tag `git push --tags`
|
62
67
|
* then run `bundle exec rake build`
|
63
68
|
* `gem push pkg/myrails-verion`
|
64
69
|
|
@@ -3,7 +3,7 @@ class <%= options[:name].pluralize.camelize %>Controller < ApplicationController
|
|
3
3
|
private
|
4
4
|
|
5
5
|
def <%= options[:name].singularize %>
|
6
|
-
@<%= options[:name] %> =
|
6
|
+
@<%= options[:name].singularize %> = <%= options[:name].capitalize%>.find(params[:id])
|
7
7
|
end
|
8
8
|
|
9
9
|
def <%= options[:name].singularize %>_params
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Controller test doesn't seem to use default url option when redirecting to an associated record. Uses http://test.com. This is an attmept to unify this and capybara which uses http://www.example.com.
|
2
2
|
# Add this method to the before action of any controller specs that needed it. Found it useful to use this when using shared examples.
|
3
3
|
RSpec.configure do |config|
|
4
|
-
config.before
|
4
|
+
config.before :each, type: :controller do
|
5
5
|
@request.host = 'localhost:3000'
|
6
6
|
end
|
7
7
|
end
|
data/lib/myrails/version.rb
CHANGED
data/lib/myrails.rb
CHANGED
@@ -49,27 +49,32 @@ module Myrails
|
|
49
49
|
template 'rspec/factory.rb', "spec/factories/#{options[:name]}.rb"
|
50
50
|
end
|
51
51
|
|
52
|
-
desc '
|
53
|
-
def
|
52
|
+
desc 'install_application_helper', 'Replace current application helper with one that has commonly used code'
|
53
|
+
def install_application_helper
|
54
54
|
copy_file 'rails/application_helper.rb', 'app/helpers/application_helper.rb'
|
55
55
|
end
|
56
56
|
|
57
|
-
desc '
|
58
|
-
def
|
57
|
+
desc 'install_ui', 'Generate UI files and code for prototyping views in app/views/ui'
|
58
|
+
def install_ui
|
59
59
|
copy_file 'ui/ui_controller.rb', 'app/controllers/ui_controller.rb'
|
60
60
|
copy_file 'ui/index.html.haml', 'app/views/ui/index.html.haml'
|
61
61
|
inject_into_file 'config/routes.rb', after: "Rails.application.routes.draw do\n" do <<-CODE
|
62
62
|
# Requires an application restart everytime a new page is added.
|
63
63
|
Dir.glob('app/views/ui/*.html.haml').sort.each do |file|
|
64
64
|
action = File.basename(file,'.html.haml')
|
65
|
-
get "ui
|
65
|
+
get "ui/\#{action}", controller: 'ui', action: action
|
66
66
|
end
|
67
67
|
CODE
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
desc '
|
72
|
-
def
|
71
|
+
desc 'install_rspec', 'Generate rspec structure & rspec configuration that I commonly use'
|
72
|
+
def install_rspec
|
73
|
+
insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
|
74
|
+
gem 'rspec-rails', group: :test
|
75
|
+
CODE
|
76
|
+
end
|
77
|
+
run 'bundle install'
|
73
78
|
run 'rails g rspec:install'
|
74
79
|
copy_file 'rspec/database_cleaner.rb', "spec/support/configs/database_cleaner.rb"
|
75
80
|
copy_file 'rspec/factory_girl.rb', 'spec/support/configs/factory_girl.rb'
|
@@ -81,9 +86,9 @@ module Myrails
|
|
81
86
|
copy_file 'rspec/files.rb', 'spec/support/configs/files.rb'
|
82
87
|
end
|
83
88
|
|
84
|
-
desc '
|
89
|
+
desc 'install_mailer --email=email@example.com', 'Generate sendgrid initializer and mail interceptor'
|
85
90
|
option :email, required: true
|
86
|
-
def
|
91
|
+
def install_mailer
|
87
92
|
copy_file 'mailer/sendgrid.rb', 'config/initializers/sendgrid.rb'
|
88
93
|
template 'mailer/dev_mail_interceptor.rb', 'app/mailers/dev_mail_interceptor.rb'
|
89
94
|
ENVIRONMENTS.each do |environment|
|
@@ -130,8 +135,8 @@ module Myrails
|
|
130
135
|
end
|
131
136
|
end
|
132
137
|
|
133
|
-
desc '
|
134
|
-
def
|
138
|
+
desc 'install_rails_helper', 'Add code to rspec/rails_helper so rspec runs the way I like'
|
139
|
+
def install_rails_helper
|
135
140
|
inject_into_file "spec/rails_helper.rb", after: "require 'rspec/rails'\n" do <<-CODE
|
136
141
|
require 'simplecov'
|
137
142
|
SimpleCov.start
|
@@ -154,8 +159,8 @@ module Myrails
|
|
154
159
|
end
|
155
160
|
end
|
156
161
|
|
157
|
-
desc '
|
158
|
-
def
|
162
|
+
desc 'install_devise', 'Generate devise files'
|
163
|
+
def install_devise
|
159
164
|
insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
|
160
165
|
gem 'devise', '~> 4.2.0'
|
161
166
|
CODE
|
@@ -201,8 +206,8 @@ module Myrails
|
|
201
206
|
end
|
202
207
|
end
|
203
208
|
|
204
|
-
desc '
|
205
|
-
def
|
209
|
+
desc 'install_pundit', 'Install pundit gem and generate pundit files and application controller code'
|
210
|
+
def install_pundit
|
206
211
|
insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
|
207
212
|
gem 'pundit'
|
208
213
|
CODE
|
@@ -241,8 +246,8 @@ module Myrails
|
|
241
246
|
end
|
242
247
|
end
|
243
248
|
|
244
|
-
desc '
|
245
|
-
def
|
249
|
+
desc 'install_footnotes', 'Install rails-footnotes and run its generator'
|
250
|
+
def install_footnotes
|
246
251
|
insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
|
247
252
|
gem 'rails-footnotes'
|
248
253
|
CODE
|
@@ -251,11 +256,10 @@ module Myrails
|
|
251
256
|
run 'rails generate rails_footnotes:install'
|
252
257
|
end
|
253
258
|
|
254
|
-
desc '
|
255
|
-
def
|
259
|
+
desc 'install_gems', 'Add & Install gems that I commonly use'
|
260
|
+
def install_gems
|
256
261
|
insert_into_file 'Gemfile', before: "group :development, :test do" do <<-CODE
|
257
262
|
group :test do
|
258
|
-
gem 'rspec-rails'
|
259
263
|
gem 'simplecov'
|
260
264
|
gem 'shoulda-matchers'
|
261
265
|
gem 'factory_girl_rails'
|
@@ -298,8 +302,8 @@ module Myrails
|
|
298
302
|
end
|
299
303
|
end
|
300
304
|
|
301
|
-
desc '
|
302
|
-
def
|
305
|
+
desc 'install_assets', 'Generate common asset pipeline files'
|
306
|
+
def install_assets
|
303
307
|
run "rm app/assets/stylesheets/application.css"
|
304
308
|
copy_file 'assets/application.css.sass', 'app/assets/stylesheets/application.css.sass'
|
305
309
|
copy_file 'assets/application.js', 'app/assets/javascripts/application.js'
|
@@ -308,8 +312,8 @@ module Myrails
|
|
308
312
|
end
|
309
313
|
|
310
314
|
|
311
|
-
desc '
|
312
|
-
def
|
315
|
+
desc 'install_css', 'Generate & include application css theme'
|
316
|
+
def install_css
|
313
317
|
themes = Dir[File.join(TEMPLATES, 'assets', 'bootstrap_themes', '*')]
|
314
318
|
|
315
319
|
themes.each_with_index do |theme, index|
|
@@ -326,8 +330,8 @@ module Myrails
|
|
326
330
|
end
|
327
331
|
end
|
328
332
|
|
329
|
-
desc '
|
330
|
-
def
|
333
|
+
desc 'install_footer', 'Generate & include application footer'
|
334
|
+
def install_footer
|
331
335
|
footers = Dir[File.join(TEMPLATES, 'layout', 'footers', '*.haml')]
|
332
336
|
footers_css = Dir[File.join(TEMPLATES, 'layout', 'footers', 'css', '*')]
|
333
337
|
|
@@ -346,8 +350,8 @@ module Myrails
|
|
346
350
|
end
|
347
351
|
end
|
348
352
|
|
349
|
-
desc '
|
350
|
-
def
|
353
|
+
desc 'install_layout', 'Generate common layout files'
|
354
|
+
def install_layout
|
351
355
|
run 'rm app/views/layouts/application.html.erb'
|
352
356
|
template 'layout/application.html.haml', 'app/views/layouts/application.html.haml'
|
353
357
|
template 'layout/_nav.html.haml', 'app/views/layouts/_nav.html.haml'
|
@@ -356,8 +360,8 @@ module Myrails
|
|
356
360
|
copy_file 'layout/_error_messages.html.haml', 'app/views/layouts/_error_messages.html.haml'
|
357
361
|
end
|
358
362
|
|
359
|
-
desc '
|
360
|
-
def
|
363
|
+
desc 'install_heroku', 'setup application for use with heroku using sqlite3 for development'
|
364
|
+
def install_heroku
|
361
365
|
insert_into_file 'Gemfile', before: "group :development, :test do\n" do <<-CODE
|
362
366
|
group :production do
|
363
367
|
gem 'pg'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
188
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.4.8
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: A thor backed generator for generating rails related files based on my style
|