create-ruby-app 1.2.0 → 1.3.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/CLAUDE.md +74 -0
  4. data/CODE_REVIEW.md +1659 -0
  5. data/LICENSE +13 -21
  6. data/README.md +3 -3
  7. data/REFACTORING_PLAN.md +543 -0
  8. data/bin/create-ruby-app +1 -3
  9. data/lib/create_ruby_app/actions/create_directories.rb +10 -2
  10. data/lib/create_ruby_app/actions/generate_files.rb +7 -4
  11. data/lib/create_ruby_app/actions/install_gems.rb +10 -2
  12. data/lib/create_ruby_app/actions/make_script_executable.rb +10 -2
  13. data/lib/create_ruby_app/actions/set_ruby_implementation.rb +52 -0
  14. data/lib/create_ruby_app/app.rb +9 -8
  15. data/lib/create_ruby_app/cli.rb +58 -41
  16. data/lib/create_ruby_app/templates/Gemfile.erb +1 -3
  17. data/lib/create_ruby_app/templates/lib_file.erb +0 -2
  18. data/lib/create_ruby_app/templates/script_file.erb +0 -2
  19. data/lib/create_ruby_app/templates/spec_helper.erb +0 -2
  20. data/lib/create_ruby_app/version.rb +1 -3
  21. data/lib/create_ruby_app.rb +1 -3
  22. data/spec/integration/app_creation_spec.rb +170 -0
  23. data/spec/lib/create_ruby_app/actions/create_directories_spec.rb +1 -3
  24. data/spec/lib/create_ruby_app/actions/generate_files_spec.rb +12 -19
  25. data/spec/lib/create_ruby_app/actions/install_gems_spec.rb +1 -3
  26. data/spec/lib/create_ruby_app/actions/make_script_executable_spec.rb +1 -3
  27. data/spec/lib/create_ruby_app/actions/set_ruby_implementation_spec.rb +194 -0
  28. data/spec/lib/create_ruby_app/app_spec.rb +4 -4
  29. data/spec/lib/create_ruby_app/cli_spec.rb +112 -0
  30. data/spec/spec_helper.rb +6 -2
  31. metadata +52 -20
  32. data/lib/create_ruby_app/actions/null_action.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8190723f385297b3f0eff12248235b549fbd79ed77ec5247d9413ce3a0dbba1a
4
- data.tar.gz: 3fcc4a652f16b1bdf89d631f135323654e4530f1dcd5fee7b786f921db576a5d
3
+ metadata.gz: 8d20405b454bfa2076a2b9af3df3f6e0cd7f864df681bc6aeb55975779e32e41
4
+ data.tar.gz: 92cadf1af6d1f69721697279393ddadde6aa8382cc1b563be2700813a8bd4c19
5
5
  SHA512:
