bankai 0.7.0 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6ae152202fc1035211da5eeb7e7351799e8d56e8f136f7f09dcc1269a0e647e
4
- data.tar.gz: 0b0d39e8b111f7e3e22a60dba1209910b33c73df22dc556d4d44aedcb58d5d6e
3
+ metadata.gz: c68c970fcca0732e832adbd4b50572fd41e54efecd0da08e3383fabf15ac59ea
4
+ data.tar.gz: 38c9dd0a931186e1b85036765deca0278894c8d8663e79f13fc65af8b93bcac2
5
5
  SHA512:
6
- metadata.gz: dadcccf32107bc95e5c0665c5605b10ce117b587e44e8ffb2112825eff2ac4236736786b9c7db49664b8272ab4646af53c853731cea1019a4358972415b7666d
7
- data.tar.gz: 6ac4850e192204202e363f59d43b2c3ad4c4be100ea248b6549fdeca8b2c2bae154eb3947debed74f173e768eac35aff02437fe48948d4765c4039f2bc1699b7
6
+ metadata.gz: c3924d02fd970cd1475f0db294a84142ca8dbb59be8ec5f923987d430751157b4cef549293fd33c01333b4159de85b6aabfe28725413df3371158cac1086b476
7
+ data.tar.gz: 77dca64ed181349491fe3e08836481ae7184297f543b8570d8c63befea63445271e53f5d24b2f33658bc30a001fd46f7da802d7dc3169dd46ee6fdb62e4832d3
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ AllCops:
2
+ SuggestExtensions: false
data/bankai.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rake', '~> 12.0'
34
34
  spec.add_development_dependency 'rspec', '~> 3.0'
35
35
  spec.add_development_dependency 'rspec_junit_formatter'
36
- spec.add_development_dependency 'rubocop', '~> 0.81.0'
36
+ spec.add_development_dependency 'rubocop', '~> 1.8.1'
37
37
  spec.add_development_dependency 'simplecov', '~> 0.17.1'
38
38
 
39
39
  # TODO: Allow specify rails version
data/exe/bankai CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'pathname'
5
5
 
6
- source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
6
+ source_path = File.expand_path("#{Pathname.new(__FILE__).dirname}../lib")
7
7
  $LOAD_PATH << source_path
8
8
 
9
9
  require 'bankai'
@@ -71,7 +71,7 @@ module Bankai
71
71
  # rubocop:enable Metrics/MethodLength
72
72
 
73
73
  def clear_seed_file
74
- File.write(destination_root + '/db/seeds.rb', '')
74
+ File.write("#{destination_root}/db/seeds.rb", '')
75
75
  end
76
76
 
77
77
  def setup_rack_mini_profiler
@@ -12,15 +12,15 @@ module Bankai
12
12
  desc: 'Configure for selected database ' \
13
13
  "(options: #{DATABASES.join('/')})"
14
14
 
15
+ class_option :capistrano, type: :boolean, default: false,
16
+ desc: 'Use Capistrano'
17
+
15
18
  class_option :skip_test, type: :boolean, default: true,
16
19
  desc: 'Skip test files'
17
20
 
18
21
  class_option :skip_coffee, type: :boolean, default: true,
19
22
  desc: "Don't use CoffeeScript"
20
23
 
21
- class_option :skip_capistrano, type: :boolean, default: false,
22
- desc: "Don't use Capistrano"
23
-
24
24
  class_option :skip_rspec, type: :boolean, default: false,
25
25
  desc: 'Skip rspec files'
26
26
 
@@ -72,7 +72,7 @@ module Bankai
72
72
  generate('bankai:json')
73
73
  generate('bankai:db_optimizations')
74
74
  generate('bankai:mailer')
75
- generate('bankai:deploy') unless options[:skip_capistrano]
75
+ generate('bankai:deploy') if options[:capistrano]
76
76
  generate('annotate:install')
77
77
  generate('bankai:lint')
78
78
  end
@@ -15,7 +15,11 @@ module Bankai
15
15
  private
16
16
 
17
17
  def app_name
