bankai 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: c8a6424b3a1f3877b0c4aa41a2b797e2d55725a7071dc914a81263ea67a4bf5a
4
- data.tar.gz: b63ac4a57827aa1ab5265a6e490292a796e9dca1b48e31bc230cb459e8ce7721
3
+ metadata.gz: 63cf396320da25bc3c0e14294788f925eed947751e979426e06fd2a5f96472e6
4
+ data.tar.gz: b8dacbb98533fec16d577310e73a1bde3a257647c5da86a0123387e6fbff1f17
5
5
  SHA512:
6
- metadata.gz: 8e862dd802ac221fa1e41f0c1f10f0b7bf32c548826af97563260e9a89a51b4231b27e9991e5039d51fcddb487b816371e1b849ad336443aa91ac231c89e6fe7
7
- data.tar.gz: 0e7336a72366f0ce4ac122d613625b2c9c29fd3c913cb92e198d46d53ea35421cd2bd0f5c2f7ede9e1f312c2430dc881059b9b428d0dfa28acfc57ad22dd1cb0
6
+ metadata.gz: 1a79317200b09c89a09e314de917f46bdfe4ef4ee27ebed9195928877fdd18d8a27a53d46763bfaac5e9443826fbbcdcfb016c4ff4113d2ac13b3093c628fb57
7
+ data.tar.gz: b209b588b1b9585f3720a6a16fefbe3159de51e86f062f6022cea1539d24709b33e769e37fb34247d97858bcb8c4a7e210cc577d4bdd783285159e029dae3e69
@@ -0,0 +1 @@
1
+ 2.6.0
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Ruby5x
1
+ Bankai
2
2
  ===
3
3
 
