bankai 0.3.1 → 0.6.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: 2921c916a852ee9c6003f7d38879e8319ce1a6e931fc1b024dcea1dc8d524292
4
- data.tar.gz: 43770cae83f6bc2ac2a9b1e46d75f4484f155d3a3d72c5dcf5ba927cd77b3593
3
+ metadata.gz: 76ebef80c3eb8a6faf9d274edcf9f63541809a1e956a84b6b7edb36bb795e965
4
+ data.tar.gz: 100d72179cd54567ad3cedf5f013607fcd0cadf8e81819c4315ae74eb468a42a
5
5
  SHA512:
6
- metadata.gz: eec44c1174a94a5c0d8c340239deb91720430711cdd5209742817d73631a31eaf41faf05d8faba6ff547eba82bf19b42f1778d78a2bf5da091436b69dc7b3659
7
- data.tar.gz: 46ed335a7fdc20574ac4701fa6fd400cb5cabee308989881deef1d7c505434b3508105aacd088a4aa1c80c52c1772c88cbc2b73b3c050dc3e63a49385adaeb8d
6
+ metadata.gz: ab0202a6a0e94db7aa81fa6276fbaa1e2df7715b85d9e8d6e363d05dae1170c039d56fe9c540baf160897966ebb161f501a96e50dedcbb54cf2599457b581b5d
7
+ data.tar.gz: 1dc831b5f8a5ee868debe64a0fb6e8cc9c35f19fb6488de52e64c6aade9dd451b1741adeec4c03fcf28b56169080b2f90ce30e99b59aa32a456c8839a1509ed0
@@ -1,4 +1,4 @@
1
- image: ruby:2.6.0
1
+ image: ruby:2.6.6
2
2
 
3
3
  stages:
4
4
  - lint
@@ -9,20 +9,27 @@ cache:
9
9
  paths:
10
10
  - vendor/ruby
11
11
 
12
+ .install_ruby_gems: &install_ruby_gems
13
+ - gem install bundler -v 2.1.4
14
+ - bundle install --path vendor
15
+
16
+ before_script:
17
+ - *install_ruby_gems
18
+
12
19
  rubocop:
13
20
  stage: lint
14
- before_script:
15
- - gem install rubocop -v 0.71.0
16
21
  script:
17
- - rubocop
22
+ - bundle exec rubocop --format progress --format json --out rubocop.json
23
+ artifacts:
24
+ paths:
25
+ - rubocop.json
18
26
  except:
19
27
  - schedules
20
28
 
21
29
  bundler-audit:
22
30
  stage: lint
23
31
  before_script:
24
- - gem install bundler -v 1.17.3
25
- - bundle install --path vendor
32
+ - *install_ruby_gems
26
33
  - gem install bundler-audit
27
34
  - bundle audit --update
28
35
  script:
@@ -31,21 +38,36 @@ bundler-audit:
31
38
 
32
39
  rspec:
33
40
  stage: test
34
- before_script:
35
- - gem install bundler -v 1.17.3
36
- - bundle install --path vendor
37
41
  script:
38
- - bundle exec rspec
42
+ - bundle exec rspec --format progress --format RspecJunitFormatter --out rspec.xml
43
+ artifacts:
44
+ paths:
45
+ - rspec.xml
46
+ - coverage
47
+ reports:
48
+ junit: rspec.xml
39
49
  except:
40
50
  - schedules
41
51
 
42
52
  sonarqube:
43
53
  stage: analysis
44
- image: registry.5xruby.tw/docker/sonar-scanner:4.0.0
54
+ image:
55
+ name: sonarsource/sonar-scanner-cli
56
+ entrypoint: [""]
57
+ variables:
58
+ GIT_DEPTH: 0
59
+ before_script: []
45
60
  script:
46
61
  - sonar-scanner