18
- Rails.app_class.parent_name.demodulize.underscore.dasherize
18
+ if Rails::VERSION::MAJOR >= 6
19
+ Rails.app_class.module_parent_name.demodulize.underscore.dasherize
20
+ else
21
+ Rails.app_class.parent_name.demodulize.underscore.dasherize
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -9,7 +9,7 @@ module Bankai
9
9
  DEFAULT_REPO = 'git@example.com:me/my_repo.git'
10
10
 
11
11
  def install_capistrano
12
- Bundler.with_clean_env { run 'bundle exec cap install' }
12
+ execute_command :bundle, 'exec cap install'
13
13
  end
14
14
 
15
15
  def configure_capfile
@@ -8,7 +8,7 @@ module Bankai
8
8
  class JsonGenerator < Base
9
9
  def add_oj
10
10
  gem 'oj'
11
- Bundler.with_clean_env { run 'bundle install' }
11
+ execute_command :bundle, 'install'
12
12
 
13
13
  initializer 'oj.rb' do
14
14
  "# frozen_string_literal: true\n\n" \
@@ -15,15 +15,15 @@ module Bankai
15
15
  end
16
16
 
17
17
  def install_overcommit
18
- Bundler.with_clean_env { run 'bundle exec overcommit --install' }
18
+ execute_command :bundle, 'exec overcommit --install'
19
19
  end
20
20
 
21
21
  def rubocop_autocorrect
22
- Bundler.with_clean_env { run 'bundle exec rubocop --auto-correct' }
22
+ execute_command :bundle, 'exec rubocop --auto-correct-all'
23
23
  end
24
24
 
25
25
  def rubocop_todo
26
- Bundler.with_clean_env { run 'bundle exec rubocop --auto-gen-config' }
26
+ execute_command :bundle, 'exec rubocop --auto-gen-config'
27
27
  end
28
28
  end
29
29
  end
@@ -17,18 +17,18 @@ module Bankai
17
17
  class SitemapGenerator < Base
18
18
  def add_sitemap_generator
19
19
  gem 'sitemap_generator'
20
- Bundler.with_clean_env { run 'bundle install' }
20
+ in_root { run 'bundle install' }
21
21
  end
22
22
 
23
23
  def init_sitemap
24
- Bundler.with_clean_env { run 'bundle exec rake sitemap:install' }
24
+ in_root { run 'bundle exec rake sitemap:install' }
25
25
  end
26
26
 
27
27
  def generate_sitmap_config
28
28
  gsub_file 'config/sitemap.rb',
29
- %r{"http:\/\/www.example.com"},
29
+ %r{"http://www.example.com"},
30
30
  HOST_TEMPLATE
31
- Bundler.with_clean_env do
31
+ in_root do
32
32
  run 'bundle exec rubocop -a config/sitemap.rb'
33
33
  end
34
34
  end
@@ -8,12 +8,12 @@ module Bankai
8
8
  class WheneverGenerator < Base
9
9
  def add_whenever
10
10
  gem 'whenever', require: false
11
- Bundler.with_clean_env { run 'rubocop -a Gemfile' }
12
- Bundler.with_clean_env { run 'bundle install' }
11
+ execute_command :bundle, 'exec rubocop -a Gemfile'
12
+ execute_command :bundle, 'install'
13
13
  end
14
14
 
15
15
  def initialize_whenever
16
- Bundler.with_clean_env { run "wheneverize #{destination_root}" }
16
+ execute_command :bundle, "exec wheneverize #{destination_root}"
17
17
  end
18
18
 
19
19
  def initialize_capistrano
data/lib/bankai/helper.rb CHANGED
@@ -20,7 +20,7 @@ module Bankai
20
20
  private
21
21
 
22
22
  def gemfile
23
- @gemfile ||= File.read(destination_root + '/Gemfile')
23
+ @gemfile ||= File.read("#{destination_root}/Gemfile")
24
24
  end
25
25
  end
