myrails 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8271577d44bf79bc6b19e96c9b242283908ef12f
4
- data.tar.gz: 119e5c959b1aee7aea90bc90a1507070abe3b2f9
3
+ metadata.gz: 71d294e2756c1f51c7aa439017c40cbe9acd134b
4
+ data.tar.gz: 9b64493afaf905a2ffa41ea735a35e50d098145a
5
5
  SHA512:
6
- metadata.gz: 6c5db82ba8f9df9b43280f9a3b3862d92669a0c0f12b695d9329cfd0809227c8eef021f57fad94821f5d51aae0f0e48453c0dcf3c421476caaf6ef8102d3e2c7
7
- data.tar.gz: abeb35220598d18fef4736785cd1ed4d857f9afcac9e017e52a72a9ff5a36f784e7f77ed054ea9520d59f99d537cee9c9c0e4931a662e1c927cb1a7908a95870
6
+ metadata.gz: 279254868738a8e3f44fb2c8344387cee690b190c077f7c06101733d253b3f5e6a01de51b26026ac021527284316ec35938e6c78d86dbb55c4c3957e30d08157
7
+ data.tar.gz: 101f0f0e53a1b3a508aaf8ce2fcc92768aab13f0ba8eb0e64f660770e34b9d206781329cd59f846b439ef24c80bb6ba9cd9297f7d50103e2d19054d551b90d89
data/README.md CHANGED
@@ -5,14 +5,19 @@ This gem was created to make generating rails related files and other rails gem
5
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
6
 
7
7
  ## Disclaimer
8
+
9
+ `user at your own risk!`
10
+
8
11
  This gem is not compatible with ruby 2.3 (yet).
9
12
 
10
13
  ## Notes
14
+
11
15
  Use 1.1.1 if you are primarily developing in rails 3 & 4
12
16
 
13
17
  Use 2.x.x if are primarily developing in rails 5
14
18
 
15
19
  ## Examples
20
+
16
21
  Here is an example of the gem in action:
17
22
 
18
23
  For example, I use pundit. With this gem I am able to run the following:
@@ -64,7 +69,7 @@ simple type `myrails` to see the help menu
64
69
  # Example for generating a presenter class
65
70
  myrails presenter --name=post