6
- metadata.gz: 708140451ae9f6780f4986fb06d051a18e7da119723020ef0e0a8f5355144703a686a1103c8649a40785ec00cf5b7bdb5846f28406f4a615159362b6255b60d2
7
- data.tar.gz: 484ddfe4f53806ecc09823e0f37ce425c0306bd792d00100888a0810c249f2bc33ff17e84afb3bebf097241e531a1ce08aea3fac09e1c982dba616bd9fa8f6f3
6
+ metadata.gz: ad20bf6ea501cc36c5e88f1fff6dfa7d367003976f9ebc2916b9cb0027a545951645e31eed7847ba0904ee000c12ede3e8d982c32f4263c60e7b7a07e0f38eb3
7
+ data.tar.gz: 88ad3c979c2be0ad4b3ada569ce34f3eb6ca540060920e1cbae39dd7765ac4c85f67896759e0e4ddf5f4df2aa50a88c7ef21a8124165dfe42d8cd276c487f217
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 1.3.0
2
+ - Bump dependencies and Ruby version to 3.4.5.
3
+ - Read locally installed Ruby implementation and version (Ruby, TruffleRuby,
4
+ JRuby, MRuby, etc.) if none is found.
5
+ - Add integration tests.
6
+ - Add test coverage using
7
+ [SimpleCov](https://github.com/simplecov-ruby/simplecov).
8
+ - Replace [Thor](https://github.com/rails/thor) with
9
+ [`dry-cli`](https://github.com/dry-rb/dry-cli) for command-line interface.
10
+
1
11
  # 1.2.0
2
12
  - Bump Ruby version to 2.7.1.
3
13
 
data/CLAUDE.md ADDED
@@ -0,0 +1,74 @@
1
+ # CLAUDE.md
2
+ This file provides guidance to Claude Code (claude.ai/code) when working with
3
+ code in this repository.
4
+
5
+ ## Project Overview
6
+ `create-ruby-app` is a CLI gem that scaffolds Ruby applications, similar to
7
+ Create React App but for Ruby. It generates minimal project structures for
8
+ non-Rails Ruby applications.
9
+
10
+ ## Commands
11
+ ### Testing
12
+ - `bundle exec rspec` - Run all tests
13
+ - `bundle exec rspec spec/path/to/specific_spec.rb` - Run a specific test file
14
+ - `rake test` or `rake` - Run tests via Rake (default task)
15
+
16
+ ### Development
17
+ - `bundle install` - Install dependencies
18
+ - `gem build create_ruby_app.gemspec` - Build the gem
19
+ - `gem install create-ruby-app-*.gem` - Install built gem locally
20
+
21
+ ### CLI Usage
22
+ - `create-ruby-app new NAME` - Generate new Ruby app
23
+ - `create-ruby-app new NAME --ruby RUBY_VERSION` - Generate with specific Ruby
24
+ version
25
+ - `create-ruby-app new NAME --gems gem1,gem2` - Generate with specific gems
26
+ - `create-ruby-app --version` - Show version
27
+
28
+ ## Architecture
29
+ The codebase follows a modular action-based architecture:
30
+
31
+ ### Core Components
32
+ - `CreateRubyApp::CLI` - Thor-based command line interface
33
+ (lib/create_ruby_app/cli.rb)
34
+ - `CreateRubyApp::App` - Main application orchestrator that executes actions
35
+ sequentially (lib/create_ruby_app/app.rb)
36
+ - Actions pattern - Each major operation is encapsulated in an action class in
37
+ `lib/create_ruby_app/actions/`
38
+
39
+ ### Action Flow
40
+ The app runs actions in this order:
41
+ 1. `CreateDirectories` - Creates project directory structure
42
+ 2. `FindRubyImplementation` - Determines Ruby version to use
43
+ 3. `GenerateFiles` - Creates files from ERB templates
44
+ 4. `MakeScriptExecutable` - Sets executable permissions on bin script
45
+ 5. `InstallGems` - Runs bundle install
46
+ 6. `NullAction` - Completion message
47
+
48
+ ### File Structure
49
+ - `lib/create_ruby_app/` - Main library code
50
+ - `lib/create_ruby_app/actions/` - Action classes implementing the Command
51
+ pattern
52
+ - `lib/create_ruby_app/templates/` - ERB templates for generated files
53
+ - `spec/` - RSpec tests mirroring lib structure
54
+ - `bin/create-ruby-app` - Executable script
55
+
56
+ ### Testing
57
+ - Uses RSpec with `expect` syntax and monkey patching disabled
58
+ - Tests are organized to mirror the lib directory structure
59
+ - Each action class has corresponding tests in
60
+ `spec/lib/create_ruby_app/actions/`
61
+
62
+ ## Key Implementation Details
63
+ - Uses Thor for CLI parsing and command definition
64
+ - Implements logging via Ruby's standard Logger class
65
+ - Template generation uses ERB for dynamic file creation
66
+ - Name normalization converts dashes to underscores for Ruby compatibility
67
+ - Actions follow a callable interface pattern where each action responds to `.call(app)`
68
+
69
+ ## Coding style
70
+ - Adhere to Rubocop recommendations and hints
71
+ - Use double-quotes instead of single quotes
72
+ - Follow DRY and SOLID coding style principles, design patterns when meaningful,
73
+ but do not overdo it. Prefer a functional programming style where possible.
74
+ - Aim at a minimum of 90 percent in test coverage for all new code written.