26
26
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bankai
4
- VERSION = '0.7.0'
5
- RUBY_VERSION = '2.6.6'
6
- RAILS_VERSION = '6.0.3'
7
- RUBOCOP_VERSION = '0.81.0'
8
- CAPISTRANO_VERSION = '3.14.0'
4
+ VERSION = '0.10.0'
5
+ RUBY_VERSION = '2.6.7'
6
+ RAILS_VERSION = '5.2.0'
7
+ RUBOCOP_VERSION = '1.8.1'
8
+ CAPISTRANO_VERSION = '3.14.1'
9
9
  end
@@ -39,7 +39,7 @@ group :development, :test do
39
39
  gem 'byebug', platforms: %i[mri mingw x64_mingw]
40
40
 
41
41
  gem 'brakeman', require: false
42
- gem 'bundler-audit', '~> 0.6.0', require: false
42
+ gem 'bundler-audit', require: false
43
43
  gem 'rubocop', '~> <%= Bankai::RUBOCOP_VERSION %>', require: false
44
44
  gem 'rubocop-performance', require: false
45
45
  gem 'rubocop-rails', require: false
@@ -54,6 +54,7 @@ group :development, :test do
54
54
  gem 'shoulda', require: false
55
55
  gem 'shoulda-matchers', require: false
56
56
  gem 'simplecov', require: false
57
+ gem 'simplecov-cobertura', require: false
57
58
  <%- end -%>
58
59
 
59
60
  gem 'bankai'
@@ -81,7 +82,7 @@ group :development do
81
82
  <% end -%>
82
83
  <% end -%>
83
84
 
84
- <% unless options[:skip_capistrano] -%>
85
+ <% if options[:capistrano] -%>
85
86
  gem 'capistrano', '<%= Bankai::CAPISTRANO_VERSION %>'
86
87
  gem 'capistrano-bundler'
87
88
  gem 'capistrano-rails'
@@ -206,7 +206,7 @@ bundle exec brakeman
206
206
  cp .env.example .env