47
- -D"sonar.projectKey=5xruby-bankai"
48
- -D"sonar.projectBaseDir=${CI_PROJECT_DIR}"
49
- -D"sonar.host.url=https://sonar.5xruby.tw"
50
- -D"sonar.login=${SONARQUBE_TOKEN}"
51
- -D"sonar.projectVersion=${CI_COMMIT_SHORT_SHA}"
62
+ -Dsonar.projectKey=Bankai
63
+ -Dsonar.sourceEncoding=UTF-8
64
+ -Dsonar.qualitygate.wait=true
65
+ -Dsonar.ruby.rubocop.reportPaths=rubocop.json
66
+ -Dsonar.ruby.coverage.reportPaths=coverage/.resultset.json
67
+ -Dsonar.exclusions=vendor/ruby/**/*
68
+ -Dsonar.coverage.exclusions=spec/**/*
69
+ -Dsonar.projectVersion=$CI_COMMIT_SHORT_SHA
70
+ -Dsonar.sources=.
71
+ allow_failure: true
72
+ only:
73
+ - master
@@ -1 +1 @@
1
- 2.6.0
1
+ 2.6.6
@@ -3,5 +3,5 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.6.0
7
- before_install: gem install bundler -v 1.17.3
6
+ - 2.6.6
7
+ before_install: gem install bundler -v 2.1.4
@@ -27,13 +27,14 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
- spec.add_development_dependency 'bundler', '~> 1.17.3'
30
+ spec.add_development_dependency 'bundler', '~> 2.1.4'
31
31
  spec.add_development_dependency 'bundler-audit'
32
32
  spec.add_development_dependency 'overcommit'
33
- spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency 'rake', '~> 12.0'
34
34
  spec.add_development_dependency 'rspec', '~> 3.0'
35
- spec.add_development_dependency 'rubocop', '~> 0.71.0'
36
- spec.add_development_dependency 'simplecov'
35
+ spec.add_development_dependency 'rspec_junit_formatter'
36
+ spec.add_development_dependency 'rubocop', '~> 0.81.0'
37
+ spec.add_development_dependency 'simplecov', '~> 0.17.1'
37
38
 
38
39
  # TODO: Allow specify rails version
39
40
  spec.add_dependency 'rails', ">= #{Bankai::RAILS_VERSION}"
@@ -25,17 +25,24 @@ module Bankai
25
25
  end
26
26
  end
27
27
 
28
+ def configure_puma_dev
29
+ application(nil, env: 'development') do
30
+ "config.hosts << '.test'"
31
+ end
32
+ end
33
+
28
34
  def configure_quiet_assets
29
- config = <<-RUBY
30
- config.assets.quiet = true
31
- RUBY
35
+ return if options[:api]
32
36
 
33
- inject_into_class 'config/application.rb', 'Application', config
37
+ application do
38
+ 'config.assets.quiet = true'
39
+ end
34
40
  end
35
41
 
36
42
  # rubocop:disable Metrics/MethodLength
37
43
  def configure_generators
38
- config = <<-RUBY
44
+ application do
45
+ <<-RUBY
39
46
  config.generators do |generate|
40
47
  generate.helper false
41
48
  generate.javascripts false
@@ -45,9 +52,8 @@ module Bankai
45
52
  generate.test_framework :rspec
46
53
  generate.view_specs false
47
54
  end
48
- RUBY
49
-
50
- inject_into_class 'config/application.rb', 'Application', config
55
+ RUBY
56
+ end
51
57
  end
52
58
 
53
59
  def setup_default_directories
@@ -49,6 +49,7 @@ module Bankai
49
49
  def setup_development_environment
50
50
  say 'Setting up the development environment'
51
51
  build :configure_quiet_assets
52
+ build :configure_puma_dev
52
53
  build :configure_generators
53
54
  build :clear_seed_file
54
55
  # TODO: Add setup script
@@ -6,6 +6,8 @@ module Bankai
6
6
  module Generators
7
7
  # :nodoc:
8
8
  class DeployGenerator < Base
9
+ DEFAULT_REPO = 'git@example.com:me/my_repo.git'
10
+
9
11
  def install_capistrano
10
12
  Bundler.with_clean_env { run 'bundle exec cap install' }