66
71
  ```
67
- This generates a PostPresenter class in app/presenters that inherites from app/presenters/base_presenter.rb to be used in views. This also generates a spec/presenters/post_presenter_spec.rb file for testing.
72
+ This generates a PostPresenter class in app/presenters that inherits from app/presenters/base_presenter.rb to be used in views. This also generates a spec/presenters/post_presenter_spec.rb file for testing.
68
73
 
69
74
  ## Development
70
75
 
@@ -0,0 +1 @@
1
+ Footer found in /apps/views/layouts/_footer.html.haml
@@ -13,7 +13,7 @@
13
13
  %ul.nav.navbar-nav.navbar-right
14
14
  -if Rails.env.development?
15
15
  %li
16
- =link_to :UI, '/ui'
16
+ =link_to :UI, '/ui/index'
17
17
  %li
18
18
  =link_to 'Mailer Previews', '/rails/mailers'
19
19
  -#
@@ -4,7 +4,7 @@ module <%= options[:namespace].camelize %>
4
4
  private
5
5
 
6
6
  def <%= options[:name].singularize.downcase %>
7
- @<%= options[:name].singularize %> = <%= options[:name].camelize.singularize %>.find(params[:id]) %>
7
+ @<%= options[:name].singularize %> = <%= options[:name].camelize.singularize %>.find(params[:id])
8
8
  end
9
9
 
10
10
  def <%= options[:name].singularize.downcase %>_params
@@ -1,3 +1,3 @@
1
1
  module Myrails
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
data/lib/myrails.rb CHANGED
@@ -220,7 +220,7 @@ gem 'rspec-rails', group: :test
220
220
  desc 'install_pundit', 'Install pundit gem and generate pundit files and application controller code'
221
221
  def install_pundit
222
222
  insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
223
- gem 'pundit'
223
+ gem 'pundit'
224
224
  CODE
225
225
  end
226
226
 
@@ -232,27 +232,27 @@ gem 'rspec-rails', group: :test
232
232
  run 'bundle update'
233
233
  run 'rails g pundit:install'
234
234
 
235
- inject_into_file 'app/controllers/application_controller.rb', before: '# Prevent CSRF attacks by raising an exception.' do <<-CODE
236
- # Add pundit authorization
237
- include Pundit
235
+ inject_into_file 'app/controllers/application_controller.rb', after: "protect_from_forgery with: :exception\n" do <<-CODE
236
+ # Add pundit authorization
237
+ include Pundit
238
238
  CODE
239
239
  end
240
240
 
241
- inject_into_file 'app/controllers/application_controller.rb', after: "protect_from_forgery with: :exception\n" do <<-CODE
242
- # Rescue from pundit error
243
- # (see #user_not_authorized)
244
- rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
241
+ inject_into_file 'app/controllers/application_controller.rb', after: "rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized\n" do <<-CODE
242
+ # Rescue from pundit error
243
+ # (see #user_not_authorized)
244
+ rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
245
245
  CODE
246
246
  end
247
247
 
248
248
  inject_into_file 'app/controllers/application_controller.rb', after: "private\n" do <<-CODE
249
- # Method to gracefully let a user know they are are not authorized
250
- #
251
- # @return flash [Hash] the action notice
252
- def user_not_authorized
253
- flash[:alert] = "You are not authorized to perform this action."
254
- redirect_to home_path
255
- end
249
+ # Method to gracefully let a user know they are are not authorized
250
+ #
251
+ # @return flash [Hash] the action notice
252
+ def user_not_authorized
253
+ flash[:alert] = "You are not authorized to perform this action."
254
+ redirect_to home_path
255
+ end
256
256
  CODE
257
257
  end
258
258
  end
@@ -308,7 +308,7 @@ gem 'rspec-rails', group: :test
308
308
  run 'bundle install'
309
309
 
310
310
  insert_into_file 'app/controllers/application_controller.rb', before: 'end' do <<-CODE
311
- private
311
+ private
312
312
  CODE
313
313
  end
314
314
  end
@@ -336,7 +336,7 @@ gem 'rspec-rails', group: :test
336
336
  copy_file(themes[idx], "app/assets/stylesheets/#{File.basename(themes[idx])}")
337
337
 
338
338
  inject_into_file 'app/assets/stylesheets/application.css.sass', before: "@import will_paginate" do <<-CODE
339
- @import #{File.basename(themes[idx], '.*')}
339
+ @import #{File.basename(themes[idx], '.*')}
340
340
  CODE
341
341
  end
342
342
  end
@@ -369,6 +369,11 @@ gem 'rspec-rails', group: :test
369
369
  copy_file 'layout/_info_messages.html.haml', 'app/views/layouts/_info_messages.html.haml'
370
370
  copy_file 'layout/_success_message.html.haml', 'app/views/layouts/_success_message.html.haml'
371
371
  copy_file 'layout/_error_messages.html.haml', 'app/views/layouts/_error_messages.html.haml'
372
+ copy_file 'layout/_footer.html.haml', 'app/views/layouts/_footer.html.haml'
373
+ insert_into_file 'app/controllers/application_controller.rb', after: "class ApplicationController < ActionController::Base\n" do <<-CODE
374
+ add_flash_types :error, :success
375
+ CODE
376
+ end
372
377
  end
373
378
 
374
379
  desc 'install_heroku', 'setup application for use with heroku using sqlite3 for development'
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: 2.2.1
4
+ version: 2.2.2
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-21 00:00:00.000000000 Z
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,6 +123,7 @@ files:
123
123
  - lib/myrails/templates/heroku/Procfile
124
124
  - lib/myrails/templates/heroku/puma.rb
125
125
  - lib/myrails/templates/layout/_error_messages.html.haml
126
+ - lib/myrails/templates/layout/_footer.html.haml
126
127
  - lib/myrails/templates/layout/_info_messages.html.haml
127
128
  - lib/myrails/templates/layout/_nav.html.haml
128
129
  - lib/myrails/templates/layout/_success_message.html.haml