myrails 6.0.0 → 7.0.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/README.md +48 -30
- data/lib/myrails.rb +46 -122
- data/lib/myrails/modules/application_generator_actions.rb +61 -0
- data/lib/myrails/modules/application_generators.rb +80 -0
- data/lib/myrails/modules/assets.rb +28 -2
- data/lib/myrails/modules/bootstrap.rb +16 -12
- data/lib/myrails/modules/capistrano.rb +11 -6
- data/lib/myrails/modules/database_generator.rb +33 -0
- data/lib/myrails/modules/database_generator_actions.rb +18 -0
- data/lib/myrails/modules/devise.rb +11 -5
- data/lib/myrails/modules/dotenv.rb +30 -6
- data/lib/myrails/modules/draper.rb +29 -0
- data/lib/myrails/modules/engine_generator_actions.rb +117 -0
- data/lib/myrails/modules/engine_generators.rb +66 -0
- data/lib/myrails/modules/figaro.rb +18 -2
- data/lib/myrails/modules/gems.rb +7 -2
- data/lib/myrails/modules/heroku.rb +28 -9
- data/lib/myrails/modules/material.rb +23 -13
- data/lib/myrails/modules/pundit.rb +30 -6
- data/lib/myrails/modules/rails_generator_actions.rb +110 -0
- data/lib/myrails/modules/rails_generators.rb +49 -95
- data/lib/myrails/modules/rspec.rb +70 -40
- data/lib/myrails/modules/rspec_generator_actions.rb +56 -0
- data/lib/myrails/modules/rspec_generators.rb +36 -35
- data/lib/myrails/modules/ui.rb +24 -7
- data/lib/myrails/templates/rails/app/assets/javascripts/application.js +0 -4
- data/lib/myrails/templates/rails/app/controllers/controller.rb +6 -6
- data/lib/myrails/templates/rails/app/controllers/namespace_controller.rb +1 -1
- data/lib/myrails/templates/rails/app/decorators/application_decorator.rb +10 -0
- data/lib/myrails/templates/rails/app/decorators/decoration.rb +13 -0
- data/lib/myrails/templates/rails/app/helpers/application_helper.rb +0 -7
- data/lib/myrails/templates/rails/app/mailers/dev_mail_interceptor.rb +1 -1
- data/lib/myrails/templates/rails/app/models/model.rb +1 -1
- data/lib/myrails/templates/rails/app/models/namespace_model.rb +2 -2
- data/lib/myrails/templates/rails/app/policies/pundit.rb +2 -8
- data/lib/myrails/templates/rails/app/presenters/presenter.rb +5 -5
- data/lib/myrails/templates/rails/app/presenters/presenter_spec.rb +4 -4
- data/lib/myrails/templates/rails/app/views/layout/material/footer.html.haml +24 -0
- data/lib/myrails/templates/rails/config/application.example.yml +23 -23
- data/lib/myrails/templates/rails/config/initializers/sendgrid.rb +10 -0
- data/lib/myrails/templates/spec/controller.rb +37 -37
- data/lib/myrails/templates/spec/decorator_spec.rb +16 -0
- data/lib/myrails/templates/spec/factory.rb +1 -1
- data/lib/myrails/templates/spec/feature.rb +2 -2
- data/lib/myrails/templates/spec/helper.rb +1 -1
- data/lib/myrails/templates/spec/model.rb +1 -1
- data/lib/myrails/templates/spec/pundit.rb +5 -4
- data/lib/myrails/templates/spec/request.rb +27 -27
- data/lib/myrails/templates/spec/shared_example.rb +2 -2
- data/lib/myrails/templates/{rails/app/presenters/presenter_config.rb → spec/support/configs/decorator_presenter.rb} +0 -0
- data/lib/myrails/templates/ui/ui_controller.rb +1 -1
- data/lib/myrails/version.rb +1 -1
- data/myrails.gemspec +3 -3
- metadata +24 -15
- data/lib/myrails/modules/application.rb +0 -13
- data/lib/myrails/modules/database.rb +0 -15
- data/lib/myrails/modules/engine.rb +0 -107
- data/lib/myrails/modules/footnotes.rb +0 -19
- data/lib/myrails/templates/rails/app/mailers/sendgrid.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6fd730074c6669bfd1c5bd8689479314e5dfd576f8ae35ce3e83ab33ce34166
|
4
|
+
data.tar.gz: a2d148e81059221440ca418b6efcf1e461ba0c194906a2280bac87b526b9f382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9614cb17e78b3c439617ffe053606453ed29e26b0b0a8a3e2db0de28c016a71ba0d53bbd929c7883d64eb6496399dd1a9d44fc482b21f3e3c3a1f34cd76d48d6
|
7
|
+
data.tar.gz: 15e0c1974ec3ed82c6371c27f871715e7ae0cead5fded1a00e6f79ac2be4fc017fb1d078385c99a83601e5b8a303b3c900cff0ee763ff6a2efeed68bde53950f
|
data/README.md
CHANGED
@@ -1,30 +1,34 @@
|
|
1
|
-
#
|
1
|
+
# MyRails
|
2
2
|
|
3
|
-
|
3
|
+
A library for generating rails related templates and configuring some standard gems (that I use) a lot easier. This was designed with Rails 5 in mind but most of it "should" work with rails 4. An example of the design differences is, a generated model inherit from `ApplicatinoRecord` instead of `ActiveRecord::Base`
|
4
4
|
|
5
|
-
This
|
5
|
+
This library is not endorsed by the Rails core team. I wrote it as a convenience for generating code that I would otherwise have written by hand or would have had to manage with code snippets (I use more than one editor)
|
6
6
|
|
7
7
|
## Disclaimer
|
8
8
|
|
9
|
-
`
|
9
|
+
`Use at your own risk!` I am not responsible for any issues that come from using this library. If you are not sure it will work for you, install it on a vagrant vm and give it a try there. You can even use the Vagrantfile that is in this repo to take care of configuring a useable vm.
|
10
|
+
|
11
|
+
This does not work with the windows environment
|
10
12
|
|
11
13
|
## Notes
|
12
14
|
|
13
|
-
Use
|
15
|
+
Use v1.1.1 if you are primarily developing in rails 3 & 4
|
14
16
|
|
15
|
-
Use the latest version if are primarily developing in rails 5
|
17
|
+
Use the latest version if you are primarily developing in rails 5
|
16
18
|
|
17
|
-
##
|
19
|
+
## Requirements
|
18
20
|
|
19
|
-
|
21
|
+
Ruby 2.2 and above
|
20
22
|
|
21
|
-
|
23
|
+
## Examples
|
24
|
+
|
25
|
+
A gem I use often is pundit. With this library I can generate a policy along with an RSpec pundit matcher file to test the policy with. I am able to run the following:
|
22
26
|
|
23
27
|
```ruby
|
24
|
-
myrails policy
|
28
|
+
myrails kickstart policy article
|
25
29
|
```
|
26
30
|
|
27
|
-
which outputs:
|
31
|
+
which outputs something like:
|
28
32
|
|
29
33
|
```
|
30
34
|
create app/policies/article_policy.rb
|
@@ -44,39 +48,34 @@ with corresponding files:
|
|
44
48
|
└── article_policy_spec.rb
|
45
49
|
```
|
46
50
|
|
47
|
-
Inside app/policies/articles_policy.rb is boiler plate code like:
|
51
|
+
Inside app/policies/articles_policy.rb is boiler plate code (something like):
|
48
52
|
|
49
|
-
```
|
53
|
+
```ruby
|
50
54
|
class ArticlePolicy < ApplicationPolicy
|
51
|
-
|
55
|
+
|
52
56
|
def new?
|
53
57
|
true
|
54
58
|
end
|
55
59
|
|
56
|
-
# Allows owner to edit Article
|
57
60
|
def edit?
|
58
61
|
user == record.user
|
59
62
|
end
|
60
63
|
|
61
|
-
# Allows all users to create Article
|
62
64
|
alias_method :create?, :new?
|
63
65
|
|
64
|
-
# Allows all users to view Article
|
65
66
|
alias_method :show?, :new?
|
66
67
|
|
67
|
-
# Allows owner to update an Article
|
68
68
|
alias_method :update?, :edit?
|
69
69
|
|
70
|
-
# Allows owner to remove an Article
|
71
70
|
alias_method :destroy?, :edit?
|
72
71
|
end
|
73
72
|
```
|
74
73
|
|
75
|
-
Inside the spec/policies/articles_policy_spec.rb is boiler plate code like:
|
74
|
+
Inside the spec/policies/articles_policy_spec.rb is boiler plate code (something like):
|
76
75
|
|
77
|
-
```
|
78
|
-
# Use with Pundit Matches: https://github.com/chrisalley/pundit-matchers
|
76
|
+
```ruby
|
79
77
|
require 'rails_helper'
|
78
|
+
|
80
79
|
describe ArticlePolicy do
|
81
80
|
subject { ArticlePolicy.new(user, article) }
|
82
81
|
|
@@ -107,15 +106,17 @@ end
|
|
107
106
|
|
108
107
|
## Installation
|
109
108
|
|
110
|
-
In
|
109
|
+
In the terminal:
|
111
110
|
|
112
|
-
|
113
|
-
# For development in rails 3 & 4 primarily
|
111
|
+
### For use with Rails 3 & 4
|
114
112
|
|
113
|
+
```ruby
|
115
114
|
gem install myrails -v 1.1.1
|
115
|
+
```
|
116
116
|
|
117
|
-
|
117
|
+
### For use with Rails 5
|
118
118
|
|
119
|
+
```ruby
|
119
120
|
gem install myrails
|
120
121
|
```
|
121
122
|
|
@@ -123,17 +124,34 @@ gem install myrails
|
|
123
124
|
|
124
125
|
Simply type `myrails` to see the help menu
|
125
126
|
|
127
|
+
The current options available are:
|
128
|
+
|
129
|
+
* db - Rails database options
|
130
|
+
* engine (aliase e) - Rails engine options
|
131
|
+
* install (aliase i) - Rails gems and configuration options
|
132
|
+
* kickstart (aliase ks) - Rails template generation options
|
133
|
+
* spec (aliase s) - RSpec template generation options
|
134
|
+
* setup_sendgrid - Install sendgrid initializer with mail interceptor
|
135
|
+
|
136
|
+
Every option also has a help menu. For instance, specifying `myrails kickstart` will display something like:
|
137
|
+
|
126
138
|
```ruby
|
127
|
-
|
128
|
-
myrails
|
139
|
+
ERROR: "myrails kickstart" was called with no arguments
|
140
|
+
Usage: "myrails kickstart <OPTION> <NAME>"
|
141
|
+
Available Options:
|
142
|
+
* controller: Generate rails controller with corresponding RSpec file
|
143
|
+
* decorator: Generate draper decorator with corresponding RSpec file
|
144
|
+
* factory: Generate factory[girl|bot] factory
|
145
|
+
* model: Generate rails model with corresponding RSpec file
|
146
|
+
* policy: Generate pundit policy with corresponding RSpec file
|
147
|
+
* ui: Generate a ui file for mocking front end
|
129
148
|
```
|
130
|
-
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.
|
131
149
|
|
132
150
|
## Development
|
133
151
|
|
134
152
|
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.
|
135
153
|
|
136
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
154
|
+
To install this gem onto your local machine, run `bundle exec rake build` then `bundle exec rake install`.
|
137
155
|
|
138
156
|
## Releasing
|
139
157
|
To release a new version,
|
data/lib/myrails.rb
CHANGED
@@ -6,160 +6,84 @@ require_relative 'myrails/modules/bootstrap'
|
|
6
6
|
require_relative 'myrails/modules/material'
|
7
7
|
require_relative 'myrails/modules/ui'
|
8
8
|
require_relative 'myrails/modules/assets'
|
9
|
-
require_relative 'myrails/modules/
|
9
|
+
require_relative 'myrails/modules/application_generators'
|
10
|
+
require_relative 'myrails/modules/application_generator_actions'
|
10
11
|
require_relative 'myrails/modules/capistrano'
|
11
|
-
require_relative 'myrails/modules/
|
12
|
+
require_relative 'myrails/modules/database_generator'
|
13
|
+
require_relative 'myrails/modules/database_generator_actions'
|
12
14
|
require_relative 'myrails/modules/devise'
|
13
15
|
require_relative 'myrails/modules/dotenv'
|
14
|
-
require_relative 'myrails/modules/
|
16
|
+
require_relative 'myrails/modules/draper'
|
17
|
+
require_relative 'myrails/modules/engine_generators'
|
18
|
+
require_relative 'myrails/modules/engine_generator_actions'
|
15
19
|
require_relative 'myrails/modules/figaro'
|
16
|
-
require_relative 'myrails/modules/footnotes'
|
17
20
|
require_relative 'myrails/modules/heroku'
|
18
21
|
require_relative 'myrails/modules/pundit'
|
19
22
|
require_relative 'myrails/modules/rails_generators'
|
23
|
+
require_relative 'myrails/modules/rails_generator_actions'
|
20
24
|
require_relative 'myrails/modules/rspec_generators'
|
25
|
+
require_relative 'myrails/modules/rspec_generator_actions'
|
21
26
|
require_relative 'myrails/modules/rspec'
|
27
|
+
|
22
28
|
module Myrails
|
23
29
|
class Myrails < Thor
|
24
30
|
include Thor::Actions
|
31
|
+
|
25
32
|
source_root "#{__dir__}/myrails/templates"
|
33
|
+
|
26
34
|
TEMPLATES = source_root
|
27
|
-
ENVIRONMENTS = %w(development test production)
|
28
35
|
|
29
36
|
no_tasks do
|
30
37
|
include Install::Gems
|
31
38
|
include Install::Ui
|
32
|
-
include Install::ApplicationHelper
|
33
39
|
include Install::RSpec
|
34
40
|
include Install::Devise
|
35
41
|
include Install::Pundit
|
36
|
-
include Install::Footnotes
|
37
42
|
include Install::DotEnv
|
38
43
|
include Install::Heroku
|
39
44
|
include Install::Capistrano
|
40
45
|
include Install::Assets
|
41
46
|
include Install::Figaro
|
47
|
+
include Install::Draper
|
42
48
|
include Layout::Bootstrap
|
43
49
|
include Layout::Material
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
if answer =~ /^B|b/
|
54
|
-
install_bootstrap
|
55
|
-
elsif answer =~ /^M|m/
|
56
|
-
install_material
|
57
|
-
end
|
58
|
-
|
59
|
-
insert_into_file 'app/controllers/application_controller.rb', after: "class ApplicationController < ActionController::Base\n" do <<-CODE
|
60
|
-
add_flash_types :error, :success
|
61
|
-
CODE
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
desc 'git_init', "Initialize git with some files automatically ignored"
|
66
|
-
def git_init
|
67
|
-
run 'git init'
|
68
|
-
run 'echo /coverage >> .gitignore'
|
69
|
-
run 'echo /config/application.yml >> .gitignore'
|
70
|
-
run 'git add --all'
|
71
|
-
run "git commit -m 'initial commit'"
|
72
|
-
end
|
73
|
-
|
74
|
-
desc 'base_install', 'Run the most common actions in the right order'
|
75
|
-
def base_install
|
76
|
-
install_gems
|
77
|
-
install_application_helper
|
78
|
-
install_assets
|
79
|
-
install_layout
|
80
|
-
install_css
|
81
|
-
install_footer
|
82
|
-
install_ui
|
83
|
-
install_pundit
|
84
|
-
install_rspec
|
85
|
-
install_footnotes
|
86
|
-
config_env
|
87
|
-
install_figaro
|
88
|
-
git_init
|
89
|
-
say 'Dont forget to run config_env'
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
# end of no_tasks
|
50
|
+
include Rails::Generator::Actions
|
51
|
+
include RSpec::Generator::Actions
|
52
|
+
include Engine::Generator::Actions
|
53
|
+
include Database::Generator::Actions
|
54
|
+
include Application::Generator::Actions
|
55
|
+
|
56
|
+
end # end of no_tasks
|
57
|
+
|
58
|
+
|
94
59
|
include Rails::Generators
|
95
60
|
include RSpec::Generators
|
96
|
-
include
|
97
|
-
include
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
say 'Usage: "myrails install NAME"'
|
121
|
-
say "Available Options:\n"
|
122
|
-
options.each{|k,v| say "* #{k}: #{v}"}
|
123
|
-
exit
|
124
|
-
end
|
125
|
-
|
126
|
-
case name
|
127
|
-
when 'application_helper'
|
128
|
-
install_application_helper
|
129
|
-
when 'gems'
|
130
|
-
install_gems
|
131
|
-
when 'layout'
|
132
|
-
install_layout
|
133
|
-
when 'ui'
|
134
|
-
install_ui
|
135
|
-
when 'pundit'
|
136
|
-
install_pundit
|
137
|
-
install_rails_helper
|
138
|
-
when 'rspec'
|
139
|
-
install_rspec
|
140
|
-
when 'footnotes'
|
141
|
-
install_footnotes
|
142
|
-
when 'base'
|
143
|
-
base_install
|
144
|
-
when 'git'
|
145
|
-
git_init
|
146
|
-
when 'heroku'
|
147
|
-
install_heroku
|
148
|
-
when 'devise'
|
149
|
-
install_devise
|
150
|
-
when 'dotenv'
|
151
|
-
install_dotenv
|
152
|
-
when 'capistrano'
|
153
|
-
install_capistrano
|
154
|
-
when 'figaro'
|
155
|
-
install_figaro
|
156
|
-
when 'env_config'
|
157
|
-
config_env
|
158
|
-
else
|
159
|
-
say "Unknown Action! #{name}"
|
61
|
+
include Engine::Generators
|
62
|
+
include Database::Generators
|
63
|
+
include Application::Generators
|
64
|
+
|
65
|
+
# Moved here because it envokes draper kickstart method for some reason.
|
66
|
+
# Will address later.
|
67
|
+
desc 'setup_sendgrid', 'Generate sendgrid initializer and mail interceptor'
|
68
|
+
def setup_sendgrid
|
69
|
+
environments = %w(development test production)
|
70
|
+
|
71
|
+
@email = ask 'What email address would you like to use?', :yellow
|
72
|
+
|
73
|
+
raise ArgumentError, 'Email address required' unless @email
|
74
|
+
|
75
|
+
copy_file 'rails/config/initializers/sendgrid.rb', 'config/initializers/sendgrid.rb'
|
76
|
+
template 'rails/app/mailers/dev_mail_interceptor.rb', 'app/mailers/dev_mail_interceptor.rb'
|
77
|
+
|
78
|
+
environments.each do |environment|
|
79
|
+
unless environment == 'production'
|
80
|
+
inject_into_file "config/environments/#{environment}.rb", after: "Rails.application.configure do\n" do <<-CODE
|
81
|
+
ActionMailer::Base.register_interceptor(DevMailInterceptor)
|
82
|
+
CODE
|
83
|
+
end
|
84
|
+
end
|
160
85
|
end
|
161
86
|
end
|
162
|
-
|
163
87
|
|
164
88
|
end
|
165
89
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Application
|
2
|
+
module Generator
|
3
|
+
module Actions
|
4
|
+
def self.included(thor)
|
5
|
+
thor.class_eval do
|
6
|
+
|
7
|
+
desc 'setup_application_helper', 'overwrite rails application helper with some default code'
|
8
|
+
def setup_application_helper
|
9
|
+
copy_file 'rails/app/helpers/application_helper.rb', 'app/helpers/application_helper.rb'
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'setup_layout', 'Generate JS and CSS files with a choice of CSS Framework'
|
13
|
+
def setup_layout
|
14
|
+
answer = ask 'Would you like to use [B]ootstrap or [M]aterial? Default: ', :yellow, default: 'M'
|
15
|
+
|
16
|
+
run 'rm app/views/layouts/application.html.erb'
|
17
|
+
|
18
|
+
setup_assets
|
19
|
+
|
20
|
+
if answer =~ /^B|b/
|
21
|
+
setup_bootstrap
|
22
|
+
elsif answer =~ /^M|m/
|
23
|
+
setup_material
|
24
|
+
end
|
25
|
+
|
26
|
+
insert_into_file 'app/controllers/application_controller.rb', after: "class ApplicationController < ActionController::Base\n" do <<-CODE
|
27
|
+
add_flash_types :error, :success
|
28
|
+
CODE
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'setup_git', "Initialize git with some files set to be ignored"
|
33
|
+
def setup_git
|
34
|
+
run 'git init' unless File.exist?('.git')
|
35
|
+
run 'echo /coverage >> .gitignore'
|
36
|
+
run 'echo /config/application.yml >> .gitignore'
|
37
|
+
run 'git add --all'
|
38
|
+
run "git commit -m 'initial commit'"
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'base_setup', 'Run the most common setup actions in the right order'
|
42
|
+
def base_setup
|
43
|
+
setup_gems
|
44
|
+
setup_application_helper
|
45
|
+
setup_layout
|
46
|
+
setup_ui
|
47
|
+
setup_pundit
|
48
|
+
setup_draper
|
49
|
+
setup_rspec
|
50
|
+
config_env
|
51
|
+
setup_figaro
|
52
|
+
setup_git
|
53
|
+
say 'Dont forget to run setup config/application.yml with initial values.'
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Application
|
2
|
+
module Generators
|
3
|
+
def self.included(thor)
|
4
|
+
thor.class_eval do
|
5
|
+
|
6
|
+
desc 'install NAME', 'Install customizations to configure application quickly. Type `myrails install` for options'
|
7
|
+
def install(name=nil)
|
8
|
+
options = {
|
9
|
+
app_helper: 'Overwrite default application helper with a custom helper',
|
10
|
+
base: 'Run through all options listed in this list',
|
11
|
+
capistrano: 'Generate capistrano with default deployment',
|
12
|
+
devise: 'Generate and configure Devise gem',
|
13
|
+
dotenv: 'Generate and configure Dotenv gem (Do not use if figaro is already installed)',
|
14
|
+
draper: 'Generate and configure Draper gem',
|
15
|
+
env_config: 'Configure environment files with default hosts etc.',
|
16
|
+
figaro: 'Generate and configure Figaro Gem (Do not use if dotenv is already installed)',
|
17
|
+
gems: 'Install default gem set',
|
18
|
+
git: 'Generate git directory and ignore default files',
|
19
|
+
heroku: 'Generate needed setup for Heroku deployment',
|
20
|
+
layout: 'Generate assets and custom styles using either Boostrap or Material',
|
21
|
+
pundit: 'Install and configure Pundit gem',
|
22
|
+
rspec: 'Install and configure Rspec gem',
|
23
|
+
# sendgrid: 'Install and configure ActionMailer to use sendgrid',
|
24
|
+
ui: 'Generate UI resource'
|
25
|
+
}
|
26
|
+
|
27
|
+
unless name
|
28
|
+
say 'ERROR: "myrails install" was called with no arguments'
|
29
|
+
say 'Usage: "myrails install NAME"'
|
30
|
+
say "Available Options:\n"
|
31
|
+
options.each{|k,v| say "* #{k}: #{v}"}
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
|
35
|
+
case name
|
36
|
+
when 'app_helper'
|
37
|
+
setup_application_helper
|
38
|
+
when 'gems'
|
39
|
+
setup_gems
|
40
|
+
when 'layout'
|
41
|
+
setup_layout
|
42
|
+
when 'ui'
|
43
|
+
setup_ui
|
44
|
+
when 'pundit'
|
45
|
+
setup_pundit
|
46
|
+
setup_rails_helper
|
47
|
+
when 'rspec'
|
48
|
+
setup_rspec
|
49
|
+
when 'base'
|
50
|
+
base_setup
|
51
|
+
when 'git'
|
52
|
+
setup_git
|
53
|
+
when 'heroku'
|
54
|
+
setup_heroku
|
55
|
+
when 'devise'
|
56
|
+
setup_devise
|
57
|
+
when 'dotenv'
|
58
|
+
setup_dotenv
|
59
|
+
when 'capistrano'
|
60
|
+
setup_capistrano
|
61
|
+
when 'figaro'
|
62
|
+
setup_figaro
|
63
|
+
when 'env_config'
|
64
|
+
config_env
|
65
|
+
when 'draper',
|
66
|
+
setup_draper
|
67
|
+
# when 'sendgrid'
|
68
|
+
# setup_sendgrid
|
69
|
+
else
|
70
|
+
say "Unknown Action! #{name}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'i', 'Install shortcut'
|
75
|
+
alias_method :i, :install
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|