myrails 1.1.0 → 1.1.1

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: 6e531e56210489d4c915cd1aadb8190e6d83808c
4
- data.tar.gz: 1c861891a3e79b3f7adb93673a45b4e25713a7fe
3
+ metadata.gz: 9a04c90f6f73bd98b3b33310d9a71372e74e2efb
4
+ data.tar.gz: b9159dadc657a39b1b3b1f300322999822aa2e85
5
5
  SHA512:
6
- metadata.gz: f7dd1cfd092e687b215501755a88b04ea5f0543fc2d72d8912c5d4abc56abf81330ec92edec8d59ab98c87db100b7e61b6f514b679410ee8544202f4ef603bd6
7
- data.tar.gz: 91a4132b81202550c89eb735c6cdec7322200ee1509684a997cf89bb7b3cedb9fb7d6aa00183c337ac63527d90f3c0bbb1ca1bc6cf981c995f510022ca515a86
6
+ metadata.gz: 0f9f840ec9bc1a096584e2606b4f37ed23da9e1abfd6263ff7fa1ed0d99faf5aaff3ffdd30f82bd5edab73e022cb555efd170f928d81550081a8c6fb80962fdf
7
+ data.tar.gz: b4adf482a09d447c1bf985fac4ac07efa1becae4b2bc916e3422e0c3af571b24bd74a0a3e675a963e56b83a45fd8a35a3d31160fd7b82c6fd707d40ceea6743d
data/README.md CHANGED
@@ -4,7 +4,12 @@ This gem was created to make generating rails related files and other rails gem
4
4
 
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
- NOTE: This gem is not compatible with ruby 2.3 (yet).
7
+ ## Disclaimer
8
+
9
+ This gem is not compatible with ruby 2.3 (yet).
10
+
11
+
12
+ ## Examples
8
13
 
9
14
  Here is an example of the gem in action:
10
15
 
@@ -40,14 +45,14 @@ with corresponding files:
40
45
  In your terminal:
41
46
 
42
47
  ```ruby
43
- gem install myrails
48
+ gem install myrails -v 1.1.2
44
49
  ```
45
50
 
46
51
  ## Usage
47
52
 
48
53
  simple type `myrails` to see the help menu
49
54
 
50
- ```
55
+ ```ruby
51
56
  # Example for generating a presenter class
52
57
  myrails presenter --name=post