11
13
  end
@@ -25,8 +27,10 @@ module Bankai
25
27
  protected
26
28
 
27
29
  def repo_url
30
+ return DEFAULT_REPO unless Dir.exist?('.git')
31
+
28
32
  res = `git remote get-url origin`
29
- return 'git@example.com:me/my_repo.git' if res.blank?
33
+ return DEFAULT_REPO if res.blank?
30
34
 
31
35
  res
32
36
  end
@@ -34,11 +38,11 @@ module Bankai
34
38
  private
35
39
 
36
40
  def capistrano_plugins
37
- <<-RUBY
38
- require "capistrano/bundler"
39
- require "capistrano/rails/assets"
40
- require "capistrano/rails/migrations"
41
- RUBY
41
+ plugins = []
42
+ plugins << 'require "capistrano/bundler"'
43
+ plugins << 'require "capistrano/rails/assets"' unless options[:api]
44
+ plugins << 'require "capistrano/rails/migrations"'
45
+ plugins.join("\n")
42
46
  end
43
47
  end
44
48
  end
@@ -21,6 +21,10 @@ module Bankai
21
21
  def rubocop_autocorrect
22
22
  Bundler.with_clean_env { run 'bundle exec rubocop --auto-correct' }
23
23
  end
24
+
25
+ def rubocop_todo
26
+ Bundler.with_clean_env { run 'bundle exec rubocop --auto-gen-config' }
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bankai
4
- VERSION = '0.3.1'
5
- RUBY_VERSION = '2.6.0'
6
- RAILS_VERSION = '5.2.4'
7
- RUBOCOP_VERSION = '0.71.0'
8
- CAPISTRANO_VERSION = '3.11.0'
4
+ VERSION = '0.6.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'
9
9
  end
@@ -43,6 +43,7 @@ group :development, :test do
43
43
  gem 'rubocop', '~> <%= Bankai::RUBOCOP_VERSION %>', require: false
44
44
  gem 'rubocop-performance', require: false
45
45
  gem 'rubocop-rails', require: false
46
+ gem 'rubocop-rspec', require: false
46
47
 
47
48
  <%- unless options[:skip_rspec] -%>
48
49
  gem 'database_rewinder'
@@ -27,8 +27,8 @@ set :deploy_to, '/src/app'
27
27
  append :linked_files, 'config/database.yml', 'config/master.key'
28
28
 
29
29
  # Default value for linked_dirs is []
30
- append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system', '.bundle',
31
- 'public/uploads', 'node_modules'
30
+ append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system',
31
+ '.bundle', 'public/uploads', 'node_modules'
32
32
 
33
33
  # Default value for default_env is {}
34
34
  set :default_env, { path: '/usr/local/ruby-<%= RUBY_VERSION %>/bin:$PATH' }
@@ -1,14 +1,13 @@
1
1
  image: ruby:<%= RUBY_VERSION %>
2
2
 
3
- include:
4
- template: Verify/Browser-Performance.gitlab-ci.yml
5
-
6
3
  variables:
7
4
  RAILS_ENV: test
8
- NODE_VERSION: 11.0.0
5
+ NODE_VERSION: 12.13.1
6
+ BUNDLER_VERSION: 2.1.4
9
7
  <%- if pg? -%>
10
8
  POSTGRES_DB: <%= app_name %>
11
- DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
9
+ POSTGRES_PASSWORD: postgres
10
+ DATABASE_URL: "postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/$POSTGRES_DB"
12
11
  <%- end -%>
13
12
  <%- if mysql? -%>
14
13
  MYSQL_DATABASE: <%= app_name %>
@@ -18,36 +17,41 @@ variables:
18
17
  DATABASE_URL: "mysql2://$MYSQL_USER:$MYSQL_PASSWORD@mysql:3306/$MYSQL_DATABASE"
19
18
  <%- end -%>
20
19
 