207
207
  ```
208
208
 
209
- <%- unless options[:skip_capistrano] -%>
209
+ <%- if options[:capistrano] -%>
210
210
  ## 部署
211
211
 
212
212
  這個專案使用 Capistrano 進行部署,請先確定有權限透過 `deployer` 帳號 SSH 到伺服器上。
@@ -1,4 +1,10 @@
1
- image: ruby:<%= RUBY_VERSION %>
1
+ default:
2
+ image: ruby:<%= RUBY_VERSION %>
3
+
4
+ stages:
5
+ - lint
6
+ - test
7
+ - deploy
2
8
 
3
9
  variables:
4
10
  RAILS_ENV: test
@@ -26,22 +32,22 @@ variables:
26
32
  - curl -o- -L https://yarnpkg.com/install.sh | bash
27
33
  - export PATH=$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH
28
34
 
29
- stages:
30
- - lint
31
- - test
32
- - deploy
33
-
34
- cache:
35
- paths:
36
- - vendor/ruby
37
- - node_modules
38
-
39
- before_script:
40
- - export LANG=C.UTF-8
41
- - export LC_ALL=C.UTF-8
42
- - *install_ruby_gems
35
+ .common:
36
+ before_script:
37
+ - export LANG=C.UTF-8
38
+ - export LC_ALL=C.UTF-8
39
+ - *install_ruby_gems
40
+ cache:
41
+ key:
42
+ files:
43
+ - Gemfile.lock
44
+ - yarn.lock
45
+ paths:
46
+ - vendor/ruby
47
+ - node_modules
43
48
 
44
49
  rubocop:
50
+ extends: .common
45
51
  stage: lint
46
52
  script:
47
53
  - bundle exec rubocop
@@ -49,6 +55,7 @@ rubocop:
49
55
  - schedules
50
56
 
51
57
  brakeman:
58
+ extends: .common
52
59
  stage: lint
53
60
  script:
54
61
  - bundle exec brakeman
@@ -56,23 +63,47 @@ brakeman:
56
63
  - schedules
57
64
 
58
65
  bundler-audit:
66
+ extends: .common
59
67
  stage: lint
60
- before_script:
68
+ script:
61
69
  - gem install bundler-audit
62
70
  - bundle audit --update
63
- script:
64
71
  - bundle audit
72
+ only:
73
+ changes:
74
+ - Gemfile
75
+ - Gemfile.lock
76
+ allow_failure: true
77
+
78
+ bundler-leak:
79
+ extends: .common
80
+ stage: lint
81
+ script:
82
+ - gem install bundler-leak
83
+ - bundle leak check --update
84
+ - bundle leak
85
+ only:
86
+ changes:
87
+ - Gemfile
88
+ - Gemfile.lock
65
89
  allow_failure: true
66
90
 
67
91
  yarn-audit:
92
+ extends: .common
68
93
  stage: lint
69
94
  before_script:
70
95
  - *install_nodejs
71
96
  script:
72
97
  - yarn audit
98
+ only:
99
+ changes:
100
+ - package.json
101
+ - package-lock.json
102
+ - yarn.lock
73
103
  allow_failure: true
74
104
 
75
105
  rspec:
106
+ extends: .common
76
107
  stage: test
77
108
  before_script:
78
109
  - *install_nodejs
@@ -91,3 +122,6 @@ rspec:
91
122
  - bundle exec rspec
92
123
  except:
93
124
  - schedules
125
+ artifacts:
126
+ reports:
127
+ cobertura: coverage/coverage.xml
@@ -2,9 +2,11 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rails
4
4
  - rubocop-rspec
5
+
5
6
  AllCops:
6
7
  TargetRubyVersion: <%= RUBY_VERSION %>
7
8
  DisplayCopNames: true
9
+ SuggestExtensions: false
8
10
  Exclude:
9
11
  - bin/*
10
12
  - vendor/ruby/**/*
@@ -32,27 +34,5 @@ Metrics/BlockLength:
32
34
  - config/environments/*
33
35
  - lib/tasks/**/*
34
36
  - spec/**/*
35
- Lint/RaiseException:
36
- Enabled: true
37
- Lint/StructNewOverride:
38
- Enabled: true
39
- Layout:
40
- Exclude:
41
- - config/environments/*
42
- Layout/LineLength:
43
- Max: 120
44
- Style:
45
- Exclude:
46
- - spec/*_helper.rb
47
- Style/BlockComments:
48
- Exclude:
49
- - config/**/*
50
- - spec/**/*
51
37
  Style/Documentation:
52
38
  Enabled: false
53
- Style/HashEachMethods:
54
- Enabled: true
55
- Style/HashTransformKeys:
56
- Enabled: true
57
- Style/HashTransformValues:
58
- Enabled: true
@@ -2,6 +2,10 @@
2
2
 
3
3
  if ENV.fetch('COVERAGE', false) || ENV.fetch('CI', false)
4
4
  require 'simplecov'
5
+ require 'simplecov-cobertura'
6
+
7
+ SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter if ENV.fetch('GITLAB_CI', false)
8
+
5
9
  SimpleCov.start 'rails' do
6
10
  add_filter 'vendor'
7
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bankai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 5xRuby
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-09-09 00:00:00.000000000 Z
12
+ date: 2021-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -101,14 +101,14 @@ dependencies:
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 0.81.0
104
+ version: 1.8.1
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 0.81.0
111
+ version: 1.8.1
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: simplecov
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 6.0.3
132
+ version: 5.2.0
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 6.0.3
139
+ version: 5.2.0
140
140
  description: The tool to generate Rails template for 5xRuby
141
141
  email:
142
142
  - hi@5xruby.tw
@@ -150,6 +150,7 @@ files:
150
150
  - ".gitlab-ci.yml"
151
151
  - ".overcommit.yml"
152
152
  - ".rspec"
153
+ - ".rubocop.yml"
153
154
  - ".ruby-version"
154
155
  - ".travis.yml"
155
156
  - CODE_OF_CONDUCT.md
@@ -200,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
201
  requirements:
201
202
  - - ">="
202
203
  - !ruby/object:Gem::Version
203
- version: 2.6.6
204
+ version: 2.6.7
204
205
  required_rubygems_version: !ruby/object:Gem::Requirement
205
206
  requirements:
206
207
  - - ">="