53
58
  ```
@@ -5,7 +5,7 @@ class <%= options[:name].camelize %>Presenter < BasePresenter
5
5
  # Reference initialized object_presenter as object
6
6
  presents :<%= options[:name]%>
7
7
 
8
- # delegate :attribute, to: :object, allow_nil: true
8
+ # delegate :attribute, to: :<%= options[:name]%>, allow_nil: true
9
9
 
10
10
  # Return concatenated full name
11
11
  def name
@@ -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].singularize %> = <%= options[:name].capitalize%>.find(params[:id]) %>
6
+ @<%= options[:name].singularize %> = <%= options[:name].camelize.signuarlize %>.find(params[:id])
7
7
  end
8
8
 
9
9
  def <%= options[:name].singularize %>_params
@@ -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].capitalize%>.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
@@ -26,10 +26,14 @@ To use authentication bypass use the following for loging in:
26
26
  user = FactoryGirl.create(:user)
27
27
  login_as(user, :scope => :user)
28
28
 
29
- if within a test you need to logout a user use:
30
- logout(:user)
29
+ if within a test you need to sign_out a user use:
30
+ sign_out(:user)
31
31
  =end
32
32
 
33
+ def set_session(user=create(:user))
34
+ login_as(user, :scope => :user)
35
+ end
36
+
33
37
  def sign_in_with(user)
34
38
  click_link 'Sign In'
35
39
  fill_in 'user_email', with: user.email
@@ -1,3 +1,3 @@
1
1
  module Myrails
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/lib/myrails.rb CHANGED
@@ -9,10 +9,7 @@ module Myrails
9
9
  TEMPLATES = source_root
10
10
  ENVIRONMENTS = %w(development test production)
11
11
 
12
- class_option :name
13
- class_option :email
14
-
15
- desc 'model --name=model-name', 'Generates and empty rails model with the given name and its related spec file'
12
+ desc 'model', 'Generates and empty rails model with the given name and its related spec file. Add --namespace=NAME to create a namespaced model'
16
13
  option :name, required: true
17
14
  option :namespace
18
15
  def model
@@ -25,7 +22,7 @@ module Myrails
25
22
  end
26
23
  end
27
24
 
28
- desc 'controller --name=controller-name', 'Generate a rails controller with the given name along with boiler plate code and related spec filet'
25
+ desc 'controller', 'Generate a rails controller with the given name along with boiler plate code and related spec file. Add --namespace=NAME to create namespaced controller'
29
26
  option :name, required: true
30
27
  option :namespace
31
28
  def controller
@@ -41,14 +38,14 @@ module Myrails
41
38
  end
42
39
  end
43
40
 
44
- desc 'policy --name=policy-name', 'Generate a pundit policy with the given name and a related spec file'
41
+ desc 'policy', 'Generate a pundit policy with the given name and a related spec file'
45
42
  option :name, required: true
46
43
  def policy
47
44
  template 'rails/pundit.rb', "app/policies/#{options[:name]}_policy.rb"
48
45
  template 'rspec/pundit.rb', "spec/policies/#{options[:name]}_policy_spec.rb"
49
46
  end
50
47
 
51
- desc 'presenter --name=presenter-name', 'Generate a presenter class with the given name and a related spec file'
48
+ desc 'presenter', 'Generate a presenter class with the given name and a related spec file'
52
49
  option :name, required: true
53
50
  def presenters
54
51
  copy_file 'presenters/base.rb', 'app/presenters/base_presenter.rb'
@@ -57,7 +54,7 @@ module Myrails
57
54
  template 'presenters/presenter_spec.rb', "spec/presenters/#{options[:name]}_presenter_spec.rb"
58
55
  end
59
56
 
60
- desc 'factory --name=factory-name', 'Generate a factory girl factory for use with rspec'
57
+ desc 'factory', 'Generate a factory_girl file for use with rspec'
61
58
  option :name, required: true
62
59
  def factory
63
60
  template 'rspec/factory.rb', "spec/factories/#{options[:name]}.rb"
@@ -76,7 +73,7 @@ module Myrails
76
73
  # Requires an application restart everytime a new page is added.
77
74
  Dir.glob('app/views/ui/*.html.haml').sort.each do |file|
78
75
  action = File.basename(file,'.html.haml')
79
- get "ui/\#{action}", controller: 'ui', action: action
76
+ get \"ui/\#{action}\", controller: 'ui', action: action
80
77
  end
81
78
  CODE
82
79
  end
@@ -100,7 +97,7 @@ gem 'rspec-rails', group: :test
100
97
  copy_file 'rspec/files.rb', 'spec/support/configs/files.rb'
101
98
  end
102
99
 
103
- desc 'install_mailer --email=email@example.com', 'Generate sendgrid initializer and mail interceptor'
100
+ desc 'install_mailer', 'Generate sendgrid initializer and mail interceptor'
104
101
  option :email, required: true
105
102
  def install_mailer
106
103
  copy_file 'mailer/sendgrid.rb', 'config/initializers/sendgrid.rb'
@@ -115,7 +112,7 @@ gem 'rspec-rails', group: :test
115
112
  end
116
113
  end
117
114
 
118
- desc 'config_env --name=host-localhost:3000', 'Add code to environment files. Host refers to url options'
115
+ desc 'config_env', 'Add code to environment files. Host refers to url options. Name option refers to mailer & controller default_url_options'
119
116
  option :name, required: true
120
117
  def config_env
121
118
  ENVIRONMENTS.each do |environment|
@@ -406,7 +403,6 @@ gem 'rspec-rails', group: :test
406
403
  end
407
404
 
408
405
  desc 'new_ui NAME', 'Create a new ui view'
409
- option :name, required: true
410
406
  def new_ui(name)
411
407
  run "touch app/views/ui/#{name}.html.haml"
412
408
  say "DON'T FORGET: Restart Powify App"
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.1.0
4
+ version: 1.1.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-10-13 00:00:00.000000000 Z
11
+ date: 2016-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.5.1
194
+ rubygems_version: 2.4.8
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: A thor backed generator for generating rails related files based on my style