4
4
  This gem is inspired by [Suspenders](https://github.com/thoughtbot/suspenders) for [5xRuby](https://5xruby.tw) to bootstrap a rails project.
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -27,12 +27,12 @@ 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.16'
30
+ spec.add_development_dependency 'bundler', '~> 1.17.3'
31
31
  spec.add_development_dependency 'bundler-audit'
32
32
  spec.add_development_dependency 'overcommit'
33
33
  spec.add_development_dependency 'rake', '~> 10.0'
34
34
  spec.add_development_dependency 'rspec', '~> 3.0'
35
- spec.add_development_dependency 'rubocop', '~> 0.60.0'
35
+ spec.add_development_dependency 'rubocop', '~> 0.71.0'
36
36
  spec.add_development_dependency 'simplecov'
37
37
  spec.add_dependency 'rails', Bankai::RAILS_VERSION
38
38
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'bankai'
data/exe/bankai CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'pathname'
3
5
 
4
6
  source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bankai/version'
2
4
  require 'bankai/generator'
5
+ require 'bankai/helper'
3
6
  require 'bankai/generators/testing_generator'
4
7
  require 'bankai/generators/ci_generator'
5
8
  require 'bankai/generators/json_generator'
@@ -7,4 +10,6 @@ require 'bankai/generators/db_optimizations_generator'
7
10
  require 'bankai/generators/mailer_generator'
8
11
  require 'bankai/generators/deploy_generator'
9
12
  require 'bankai/generators/lint_generator'
13
+ require 'bankai/generators/sitemap_generator'
14
+ require 'bankai/generators/whenever_generator'
10
15
  require 'bankai/builder'
@@ -6,6 +6,8 @@ module Bankai
6
6
  module Generators
7
7
  # :nodoc:
8
8
  class Base < Rails::Generators::Base
9
+ include Bankai::Helper
10
+
9
11
  def self.default_source_root
10
12
  File.expand_path(File.join('..', '..', '..', 'templates'), __dir__)
11
13
  end
@@ -9,22 +9,6 @@ module Bankai
9
9
  def configure_ci
10
10
  template 'gitlab-ci.yml.erb', '.gitlab-ci.yml'
11
11
  end
12
-
13
- protected
14
-
15
- def pg?
16
- gemfile.match?(/gem .pg./)
17
- end
18
-
19
- def mysql?
20
- gemfile.match?(/gem .mysql2./)
21
- end
22
-
23
- private
24
-
25
- def gemfile
26
- @gemfile ||= File.read(destination_root + '/Gemfile')
27
- end
28
12
  end
29
13
  end
30
14
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base'
4
+
5
+ module Bankai
6
+ module Generators
7
+ HOST_TEMPLATE = <<-RUBY.freeze
8
+
9
+ if Rails.env.production?
10
+ "https://\#{ENV['APPLICATION_HOST']}"
11
+ else
12
+ "http://\#{ENV['APPLICATION_HOST']}"
13
+ end
14
+ RUBY
15
+
16
+ # :nodoc:
17
+ class SitemapGenerator < Base
18
+ def add_sitemap_generator
19
+ gem 'sitemap_generator'
20
+ Bundler.with_clean_env { run 'bundle install' }
21
+ end
22
+
23
+ def init_sitemap
24
+ Bundler.with_clean_env { run 'bundle exec rake sitemap:install' }
25
+ end
26
+
27
+ def generate_sitmap_config
28
+ gsub_file 'config/sitemap.rb',
29
+ %r{"http:\/\/www.example.com"},
30
+ HOST_TEMPLATE
31
+ Bundler.with_clean_env do
32
+ run 'bundle exec rubocop -a config/sitemap.rb'
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base'
4
+
5
+ module Bankai
6
+ module Generators
7
+ # :nodoc:
8
+ class WheneverGenerator < Base
9
+ def add_whenever
10
+ gem 'whenever', require: false
11
+ Bundler.with_clean_env { run 'rubocop -a Gemfile' }
12
+ Bundler.with_clean_env { run 'bundle install' }
13
+ end
14
+
15
+ def initialize_whenever
16
+ Bundler.with_clean_env { run "wheneverize #{destination_root}" }
17
+ end
18
+
19
+ def initialize_capistrano
20
+ return unless capistrano?
21
+
22
+ inject_into_file(
23
+ 'Capfile',
24
+ "require 'whenerver/capistrano'\n",
25
+ after: "# require \"capistrano/passenger\"\n"
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,24 @@
1
+ module Bankai
2
+ # :nodoc:
3
+ module Helper
4
+ protected
5
+
6
+ def pg?
7
+ gemfile.match?(/gem .pg./)
8
+ end
9
+
10
+ def mysql?
11
+ gemfile.match?(/gem .mysql2./)
12
+ end
13
+
14
+ def capistrano?
15
+ gemfile.match?(/gem .capistrano./)
16
+ end
17
+
18
+ private
19
+
20
+ def gemfile
21
+ @gemfile ||= File.read(destination_root + '/Gemfile')
22
+ end
23
+ end
24
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bankai
2
- VERSION = '0.2.2'.freeze
3
- RUBY_VERSION = '2.5.0'.freeze
4
- RAILS_VERSION = '5.2.2'.freeze
5
- RUBOCOP_VERSION = '0.60.0'.freeze
6
- CAPISTRANO_VERSION = '3.11.0'.freeze
4
+ VERSION = '0.2.3'
5
+ RUBY_VERSION = '2.6.0'
6
+ RAILS_VERSION = '5.2.3'
7
+ RUBOCOP_VERSION = '0.71.0'
8
+ CAPISTRANO_VERSION = '3.11.0'
7
9
  end
@@ -41,6 +41,8 @@ group :development, :test do
41
41
  gem 'brakeman', require: false
42
42
  gem 'bundler-audit', '~> 0.6.0', require: false
43
43
  gem 'rubocop', '~> <%= Bankai::RUBOCOP_VERSION %>', require: false
44
+ gem 'rubocop-performance', require: false
45
+ gem 'rubocop-rails', require: false
44
46
 
45
47
  <%- unless options[:skip_rspec] -%>
46
48
  gem 'database_rewinder'
@@ -93,14 +93,12 @@ Rails 需要 JavaScript Runtime 一般會使用 Node.js。
93
93
  brew install node
94
94
  ```
95
95
 
96
- <%- if options[:webpack] -%>
97
96
  Webpacker 使用 Yarn 管理安裝的 JavaScript 套件,我們還需要將 Yarn 安裝進來。
98
97
 
99
98
  ```bash
100
99
  brew install yarn
101
100
  ```
102
101
 
103
- <%- end -%>
104
102
  ### Rails
105
103
 
106
104
  請先透過 git 將專案下載到本地端。
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if ENV['RACK_MINI_PROFILER'].to_i.positive?
2
4
  require 'rack-mini-profiler'
3
5
 
@@ -1,3 +1,6 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rails
1
4
  AllCops:
2
5
  TargetRubyVersion: <%= RUBY_VERSION %>
3
6
  DisplayCopNames: true
@@ -23,6 +26,10 @@ Metrics:
23
26
  - config/**/*
24
27
  - spec/**/*
25
28
  - lib/tasks/**/*
29
+ Metrics/BlockLength:
30
+ Exclude:
31
+ - config/environments/*
32
+ - lib/tasks/**/*
26
33
  Layout:
27
34
  Exclude:
28
35
  - config/environments/*
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if ENV.fetch('COVERAGE', false)
3
+ if ENV.fetch('COVERAGE', false) || ENV.fetch('CI', false)
4
4
  require 'simplecov'
5
5
  SimpleCov.start 'rails' do
6
6
  add_filter 'vendor'
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.2.2
4
+ version: 0.2.3
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-02-16 00:00:00.000000000 Z
12
+ date: 2019-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.16'
20
+ version: 1.17.3
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.16'
27
+ version: 1.17.3
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler-audit
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 0.60.0
90
+ version: 0.71.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 0.60.0
97
+ version: 0.71.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: simplecov
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -115,14 +115,14 @@ dependencies:
115
115
  requirements:
116
116
  - - '='
117
117
  - !ruby/object:Gem::Version
118
- version: 5.2.2
118
+ version: 5.2.3
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - '='
124
124
  - !ruby/object:Gem::Version
125
- version: 5.2.2
125
+ version: 5.2.3
126
126
  description: The tool to generate Rails template for 5xRuby
127
127
  email:
128
128
  - hi@5xruby.tw
@@ -136,6 +136,7 @@ files:
136
136
  - ".gitlab-ci.yml"
137
137
  - ".overcommit.yml"
138
138
  - ".rspec"
139
+ - ".ruby-version"
139
140
  - ".travis.yml"
140
141
  - CODE_OF_CONDUCT.md
141
142
  - Gemfile
@@ -155,7 +156,10 @@ files:
155
156
  - lib/bankai/generators/json_generator.rb
156
157
  - lib/bankai/generators/lint_generator.rb
157
158
  - lib/bankai/generators/mailer_generator.rb
159
+ - lib/bankai/generators/sitemap_generator.rb
158
160
  - lib/bankai/generators/testing_generator.rb
161
+ - lib/bankai/generators/whenever_generator.rb
162
+ - lib/bankai/helper.rb
159
163
  - lib/bankai/version.rb
160
164
  - templates/Gemfile.erb
161
165
  - templates/README.md.erb
@@ -182,15 +186,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
186
  requirements:
183
187
  - - ">="
184
188
  - !ruby/object:Gem::Version
185
- version: 2.5.0
189
+ version: 2.6.0
186
190
  required_rubygems_version: !ruby/object:Gem::Requirement
187
191
  requirements:
188
192
  - - ">="
189
193
  - !ruby/object:Gem::Version
190
194
  version: '0'
191
195
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.7.6
196
+ rubygems_version: 3.0.1
194
197
  signing_key:
195
198
  specification_version: 4
196
199
  summary: The Rails template for 5xRuby