mecha 0.7.0 → 0.7.1
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 +0 -4
- data/lib/mecha/generators/app/app_generator.rb +1 -0
- data/lib/mecha/generators/tests/templates/spec/rails_helper.rb +1 -3
- data/lib/mecha/generators/tests/templates/spec/spec_helper.rb +2 -0
- data/lib/mecha/generators/tests/tests_generator.rb +3 -4
- data/lib/mecha/version.rb +1 -1
- data/lib/mecha.rb +12 -16
- metadata +1 -4
- data/TODO.md +0 -9
- data/lib/mecha/generators/heroku/heroku_generator.rb +0 -99
- data/lib/mecha/generators/heroku/templates/app.json +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a4e29b4c74905c93a270be44a622235a92968ee
|
4
|
+
data.tar.gz: 35a26b279798229fdeb062ef971b186c65b73c82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4650b52a9e1a860708eabab763d97c28b9b444add5c4b8ad1d7d08e1b5b483b263eff1a856a8439fa8b1913c82e2dfe72d485c858c9ebf74c660503f2698715
|
7
|
+
data.tar.gz: 691169b91a9f6d0cdf3db2dbc219ac6edeeb7e929f6c2e0b74540a1af6c8baf55db2591d4cef6f9a47e95a194d03254108c761e50335df2fc0fd3033430b2780
|
data/README.md
CHANGED
@@ -55,10 +55,6 @@ variable with you DSN key. `ENV['DNS']`.
|
|
55
55
|
|
56
56
|
`--simplecov` installs Simplecov and adds configs to `test/test_helper.rb`.
|
57
57
|
|
58
|
-
**Heroku**
|
59
|
-
|
60
|
-
`--heroku` configure Heroku Pipeline with staging and production environments, and `--org` if you want to configure the project in a Heroku Org.
|
61
|
-
|
62
58
|
## Development
|
63
59
|
|
64
60
|
Run `rake test` or simply just `rake` to run tests.
|
@@ -6,6 +6,7 @@ module Mecha
|
|
6
6
|
module Generators
|
7
7
|
class AppGenerator < Rails::Generators::AppGenerator
|
8
8
|
class_option :database, type: :string, default: 'postgresql'
|
9
|
+
class_option :webpack, type: :string, default: 'react'
|
9
10
|
class_option :skip_coffee, type: :boolean, default: true
|
10
11
|
class_option :skip_turbolinks, type: :boolean, default: true
|
11
12
|
|
@@ -1,9 +1,7 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
ENV['RAILS_ENV'] ||= 'test'
|
2
|
-
|
3
3
|
require File.expand_path('../../config/environment', __FILE__)
|
4
4
|
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
5
|
-
|
6
|
-
require 'spec_helper'
|
7
5
|
require 'rspec/rails'
|
8
6
|
|
9
7
|
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
@@ -18,6 +18,8 @@ RSpec.configure do |config|
|
|
18
18
|
mocks.verify_partial_doubles = true
|
19
19
|
end
|
20
20
|
|
21
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
22
|
+
|
21
23
|
config.filter_run_when_matching :focus
|
22
24
|
config.disable_monkey_patching!
|
23
25
|
config.default_formatter = 'doc' if config.files_to_run.one?
|
@@ -13,7 +13,6 @@ module Mecha
|
|
13
13
|
gem 'timecop'
|
14
14
|
gem 'vcr'
|
15
15
|
gem 'webmock'
|
16
|
-
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
@@ -38,9 +37,9 @@ module Mecha
|
|
38
37
|
run('spring stop')
|
39
38
|
generate('rspec:install')
|
40
39
|
empty_directory('spec/support')
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
copy_file('spec/support/factory_bot.rb', 'spec/support/factory_bot.rb', force: true)
|
41
|
+
copy_file('spec/rails_helper.rb', 'spec/rails_helper.rb', force: true)
|
42
|
+
copy_file('spec/spec_helper.rb', 'spec/spec_helper.rb', force: true)
|
44
43
|
remove_file('test')
|
45
44
|
end
|
46
45
|
|
data/lib/mecha/version.rb
CHANGED
data/lib/mecha.rb
CHANGED
@@ -14,11 +14,11 @@ require 'mecha/generators/sentry/sentry_generator'
|
|
14
14
|
require 'mecha/generators/cpf_cnpj/cpf_cnpj_generator'
|
15
15
|
require 'mecha/generators/danger/danger_generator'
|
16
16
|
require 'mecha/generators/pronto/pronto_generator'
|
17
|
-
# require 'mecha/generators/heroku/heroku_generator'
|
18
17
|
|
19
18
|
module Mecha
|
20
19
|
def self.opts
|
21
20
|
Slop.parse do |o|
|
21
|
+
o.bool '--webpack', 'pass the webpack option for rails'
|
22
22
|
o.bool '--bitbucket-pipelines', 'config Bitbucket Pipelines'
|
23
23
|
o.bool '--cpf_cnpj', 'install and config CPF/CNPJ'
|
24
24
|
o.bool '--danger', 'install and config Danger'
|
@@ -27,8 +27,6 @@ module Mecha
|
|
27
27
|
o.bool '--rspec', 'install and config RSpec'
|
28
28
|
o.bool '--sentry', 'install and config Sentry'
|
29
29
|
o.bool '--simplecov', 'install and config Simplecov'
|
30
|
-
# o.bool '--heroku', 'configure Heroku Pipeline with staging and production environments'
|
31
|
-
# o.string '--org', 'configure project in your Heroku Org', default: ''
|
32
30
|
o.on '--version', 'print the gem version' do
|
33
31
|
puts Mecha::VERSION
|
34
32
|
exit
|
@@ -46,20 +44,18 @@ module Mecha
|
|
46
44
|
arguments << '--simplecov' if Mecha.opts.simplecov?
|
47
45
|
arguments << '--rspec' if Mecha.opts.rspec?
|
48
46
|
|
49
|
-
|
50
47
|
Mecha::Generators::AppGenerator.start
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
48
|
+
Mecha::Generators::AssetsGenerator.start
|
49
|
+
Mecha::Generators::GuardGenerator.start
|
50
|
+
Mecha::Generators::RubocopGenerator.start
|
51
|
+
Mecha::Generators::I18nGenerator.start
|
55
52
|
Mecha::Generators::TestsGenerator.start(arguments)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# Mecha::Generators::HerokuGenerator.start("--org #{Mecha[:org]}")
|
53
|
+
Mecha::Generators::SimplecovGenerator.start if Mecha.opts.simplecov?
|
54
|
+
Mecha::Generators::BitbucketPipelinesGenerator.start if Mecha.opts.bitbucket_pipelines?
|
55
|
+
Mecha::Generators::DeviseGenerator.start if Mecha.opts.devise?
|
56
|
+
Mecha::Generators::SentryGenerator.start if Mecha.opts.sentry?
|
57
|
+
Mecha::Generators::CpfCnpjGenerator.start if Mecha.opts.cpf_cnpj?
|
58
|
+
Mecha::Generators::DangerGenerator.start(arguments) if Mecha.opts.danger?
|
59
|
+
Mecha::Generators::ProntoGenerator.start(arguments) if Mecha.opts.pronto?
|
64
60
|
end
|
65
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mecha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magrathea Labs
|
@@ -111,7 +111,6 @@ files:
|
|
111
111
|
- LICENSE.txt
|
112
112
|
- README.md
|
113
113
|
- Rakefile
|
114
|
-
- TODO.md
|
115
114
|
- bin/console
|
116
115
|
- bin/mecha
|
117
116
|
- bin/rake
|
@@ -134,8 +133,6 @@ files:
|
|
134
133
|
- lib/mecha/generators/devise/devise_generator.rb
|
135
134
|
- lib/mecha/generators/guard/guard_generator.rb
|
136
135
|
- lib/mecha/generators/guard/templates/Guardfile
|
137
|
-
- lib/mecha/generators/heroku/heroku_generator.rb
|
138
|
-
- lib/mecha/generators/heroku/templates/app.json
|
139
136
|
- lib/mecha/generators/i18n/i18n_generator.rb
|
140
137
|
- lib/mecha/generators/i18n/templates/config/locales/models/en.yml
|
141
138
|
- lib/mecha/generators/i18n/templates/config/locales/models/pt-BR.yml
|
data/TODO.md
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
module Mecha
|
4
|
-
module Generators
|
5
|
-
class HerokuAppGenerator < Rails::Generators::Base
|
6
|
-
source_root File.join(File.dirname(__FILE__), 'templates')
|
7
|
-
|
8
|
-
class_option :org, type: :string, default: '', desc: 'Configure the Apps in as projects of your Heroku Org'
|
9
|
-
|
10
|
-
def create_app_manifest
|
11
|
-
end
|
12
|
-
|
13
|
-
def create_pipeline
|
14
|
-
# run_heroku("heroku pipelines:create #{pipeline_name} -a #{staging_name}", 'staging')
|
15
|
-
# run_heroku("heroku pipelines:create #{pipeline_name} -a #{production_name}", 'production')
|
16
|
-
end
|
17
|
-
|
18
|
-
def create_staging_app
|
19
|
-
run_heroku("create #{staging_name}", 'staging')
|
20
|
-
add_to_pipeline(staging_name)
|
21
|
-
end
|
22
|
-
|
23
|
-
def create_production_app
|
24
|
-
run_heroku("create #{production_name}", 'production')
|
25
|
-
add_to_pipeline(production_name)
|
26
|
-
end
|
27
|
-
|
28
|
-
def config_git_remote
|
29
|
-
run('git config heroku.remote staging')
|
30
|
-
end
|
31
|
-
|
32
|
-
def set_rails_secrets
|
33
|
-
# %w(staging production).each do |environment|
|
34
|
-
# run_toolbelt_command(
|
35
|
-
# "config:add SECRET_KEY_BASE=#{generate_secret}",
|
36
|
-
# environment,
|
37
|
-
# )
|
38
|
-
# end
|
39
|
-
end
|
40
|
-
|
41
|
-
def set_heroku_application_host
|
42
|
-
# %w(staging production).each do |environment|
|
43
|
-
# run_toolbelt_command(
|
44
|
-
# "config:add APPLICATION_HOST=#{heroku_app_name}-#{environment}.herokuapp.com",
|
45
|
-
# environment,
|
46
|
-
# )
|
47
|
-
# end
|
48
|
-
end
|
49
|
-
|
50
|
-
def set_backup_schedule
|
51
|
-
# %w(staging production).each do |environment|
|
52
|
-
# run_toolbelt_command(
|
53
|
-
# "pg:backups:schedule DATABASE_URL --at '10:00 UTC'",
|
54
|
-
# environment,
|
55
|
-
# )
|
56
|
-
# end
|
57
|
-
end
|
58
|
-
|
59
|
-
def app_readme
|
60
|
-
# After setting up, you can run the application using [Heroku Local]:
|
61
|
-
|
62
|
-
# % heroku local
|
63
|
-
|
64
|
-
# [Heroku Local]: https://devcenter.heroku.com/articles/heroku-local
|
65
|
-
end
|
66
|
-
|
67
|
-
def add_config_to_setup_file_to_setup_apps_after_they_are_created
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
def staging_name
|
73
|
-
"#{app_name.dasherize}-staging"
|
74
|
-
end
|
75
|
-
|
76
|
-
def production_name
|
77
|
-
app_name.dasherize
|
78
|
-
end
|
79
|
-
|
80
|
-
def pipeline_name
|
81
|
-
app_name.dasherize
|
82
|
-
end
|
83
|
-
|
84
|
-
def name
|
85
|
-
app_name.dasherize
|
86
|
-
end
|
87
|
-
|
88
|
-
def add_to_pipeline(app)
|
89
|
-
run_heroku("pipelines:add -a #{app} #{pipeline_name}", 'staging')
|
90
|
-
end
|
91
|
-
|
92
|
-
def run_heroku(command, environment)
|
93
|
-
org_param = options[:org].present? ? " --org #{options[:org]}" : ''
|
94
|
-
params = "--remote #{environment} #{org_param}"
|
95
|
-
run("heroku #{command} #{params}")
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "<%= app_name.humanize %>",
|
3
|
-
"description": "<%= app_name.humanize %> Heroku Manifest",
|
4
|
-
"website": "http://rubyonrails.org",
|
5
|
-
"success_url": "/welcome",
|
6
|
-
"addons": ["heroku-postgresql:hobby-dev", "papertrail"],
|
7
|
-
"env": {
|
8
|
-
"RAILS_ENV": "production",
|
9
|
-
"COOKIE_SECRET": {
|
10
|
-
"description": "This gets generated",
|
11
|
-
"generator": "secret"
|
12
|
-
},
|
13
|
-
"SETUP_BY": {
|
14
|
-
"description": "Who initiated this setup",
|
15
|
-
"value": ""
|
16
|
-
}
|
17
|
-
},
|
18
|
-
"scripts": {
|
19
|
-
"postdeploy": "bundle exec rake db:migrate"
|
20
|
-
}
|
21
|
-
}
|