20
+ .install_ruby_gems: &install_ruby_gems
21
+ - gem install bundler -v ${BUNDLER_VERSION}
22
+ - bundle install --path vendor
23
+
24
+ .install_nodejs: &install_nodejs
25
+ - curl -SLO https://nodejs.org/dist/v$NODE_VERSION/node-v${NODE_VERSION}-linux-x64.tar.xz && tar -xJf node-v${NODE_VERSION}-linux-x64.tar.xz -C /usr/local --strip-components=1;
26
+ - curl -o- -L https://yarnpkg.com/install.sh | bash
27
+ - export PATH=$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH
28
+
21
29
  stages:
22
30
  - lint
23
31
  - test
24
32
  - deploy
25
- - measure
26
33
 
27
34
  cache:
28
35
  paths:
29
36
  - vendor/ruby
30
37
  - node_modules
31
38
 
39
+ before_script:
40
+ - export LANG=C.UTF-8
41
+ - export LC_ALL=C.UTF-8
42
+ - *install_ruby_gems
43
+
32
44
  rubocop:
33
45
  stage: lint
34
- before_script:
35
- - gem install rubocop -v <%= Bankai::RUBOCOP_VERSION %>
36
- - gem install rubocop-performance
37
- - gem install rubocop-rails
38
46
  script:
39
- - rubocop
47
+ - bundle exec rubocop
40
48
  except:
41
49
  - schedules
42
50
 
43
51
  brakeman:
44
52
  stage: lint
45
- before_script:
46
- - export LANG=C.UTF-8
47
- - export LC_ALL=C.UTF-8
48
- - gem install brakeman
49
53
  script:
50
- - brakeman
54
+ - bundle exec brakeman
51
55
  except:
52
56
  - schedules
53
57
 
@@ -60,17 +64,23 @@ bundler-audit:
60
64
  - bundle audit
61
65
  allow_failure: true
62
66
 
67
+ yarn-audit:
68
+ stage: lint
69
+ before_script:
70
+ - *install_nodejs
71
+ script:
72
+ - yarn audit
73
+ allow_failure: true
74
+
63
75
  rspec:
64
76
  stage: test
65
77
  before_script:
66
- - curl -SLO https://nodejs.org/dist/v$NODE_VERSION/node-v${NODE_VERSION}-linux-x64.tar.xz && tar -xJf node-v${NODE_VERSION}-linux-x64.tar.xz -C /usr/local --strip-components=1;
67
- - curl -o- -L https://yarnpkg.com/install.sh | bash
68
- - export PATH=$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH
69
- - bundle install --without development --path vendor
78
+ - *install_nodejs
79
+ - *install_ruby_gems
70
80
  - yarn install
71
81
  services:
72
82
  <%- if pg? -%>
73
- - postgres:9.6
83
+ - postgres:12-alpine
74
84
  <%- end -%>
75
85
  <%- if mysql? -%>
76
86
  - name: mysql:5.7
@@ -81,25 +91,3 @@ rspec:
81
91
  - bundle exec rspec
82
92
  except:
83
93
  - schedules
84
-
85
- # staging:deploy:
86
- # stage: deploy
87
- # before_script:
88
- # - which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
89
- # - eval $(ssh-agent -s)
90
- # - ssh-add <(echo -e "$SSH_PRIVATE_KEY")
91
- # - bundle install --path vendor
92
- # script:
93
- # - bundle exec cap staging deploy
94
- # only:
95
- # - master
96
- # except:
97
- # - schedules
98
-
99
- # NOTE: Ensure GitLab version > 12.0
100
- # performance:
101
- # stage: measure
102
- # variables:
103
- # URL: STAGING_SITE_URL
104
- # SITESPEED_VERSION: 10.3.2-plus1
105
- # SITESPEED_OPTIONS: '--plugins.add /lighthouse'
@@ -12,7 +12,7 @@ require 'shoulda/matchers'
12
12
  require 'faker'
13
13
  require 'factory_bot'
14
14
 
15
- Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
15
+ Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |f| require f }
16
16
 
17
17
  begin
18
18
  ActiveRecord::Migration.maintain_test_schema!
