bankai 0.13.1 → 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 +4 -4
- data/CLAUDE.md +59 -0
- data/lib/bankai/generator.rb +24 -10
- data/lib/bankai/version.rb +1 -1
- data/templates/Gemfile.erb +1 -2
- data/templates/rails_helper.rb +0 -1
- metadata +4 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da030856666f9e527cf687de02ea61830c233f9582e7375d9bfc76b85c62f1df
|
|
4
|
+
data.tar.gz: dfda0febd5da5e0f0e58506c3acff658197efadc03b0383e833026c1a3e1fca8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 762ba6329657e2101e6086c6d9a464362616596f756c242e4cff18873ff7d3e09167cc60230d57abe1d8308eee099e13333f91b5ec7c9e927b2e3008af95a75b
|
|
7
|
+
data.tar.gz: 12b0a696f94479ba1392fbd61f9c1311c98188156547628fa425626183d89f53066f1f542397d962b2608802e27f622fc2d883db55cede45e8161481dbfc0329
|
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/lib/bankai/generator.rb
CHANGED
|
@@ -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: #{
|
|
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('
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
data/lib/bankai/version.rb
CHANGED
data/templates/Gemfile.erb
CHANGED
|
@@ -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
|
data/templates/rails_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bankai
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.13.
|
|
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:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: bundler-audit
|
|
@@ -139,6 +138,7 @@ files:
|
|
|
139
138
|
- ".rubocop.yml"
|
|
140
139
|
- ".ruby-version"
|
|
141
140
|
- ".travis.yml"
|
|
141
|
+
- CLAUDE.md
|
|
142
142
|
- CODE_OF_CONDUCT.md
|
|
143
143
|
- Gemfile
|
|
144
144
|
- README.md
|
|
@@ -179,7 +179,6 @@ files:
|
|
|
179
179
|
homepage: https://github.com/5xRuby/bankai
|
|
180
180
|
licenses: []
|
|
181
181
|
metadata: {}
|
|
182
|
-
post_install_message:
|
|
183
182
|
rdoc_options: []
|
|
184
183
|
require_paths:
|
|
185
184
|
- lib
|
|
@@ -194,8 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
194
193
|
- !ruby/object:Gem::Version
|
|
195
194
|
version: '0'
|
|
196
195
|
requirements: []
|
|
197
|
-
rubygems_version: 3.
|
|
198
|
-
signing_key:
|
|
196
|
+
rubygems_version: 3.6.9
|
|
199
197
|
specification_version: 4
|
|
200
198
|
summary: The Rails template for 5xRuby
|
|
201
199
|
test_files: []
|