bankai 0.13.0 → 0.13.2

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: 1d0da7ded777600e85a5db17f10531070903d05eb40c0e89237886e640f587ed
4
- data.tar.gz: d802dc97d4210e38dfcd5bd56968d45883fc8c3df4a54b56d788515581d7329b
3
+ metadata.gz: da030856666f9e527cf687de02ea61830c233f9582e7375d9bfc76b85c62f1df
4
+ data.tar.gz: dfda0febd5da5e0f0e58506c3acff658197efadc03b0383e833026c1a3e1fca8
5
5
  SHA512:
6
- metadata.gz: a16b8787787d64fd10f9724684adb551780f9ed22523dcb567d97cddd28ac5dbb6423307b0a529452c6970213aae025c55181d5d91b57f97c6b72a2a8896afa3
7
- data.tar.gz: 80b26408614d15d0c6fff58f591abb5c6506b09c07d34290ad1a15aa1d332d126c5e17bf166e5b4ba82d7d28b8e053ee50f048afb0b6d13c42c0f26619eed74e
6
+ metadata.gz: 762ba6329657e2101e6086c6d9a464362616596f756c242e4cff18873ff7d3e09167cc60230d57abe1d8308eee099e13333f91b5ec7c9e927b2e3008af95a75b
7
+ data.tar.gz: 12b0a696f94479ba1392fbd61f9c1311c98188156547628fa425626183d89f53066f1f542397d962b2608802e27f622fc2d883db55cede45e8161481dbfc0329
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.4
1
+ 2.7.6
data/CLAUDE.md ADDED
@@ -0,0 +1,59 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ Bankai is a Rails application template generator by 5xRuby (inspired by thoughtbot's Suspenders). It generates new Rails projects pre-configured with 5xRuby's standard tooling: RSpec, Rubocop, Overcommit, GitLab CI, and more.
8
+
9
+ The CLI entry point is `exe/bankai`, which invokes `Bankai::Generator`.
10
+
11
+ ## Commands
12
+
13
+ ```bash
14
+ # Install dependencies
15
+ bin/setup
16
+
17
+ # Run tests
18
+ bundle exec rake # default task is :spec
19
+ bundle exec rspec # direct invocation
20
+ bundle exec rspec spec/bankai_spec.rb # single file
21
+
22
+ # Lint
23
+ bundle exec rubocop
24
+ bundle exec rubocop -a # auto-correct
25
+
26
+ # Interactive console
27
+ bin/console
28
+
29
+ # Test the generator locally (creates a new Rails app using local bankai)
30
+ bankai myapp --path=/path/to/local/bankai
31
+ ```
32
+
33
+ ## Architecture
34
+
35
+ ### Core Classes
36
+
37
+ - **`Bankai::Generator`** (`lib/bankai/generator.rb`) — Extends `Rails::Generators::AppGenerator`. Orchestrates the full project generation via the `customization` method, which calls steps in order: gemfile replacement, development environment setup, app configuration, dotfiles, sub-generators, and directory scaffolding.
38
+
39
+ - **`Bankai::Builder`** (`lib/bankai/builder.rb`) — Extends `Rails::AppBuilder`. Contains the actual file operations (template rendering, file copying, Rails config insertion) that the Generator delegates to via `build` calls.
40
+
41
+ - **`Bankai::Helper`** (`lib/bankai/helper.rb`) — Mixin providing database (`pg?`, `mysql?`) and deployment (`capistrano?`) detection by reading the generated Gemfile.
42
+
43
+ ### Sub-Generators (`lib/bankai/generators/`)
44
+
45
+ Each sub-generator inherits from `Bankai::Generators::Base` and handles one concern (testing, CI, linting, JSON, DB optimizations, mailer, deploy, sitemap, whenever). They are invoked from `Generator#generate_default`.
46
+
47
+ ### Templates (`templates/`)
48
+
49
+ ERB templates for generated project files (Gemfile, .rubocop.yml, .gitlab-ci.yml, etc.). Templates use conditional logic based on generator options (database type, API mode, capistrano flag).
50
+
51
+ ## Key Options
52
+
53
+ The generator accepts: `--database` (postgresql/mysql2/sqlite3, default: postgresql), `--capistrano`, `--skip-rspec`, `--api`, `--path` (local gem path for testing).
54
+
55
+ ## Conventions
56
+
57
+ - All Ruby files use `# frozen_string_literal: true`
58
+ - Version constants are in `lib/bankai/version.rb`
59
+ - Generated project README templates are in Traditional Chinese (zh-TW)
data/bankai.gemspec CHANGED
@@ -27,7 +27,6 @@ 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', '~> 2.2.26'
31
30
  spec.add_development_dependency 'bundler-audit'
32
31
  spec.add_development_dependency 'overcommit'
33
32
  spec.add_development_dependency 'rake', '~> 12.0'
@@ -8,9 +8,17 @@ module Bankai
8
8
  class Generator < Rails::Generators::AppGenerator
9
9
  hide!
10
10
 
11
+ SUPPORTED_DATABASES = if defined?(Rails::Generators::Database::DATABASES)
12
+ Rails::Generators::Database::DATABASES
13
+ elsif defined?(DATABASES)
14
+ DATABASES
15
+ else
16
+ %w[postgresql mysql2 sqlite3]
17
+ end
18
+
11
19
  class_option :database, type: :string, aliases: '-d', default: 'postgresql',
12
20
  desc: 'Configure for selected database ' \
13
- "(options: #{DATABASES.join('/')})"
21
+ "(options: #{SUPPORTED_DATABASES.join('/')})"
14
22
 
15
23
  class_option :capistrano, type: :boolean, default: false,
16
24
  desc: 'Use Capistrano'
@@ -66,15 +74,17 @@ module Bankai
66
74
  end
67
75
 
68
76
  def generate_default
69
- run('spring stop')
70
- generate('bankai:testing') unless options[:skip_rspec]
71
- generate('bankai:ci', options.api? ? '--api' : '')
72
- generate('bankai:json')
73
- generate('bankai:db_optimizations')
74
- generate('bankai:mailer')
75
- generate('bankai:deploy') if options[:capistrano]
76
- generate('annotate:install')
77
- generate('bankai:lint')
77
+ run('bundle binstubs bundler')
78
+ Bundler.with_unbundled_env do
79
+ generate('bankai:testing') unless options[:skip_rspec]
80
+ generate('bankai:ci', options.api? ? '--api' : '')
81
+ generate('bankai:json')
82
+ generate('bankai:db_optimizations')
83
+ generate('bankai:mailer')
84
+ generate('bankai:deploy') if options[:capistrano]
85
+ generate('annotate:install')
86
+ generate('bankai:lint')
87
+ end
78
88
  end
79
89
 
80
90
  def setup_default_directories
@@ -91,6 +101,10 @@ module Bankai
91
101
 
92
102
  protected
93
103
 
104
+ def rails_command(command, command_options = {})
105
+ Bundler.with_unbundled_env { super }
106
+ end
107
+
94
108
  # rubocop:disable Naming/AccessorMethodName
95
109
  def get_builder_class
96
110
  Bankai::Builder
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bankai
4
- VERSION = '0.13.0'
4
+ VERSION = '0.13.2'
5
5
  RUBY_VERSION = '2.6.7'
6
6
  RAILS_VERSION = '7.0.0'
7
7
  RUBOCOP_VERSION = '1.24.1'
@@ -22,7 +22,7 @@ gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
22
22
  # Reduces boot times through caching; required in config/boot.rb
23
23
  gem "bootsnap", require: false
24
24
  <% end -%>
25
- <% unless skip_sprockets? || options.minimal? -%>
25
+ <% unless (respond_to?(:skip_sprockets?) ? skip_sprockets? : true) || options.minimal? -%>
26
26
 
27
27
  # Use Sass to process CSS
28
28
  # gem "sassc-rails"
@@ -56,7 +56,6 @@ group :development, :test do
56
56
  gem 'faker'
57
57
  gem 'rspec', require: false
58
58
  gem 'rspec-rails', require: false
59
- gem 'shoulda', require: false
60
59
  gem 'shoulda-matchers', require: false
61
60
  gem 'simplecov', require: false
62
61
  gem 'simplecov-cobertura', require: false
@@ -135,7 +135,8 @@ bundle exec rake db:migrate
135
135
 
136
136
  ```
137
137
  # 0.5.2 是目前的版本,之後有更新情參考錯誤訊息指示的版本
138
- gem install mysql2 -v 0.5.2 -- --with-mysql-config=/usr/local/opt/mysql@5.7/bin/mysql_config
138
+ export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix openssl)/lib
139
+ gem install mysql2 -v 0.5.2 -- --with-mysql-config=$(brew --prefix mysql@5.7)/bin/mysql_config
139
140
  ```
140
141
 
141
142
  <%- end -%>
@@ -134,4 +134,6 @@ rspec:
134
134
  - if: $CI_MERGE_REQUEST_ID
135
135
  artifacts:
136
136
  reports:
137
- cobertura: coverage/coverage.xml
137
+ coverage_report:
138
+ coverage_format: cobertura
139
+ path: coverage/coverage.xml
@@ -7,7 +7,6 @@ require File.expand_path('../config/environment', __dir__)
7
7
  abort('The Rails is running in production mode!') if Rails.env.production?
8
8
  require 'rspec/rails'
9
9
 
10
- require 'shoulda'
11
10
  require 'shoulda/matchers'
12
11
  require 'faker'
13
12
  require 'factory_bot'
@@ -5,6 +5,7 @@ if ENV.fetch('COVERAGE', false) || ENV.fetch('CI', false)
5
5
  require 'simplecov-cobertura'
6
6
 
7
7
  SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter if ENV.fetch('GITLAB_CI', false)
8
+ SimpleCov.refuse_coverage_drop
8
9
 
9
10
  SimpleCov.start 'rails' do
10
11
  add_filter 'vendor'
metadata CHANGED
@@ -1,30 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bankai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 5xRuby
8
8
  - 蒼時弦也
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2022-01-10 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: bundler
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: 2.2.26
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: 2.2.26
28
13
  - !ruby/object:Gem::Dependency
29
14
  name: bundler-audit
30
15
  requirement: !ruby/object:Gem::Requirement
@@ -153,6 +138,7 @@ files:
153
138
  - ".rubocop.yml"
154
139
  - ".ruby-version"
155
140
  - ".travis.yml"
141
+ - CLAUDE.md
156
142
  - CODE_OF_CONDUCT.md
157
143
  - Gemfile
158
144
  - README.md
@@ -193,7 +179,6 @@ files:
193
179
  homepage: https://github.com/5xRuby/bankai
194
180
  licenses: []
195
181
  metadata: {}
196
- post_install_message:
197
182
  rdoc_options: []
198
183
  require_paths:
199
184
  - lib
@@ -208,8 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
193
  - !ruby/object:Gem::Version
209
194
  version: '0'
210
195
  requirements: []
211
- rubygems_version: 3.2.26
212
- signing_key:
196
+ rubygems_version: 3.6.9
213
197
  specification_version: 4
214
198
  summary: The Rails template for 5xRuby
215
199
  test_files: []