@@ -1,6 +1,7 @@
1
1
  require:
2
2
  - rubocop-performance
3
3
  - rubocop-rails
4
+ - rubocop-rspec
4
5
  AllCops:
5
6
  TargetRubyVersion: <%= RUBY_VERSION %>
6
7
  DisplayCopNames: true
@@ -30,9 +31,16 @@ Metrics/BlockLength:
30
31
  Exclude:
31
32
  - config/environments/*
32
33
  - lib/tasks/**/*
34
+ - spec/**/*
35
+ Lint/RaiseException:
36
+ Enabled: true
37
+ Lint/StructNewOverride:
38
+ Enabled: true
33
39
  Layout:
34
40
  Exclude:
35
41
  - config/environments/*
42
+ Layout/LineLength:
43
+ Max: 120
36
44
  Style:
37
45
  Exclude:
38
46
  - spec/*_helper.rb
@@ -42,3 +50,9 @@ Style/BlockComments:
42
50
  - spec/**/*
43
51
  Style/Documentation:
44
52
  Enabled: false
53
+ Style/HashEachMethods:
54
+ Enabled: true
55
+ Style/HashTransformKeys:
56
+ Enabled: true
57
+ Style/HashTransformValues:
58
+ Enabled: true
@@ -17,4 +17,8 @@ RSpec.configure do |config|
17
17
  end
18
18
 
19
19
  config.shared_context_metadata_behavior = :apply_to_host_groups
20
+
21
+ config.expect_with :rspec do |c|
22
+ c.syntax = :expect
23
+ end
20
24
  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.3.1
4
+ version: 0.6.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: 2019-12-30 00:00:00.000000000 Z
12
+ date: 2020-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.17.3
20
+ version: 2.1.4
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.17.3
27
+ version: 2.1.4
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler-audit
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '10.0'
62
+ version: '12.0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '10.0'
69
+ version: '12.0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -81,48 +81,62 @@ dependencies:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '3.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec_junit_formatter
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: rubocop
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
88
102
  - - "~>"
89
103
  - !ruby/object:Gem::Version
90
- version: 0.71.0
104
+ version: 0.81.0
91
105
  type: :development
92
106
  prerelease: false
93
107
  version_requirements: !ruby/object:Gem::Requirement
94
108
  requirements:
95
109
  - - "~>"
96
110
  - !ruby/object:Gem::Version
97
- version: 0.71.0
111
+ version: 0.81.0
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: simplecov
100
114
  requirement: !ruby/object:Gem::Requirement
101
115
  requirements:
102
- - - ">="
116
+ - - "~>"
103
117
  - !ruby/object:Gem::Version
104
- version: '0'
118
+ version: 0.17.1
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
108
122
  requirements:
109
- - - ">="
123
+ - - "~>"
110
124
  - !ruby/object:Gem::Version
111
- version: '0'
125
+ version: 0.17.1
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: rails
114
128
  requirement: !ruby/object:Gem::Requirement
115
129
  requirements:
116
130
  - - ">="
117
131
  - !ruby/object:Gem::Version
118
- version: 5.2.4
132
+ version: 6.0.3
119
133
  type: :runtime
120
134
  prerelease: false
121
135
  version_requirements: !ruby/object:Gem::Requirement
122
136
  requirements:
123
137
  - - ">="
124
138
  - !ruby/object:Gem::Version
125
- version: 5.2.4
139
+ version: 6.0.3
126
140
  description: The tool to generate Rails template for 5xRuby
127
141
  email:
128
142
  - hi@5xruby.tw
@@ -186,14 +200,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
200
  requirements:
187
201
  - - ">="
188
202
  - !ruby/object:Gem::Version
189
- version: 2.6.0
203
+ version: 2.6.6
190
204
  required_rubygems_version: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - ">="
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  requirements: []
196
- rubygems_version: 3.0.1
210
+ rubygems_version: 3.0.3
197
211
  signing_key:
198
212
  specification_version: 4
199
213
  summary: The Rails template for 5xRuby