rubysmith 0.9.1 → 0.13.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 +4 -4
 - checksums.yaml.gz.sig +0 -0
 - data/README.adoc +34 -20
 - data/bin/rubysmith +0 -1
 - data/lib/rubysmith/builder.rb +17 -35
 - data/lib/rubysmith/builders/bundler.rb +7 -9
 - data/lib/rubysmith/builders/console.rb +6 -8
 - data/lib/rubysmith/builders/core.rb +11 -8
 - data/lib/rubysmith/builders/documentation.rb +16 -21
 - data/lib/rubysmith/builders/git/commit.rb +7 -11
 - data/lib/rubysmith/builders/git/setup.rb +6 -8
 - data/lib/rubysmith/builders/guard.rb +9 -9
 - data/lib/rubysmith/builders/pragma.rb +8 -13
 - data/lib/rubysmith/builders/rake.rb +7 -7
 - data/lib/rubysmith/builders/reek.rb +6 -8
 - data/lib/rubysmith/builders/rspec/context.rb +10 -11
 - data/lib/rubysmith/builders/rspec/helper.rb +6 -8
 - data/lib/rubysmith/builders/rubocop/formatter.rb +5 -7
 - data/lib/rubysmith/builders/rubocop/setup.rb +7 -9
 - data/lib/rubysmith/builders/setup.rb +8 -8
 - data/lib/rubysmith/cli/actions/build.rb +42 -0
 - data/lib/rubysmith/cli/actions/config.rb +33 -0
 - data/lib/rubysmith/cli/configuration/content.rb +78 -0
 - data/lib/rubysmith/cli/{defaults.yml → configuration/defaults.yml} +3 -3
 - data/lib/rubysmith/cli/configuration/loader.rb +38 -0
 - data/lib/rubysmith/cli/parsers/assembler.rb +11 -18
 - data/lib/rubysmith/cli/parsers/build.rb +40 -41
 - data/lib/rubysmith/cli/parsers/core.rb +15 -14
 - data/lib/rubysmith/cli/parsers.rb +11 -0
 - data/lib/rubysmith/cli/shell.rb +14 -35
 - data/lib/rubysmith/container.rb +37 -0
 - data/lib/rubysmith/identity.rb +2 -2
 - data/lib/rubysmith/pathway.rb +3 -9
 - data/lib/rubysmith/renderers/erb.rb +7 -9
 - data/lib/rubysmith/renderers/namespace.rb +2 -4
 - data/lib/rubysmith/templates/%project_name%/.rubocop.yml.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +2 -2
 - data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/Gemfile.erb +46 -50
 - data/lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/README.adoc.erb +5 -5
 - data/lib/rubysmith/templates/%project_name%/README.md.erb +5 -5
 - data/lib/rubysmith/templates/%project_name%/Rakefile.erb +11 -23
 - data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
 - data/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +12 -0
 - data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +6 -4
 - data/lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb +3 -3
 - data/lib/rubysmith.rb +10 -30
 - data.tar.gz.sig +0 -0
 - metadata +55 -13
 - metadata.gz.sig +0 -0
 - data/lib/rubysmith/builders/ruby_critic.rb +0 -27
 - data/lib/rubysmith/cli/configuration.rb +0 -30
 - data/lib/rubysmith/cli/processors/build.rb +0 -58
 - data/lib/rubysmith/cli/processors/config.rb +0 -35
 - data/lib/rubysmith/realm.rb +0 -74
 - data/lib/rubysmith/templates/%project_name%/.rubycritic.yml.erb +0 -3
 - data/lib/rubysmith/templates/%project_name%/lib/%project_name%.rb.erb +0 -3
 
| 
         @@ -5,24 +5,22 @@ module Rubysmith 
     | 
|
| 
       5 
5 
     | 
    
         
             
                module Git
         
     | 
| 
       6 
6 
     | 
    
         
             
                  # Initializes project skeleton as a Git repository.
         
     | 
| 
       7 
7 
     | 
    
         
             
                  class Setup
         
     | 
| 
       8 
     | 
    
         
            -
                    def self.call  
     | 
| 
       9 
     | 
    
         
            -
                      new(realm, builder: builder).call
         
     | 
| 
       10 
     | 
    
         
            -
                    end
         
     | 
| 
      
 8 
     | 
    
         
            +
                    def self.call(...) = new(...).call
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                    def initialize  
     | 
| 
       13 
     | 
    
         
            -
                      @ 
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize configuration, builder: Builder
         
     | 
| 
      
 11 
     | 
    
         
            +
                      @configuration = configuration
         
     | 
| 
       14 
12 
     | 
    
         
             
                      @builder = builder
         
     | 
| 
       15 
13 
     | 
    
         
             
                    end
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
15 
     | 
    
         
             
                    def call
         
     | 
| 
       18 
     | 
    
         
            -
                      return unless  
     | 
| 
      
 16 
     | 
    
         
            +
                      return unless configuration.build_git
         
     | 
| 
       19 
17 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                      builder.call( 
     | 
| 
      
 18 
     | 
    
         
            +
                      builder.call(configuration).run("git init", chdir: configuration.project_name)
         
     | 
| 
       21 
19 
     | 
    
         
             
                    end
         
     | 
| 
       22 
20 
     | 
    
         | 
| 
       23 
21 
     | 
    
         
             
                    private
         
     | 
| 
       24 
22 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                    attr_reader : 
     | 
| 
      
 23 
     | 
    
         
            +
                    attr_reader :configuration, :builder
         
     | 
| 
       26 
24 
     | 
    
         
             
                  end
         
     | 
| 
       27 
25 
     | 
    
         
             
                end
         
     | 
| 
       28 
26 
     | 
    
         
             
              end
         
     | 
| 
         @@ -4,25 +4,25 @@ module Rubysmith 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Builders
         
     | 
| 
       5 
5 
     | 
    
         
             
                # Builds project skeleton Guard support for a red, green, refactor loop.
         
     | 
| 
       6 
6 
     | 
    
         
             
                class Guard
         
     | 
| 
       7 
     | 
    
         
            -
                  def self.call  
     | 
| 
       8 
     | 
    
         
            -
                    new(realm, builder: builder).call
         
     | 
| 
       9 
     | 
    
         
            -
                  end
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def self.call(...) = new(...).call
         
     | 
| 
       10 
8 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  def initialize  
     | 
| 
       12 
     | 
    
         
            -
                    @ 
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize configuration, builder: Builder
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @configuration = configuration
         
     | 
| 
       13 
11 
     | 
    
         
             
                    @builder = builder
         
     | 
| 
       14 
12 
     | 
    
         
             
                  end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
14 
     | 
    
         
             
                  def call
         
     | 
| 
       17 
     | 
    
         
            -
                    return unless  
     | 
| 
      
 15 
     | 
    
         
            +
                    return unless configuration.build_guard
         
     | 
| 
       18 
16 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                    builder.call( 
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
                    builder.call(configuration.with(template_path: "%project_name%/bin/guard.erb"))
         
     | 
| 
      
 18 
     | 
    
         
            +
                           .render
         
     | 
| 
      
 19 
     | 
    
         
            +
                           .permit 0o755
         
     | 
| 
      
 20 
     | 
    
         
            +
                    builder.call(configuration.with(template_path: "%project_name%/Guardfile.erb")).render
         
     | 
| 
       21 
21 
     | 
    
         
             
                  end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                  private
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                  attr_reader : 
     | 
| 
      
 25 
     | 
    
         
            +
                  attr_reader :configuration, :builder
         
     | 
| 
       26 
26 
     | 
    
         
             
                end
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         
             
            end
         
     | 
| 
         @@ -6,30 +6,25 @@ module Rubysmith 
     | 
|
| 
       6 
6 
     | 
    
         
             
              module Builders
         
     | 
| 
       7 
7 
     | 
    
         
             
                # Builds project skeleton pragmas so all Ruby strings are frozen by default.
         
     | 
| 
       8 
8 
     | 
    
         
             
                class Pragma
         
     | 
| 
       9 
     | 
    
         
            -
                  def self.call  
     | 
| 
       10 
     | 
    
         
            -
                    new(realm).call
         
     | 
| 
       11 
     | 
    
         
            -
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
                  def self.call(...) = new(...).call
         
     | 
| 
       12 
10 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                  def initialize  
     | 
| 
       14 
     | 
    
         
            -
                    @ 
     | 
| 
      
 11 
     | 
    
         
            +
                  def initialize configuration, client: Pragmater::Runner
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @configuration = configuration
         
     | 
| 
       15 
13 
     | 
    
         
             
                    @client = client
         
     | 
| 
       16 
14 
     | 
    
         
             
                  end
         
     | 
| 
       17 
15 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                  def call
         
     | 
| 
       19 
     | 
    
         
            -
                    client.for(**attributes).call
         
     | 
| 
       20 
     | 
    
         
            -
                    nil
         
     | 
| 
       21 
     | 
    
         
            -
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
                  def call = client.for(**attributes).call && nil
         
     | 
| 
       22 
17 
     | 
    
         | 
| 
       23 
18 
     | 
    
         
             
                  private
         
     | 
| 
       24 
19 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                  attr_reader : 
     | 
| 
      
 20 
     | 
    
         
            +
                  attr_reader :configuration, :client
         
     | 
| 
       26 
21 
     | 
    
         | 
| 
       27 
22 
     | 
    
         
             
                  def attributes
         
     | 
| 
       28 
23 
     | 
    
         
             
                    {
         
     | 
| 
       29 
24 
     | 
    
         
             
                      action: :insert,
         
     | 
| 
       30 
     | 
    
         
            -
                      root_dir:  
     | 
| 
       31 
     | 
    
         
            -
                      comments:  
     | 
| 
       32 
     | 
    
         
            -
                      includes:  
     | 
| 
      
 25 
     | 
    
         
            +
                      root_dir: configuration.project_root,
         
     | 
| 
      
 26 
     | 
    
         
            +
                      comments: configuration.builders_pragmater_comments,
         
     | 
| 
      
 27 
     | 
    
         
            +
                      includes: configuration.builders_pragmater_includes
         
     | 
| 
       33 
28 
     | 
    
         
             
                    }
         
     | 
| 
       34 
29 
     | 
    
         
             
                  end
         
     | 
| 
       35 
30 
     | 
    
         
             
                end
         
     | 
| 
         @@ -4,17 +4,17 @@ module Rubysmith 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Builders
         
     | 
| 
       5 
5 
     | 
    
         
             
                # Builds project skeleton Rake support.
         
     | 
| 
       6 
6 
     | 
    
         
             
                class Rake
         
     | 
| 
       7 
     | 
    
         
            -
                  def self.call  
     | 
| 
       8 
     | 
    
         
            -
                    new(realm, builder: builder).call
         
     | 
| 
       9 
     | 
    
         
            -
                  end
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def self.call(...) = new(...).call
         
     | 
| 
       10 
8 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  def initialize  
     | 
| 
       12 
     | 
    
         
            -
                    @ 
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize configuration, builder: Builder
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @configuration = configuration
         
     | 
| 
       13 
11 
     | 
    
         
             
                    @builder = builder
         
     | 
| 
       14 
12 
     | 
    
         
             
                  end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
14 
     | 
    
         
             
                  def call
         
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
      
 15 
     | 
    
         
            +
                    return unless configuration.build_rake
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                    builder.call(configuration.with(template_path: "%project_name%/Rakefile.erb"))
         
     | 
| 
       18 
18 
     | 
    
         
             
                           .render
         
     | 
| 
       19 
19 
     | 
    
         
             
                           .replace(/\[\s+/, "[")
         
     | 
| 
       20 
20 
     | 
    
         
             
                           .replace(/\s+\]/, "]")
         
     | 
| 
         @@ -26,7 +26,7 @@ module Rubysmith 
     | 
|
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
                  private
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                  attr_reader : 
     | 
| 
      
 29 
     | 
    
         
            +
                  attr_reader :configuration, :builder
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
32 
     | 
    
         
             
            end
         
     | 
| 
         @@ -4,24 +4,22 @@ module Rubysmith 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Builders
         
     | 
| 
       5 
5 
     | 
    
         
             
                # Builds project skeleton Reek code quality support.
         
     | 
| 
       6 
6 
     | 
    
         
             
                class Reek
         
     | 
| 
       7 
     | 
    
         
            -
                  def self.call  
     | 
| 
       8 
     | 
    
         
            -
                    new(realm, builder: builder).call
         
     | 
| 
       9 
     | 
    
         
            -
                  end
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def self.call(...) = new(...).call
         
     | 
| 
       10 
8 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  def initialize  
     | 
| 
       12 
     | 
    
         
            -
                    @ 
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize configuration, builder: Builder
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @configuration = configuration
         
     | 
| 
       13 
11 
     | 
    
         
             
                    @builder = builder
         
     | 
| 
       14 
12 
     | 
    
         
             
                  end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
14 
     | 
    
         
             
                  def call
         
     | 
| 
       17 
     | 
    
         
            -
                    return unless  
     | 
| 
      
 15 
     | 
    
         
            +
                    return unless configuration.build_reek
         
     | 
| 
       18 
16 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                    builder.call( 
     | 
| 
      
 17 
     | 
    
         
            +
                    builder.call(configuration.with(template_path: "%project_name%/.reek.yml.erb")).render
         
     | 
| 
       20 
18 
     | 
    
         
             
                  end
         
     | 
| 
       21 
19 
     | 
    
         | 
| 
       22 
20 
     | 
    
         
             
                  private
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                  attr_reader : 
     | 
| 
      
 22 
     | 
    
         
            +
                  attr_reader :configuration, :builder
         
     | 
| 
       25 
23 
     | 
    
         
             
                end
         
     | 
| 
       26 
24 
     | 
    
         
             
              end
         
     | 
| 
       27 
25 
     | 
    
         
             
            end
         
     | 
| 
         @@ -5,27 +5,26 @@ module Rubysmith 
     | 
|
| 
       5 
5 
     | 
    
         
             
                module RSpec
         
     | 
| 
       6 
6 
     | 
    
         
             
                  # Builds RSpec shared context for temporary directories.
         
     | 
| 
       7 
7 
     | 
    
         
             
                  class Context
         
     | 
| 
       8 
     | 
    
         
            -
                    def self.call  
     | 
| 
       9 
     | 
    
         
            -
                      new(realm, builder: builder).call
         
     | 
| 
       10 
     | 
    
         
            -
                    end
         
     | 
| 
      
 8 
     | 
    
         
            +
                    def self.call(...) = new(...).call
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                    def initialize  
     | 
| 
       13 
     | 
    
         
            -
                      @ 
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize configuration, builder: Builder
         
     | 
| 
      
 11 
     | 
    
         
            +
                      @configuration = configuration
         
     | 
| 
       14 
12 
     | 
    
         
             
                      @builder = builder
         
     | 
| 
       15 
13 
     | 
    
         
             
                    end
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
15 
     | 
    
         
             
                    def call
         
     | 
| 
       18 
     | 
    
         
            -
                      return unless  
     | 
| 
      
 16 
     | 
    
         
            +
                      return unless configuration.build_rspec
         
     | 
| 
       19 
17 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                       
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
                      template = "%project_name%/spec/support/shared_contexts/temp_dir.rb.erb"
         
     | 
| 
      
 19 
     | 
    
         
            +
                      configuration.with(template_path: template)
         
     | 
| 
      
 20 
     | 
    
         
            +
                                   .then { |updated_configuration| builder.call updated_configuration }
         
     | 
| 
      
 21 
     | 
    
         
            +
                                   .render
         
     | 
| 
      
 22 
     | 
    
         
            +
                                   .replace(/\n\s+\n\s+/, "\n  ")
         
     | 
| 
       24 
23 
     | 
    
         
             
                    end
         
     | 
| 
       25 
24 
     | 
    
         | 
| 
       26 
25 
     | 
    
         
             
                    private
         
     | 
| 
       27 
26 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                    attr_reader : 
     | 
| 
      
 27 
     | 
    
         
            +
                    attr_reader :configuration, :builder
         
     | 
| 
       29 
28 
     | 
    
         
             
                  end
         
     | 
| 
       30 
29 
     | 
    
         
             
                end
         
     | 
| 
       31 
30 
     | 
    
         
             
              end
         
     | 
| 
         @@ -5,19 +5,17 @@ module Rubysmith 
     | 
|
| 
       5 
5 
     | 
    
         
             
                module RSpec
         
     | 
| 
       6 
6 
     | 
    
         
             
                  # Builds RSpec spec helper for project skeleton.
         
     | 
| 
       7 
7 
     | 
    
         
             
                  class Helper
         
     | 
| 
       8 
     | 
    
         
            -
                    def self.call  
     | 
| 
       9 
     | 
    
         
            -
                      new(realm, builder: builder).call
         
     | 
| 
       10 
     | 
    
         
            -
                    end
         
     | 
| 
      
 8 
     | 
    
         
            +
                    def self.call(...) = new(...).call
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                    def initialize  
     | 
| 
       13 
     | 
    
         
            -
                      @ 
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize configuration, builder: Builder
         
     | 
| 
      
 11 
     | 
    
         
            +
                      @configuration = configuration
         
     | 
| 
       14 
12 
     | 
    
         
             
                      @builder = builder
         
     | 
| 
       15 
13 
     | 
    
         
             
                    end
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
15 
     | 
    
         
             
                    def call
         
     | 
| 
       18 
     | 
    
         
            -
                      return unless  
     | 
| 
      
 16 
     | 
    
         
            +
                      return unless configuration.build_rspec
         
     | 
| 
       19 
17 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                      builder.call( 
     | 
| 
      
 18 
     | 
    
         
            +
                      builder.call(configuration.with(template_path: "%project_name%/spec/spec_helper.rb.erb"))
         
     | 
| 
       21 
19 
     | 
    
         
             
                             .render
         
     | 
| 
       22 
20 
     | 
    
         
             
                             .replace(/\n{3,}/, "\n\n")
         
     | 
| 
       23 
21 
     | 
    
         
             
                             .replace(/\n\s{2}(?=(require|Simple|using|Pathname|Dir))/, "\n")
         
     | 
| 
         @@ -25,7 +23,7 @@ module Rubysmith 
     | 
|
| 
       25 
23 
     | 
    
         | 
| 
       26 
24 
     | 
    
         
             
                    private
         
     | 
| 
       27 
25 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                    attr_reader : 
     | 
| 
      
 26 
     | 
    
         
            +
                    attr_reader :configuration, :builder
         
     | 
| 
       29 
27 
     | 
    
         
             
                  end
         
     | 
| 
       30 
28 
     | 
    
         
             
                end
         
     | 
| 
       31 
29 
     | 
    
         
             
              end
         
     | 
| 
         @@ -10,23 +10,21 @@ module Rubysmith 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  class Formatter
         
     | 
| 
       11 
11 
     | 
    
         
             
                    using Refinements::IOs
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                    def self.call  
     | 
| 
       14 
     | 
    
         
            -
                      new(realm).call
         
     | 
| 
       15 
     | 
    
         
            -
                    end
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def self.call(...) = new(...).call
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                    def initialize  
     | 
| 
       18 
     | 
    
         
            -
                      @ 
     | 
| 
      
 15 
     | 
    
         
            +
                    def initialize configuration, client: RuboCop::CLI.new
         
     | 
| 
      
 16 
     | 
    
         
            +
                      @configuration = configuration
         
     | 
| 
       19 
17 
     | 
    
         
             
                      @client = client
         
     | 
| 
       20 
18 
     | 
    
         
             
                    end
         
     | 
| 
       21 
19 
     | 
    
         | 
| 
       22 
20 
     | 
    
         
             
                    def call
         
     | 
| 
       23 
     | 
    
         
            -
                      STDOUT.squelch { client.run ["--auto-correct",  
     | 
| 
      
 21 
     | 
    
         
            +
                      STDOUT.squelch { client.run ["--auto-correct", configuration.project_root.to_s] }
         
     | 
| 
       24 
22 
     | 
    
         
             
                      nil
         
     | 
| 
       25 
23 
     | 
    
         
             
                    end
         
     | 
| 
       26 
24 
     | 
    
         | 
| 
       27 
25 
     | 
    
         
             
                    private
         
     | 
| 
       28 
26 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                    attr_reader : 
     | 
| 
      
 27 
     | 
    
         
            +
                    attr_reader :configuration, :client
         
     | 
| 
       30 
28 
     | 
    
         
             
                  end
         
     | 
| 
       31 
29 
     | 
    
         
             
                end
         
     | 
| 
       32 
30 
     | 
    
         
             
              end
         
     | 
| 
         @@ -5,28 +5,26 @@ module Rubysmith 
     | 
|
| 
       5 
5 
     | 
    
         
             
                module Rubocop
         
     | 
| 
       6 
6 
     | 
    
         
             
                  # Builds project skeleton for Rubocop code quality support.
         
     | 
| 
       7 
7 
     | 
    
         
             
                  class Setup
         
     | 
| 
       8 
     | 
    
         
            -
                    def self.call  
     | 
| 
       9 
     | 
    
         
            -
                      new(realm, builder: builder).call
         
     | 
| 
       10 
     | 
    
         
            -
                    end
         
     | 
| 
      
 8 
     | 
    
         
            +
                    def self.call(...) = new(...).call
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                    def initialize  
     | 
| 
       13 
     | 
    
         
            -
                      @ 
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize configuration, builder: Builder
         
     | 
| 
      
 11 
     | 
    
         
            +
                      @configuration = configuration
         
     | 
| 
       14 
12 
     | 
    
         
             
                      @builder = builder
         
     | 
| 
       15 
13 
     | 
    
         
             
                    end
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
15 
     | 
    
         
             
                    def call
         
     | 
| 
       18 
     | 
    
         
            -
                      return unless  
     | 
| 
      
 16 
     | 
    
         
            +
                      return unless configuration.build_rubocop
         
     | 
| 
       19 
17 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                      builder.call( 
     | 
| 
      
 18 
     | 
    
         
            +
                      builder.call(configuration.with(template_path: "%project_name%/bin/rubocop.erb"))
         
     | 
| 
       21 
19 
     | 
    
         
             
                             .render
         
     | 
| 
       22 
20 
     | 
    
         
             
                             .permit 0o755
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                      builder.call( 
     | 
| 
      
 22 
     | 
    
         
            +
                      builder.call(configuration.with(template_path: "%project_name%/.rubocop.yml.erb")).render
         
     | 
| 
       25 
23 
     | 
    
         
             
                    end
         
     | 
| 
       26 
24 
     | 
    
         | 
| 
       27 
25 
     | 
    
         
             
                    private
         
     | 
| 
       28 
26 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                    attr_reader : 
     | 
| 
      
 27 
     | 
    
         
            +
                    attr_reader :configuration, :builder
         
     | 
| 
       30 
28 
     | 
    
         
             
                  end
         
     | 
| 
       31 
29 
     | 
    
         
             
                end
         
     | 
| 
       32 
30 
     | 
    
         
             
              end
         
     | 
| 
         @@ -4,24 +4,24 @@ module Rubysmith 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Builders
         
     | 
| 
       5 
5 
     | 
    
         
             
                # Builds project skeleton setup script.
         
     | 
| 
       6 
6 
     | 
    
         
             
                class Setup
         
     | 
| 
       7 
     | 
    
         
            -
                  def self.call  
     | 
| 
       8 
     | 
    
         
            -
                    new(realm, builder: builder).call
         
     | 
| 
       9 
     | 
    
         
            -
                  end
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def self.call(...) = new(...).call
         
     | 
| 
       10 
8 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  def initialize  
     | 
| 
       12 
     | 
    
         
            -
                    @ 
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize configuration, builder: Builder
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @configuration = configuration
         
     | 
| 
       13 
11 
     | 
    
         
             
                    @builder = builder
         
     | 
| 
       14 
12 
     | 
    
         
             
                  end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
14 
     | 
    
         
             
                  def call
         
     | 
| 
       17 
     | 
    
         
            -
                    return unless  
     | 
| 
      
 15 
     | 
    
         
            +
                    return unless configuration.build_setup
         
     | 
| 
       18 
16 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                    builder.call( 
     | 
| 
      
 17 
     | 
    
         
            +
                    builder.call(configuration.with(template_path: "%project_name%/bin/setup.erb"))
         
     | 
| 
      
 18 
     | 
    
         
            +
                           .render
         
     | 
| 
      
 19 
     | 
    
         
            +
                           .permit 0o755
         
     | 
| 
       20 
20 
     | 
    
         
             
                  end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                  private
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                  attr_reader : 
     | 
| 
      
 24 
     | 
    
         
            +
                  attr_reader :configuration, :builder
         
     | 
| 
       25 
25 
     | 
    
         
             
                end
         
     | 
| 
       26 
26 
     | 
    
         
             
              end
         
     | 
| 
       27 
27 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Rubysmith
         
     | 
| 
      
 4 
     | 
    
         
            +
              module CLI
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Actions
         
     | 
| 
      
 6 
     | 
    
         
            +
                  # Handles the build action.
         
     | 
| 
      
 7 
     | 
    
         
            +
                  class Build
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Order is important.
         
     | 
| 
      
 9 
     | 
    
         
            +
                    BUILDERS = [
         
     | 
| 
      
 10 
     | 
    
         
            +
                      Builders::Core,
         
     | 
| 
      
 11 
     | 
    
         
            +
                      Builders::Documentation,
         
     | 
| 
      
 12 
     | 
    
         
            +
                      Builders::Git::Setup,
         
     | 
| 
      
 13 
     | 
    
         
            +
                      Builders::Bundler,
         
     | 
| 
      
 14 
     | 
    
         
            +
                      Builders::Rake,
         
     | 
| 
      
 15 
     | 
    
         
            +
                      Builders::Console,
         
     | 
| 
      
 16 
     | 
    
         
            +
                      Builders::Setup,
         
     | 
| 
      
 17 
     | 
    
         
            +
                      Builders::Guard,
         
     | 
| 
      
 18 
     | 
    
         
            +
                      Builders::Reek,
         
     | 
| 
      
 19 
     | 
    
         
            +
                      Builders::RSpec::Context,
         
     | 
| 
      
 20 
     | 
    
         
            +
                      Builders::RSpec::Helper,
         
     | 
| 
      
 21 
     | 
    
         
            +
                      Builders::Pragma,
         
     | 
| 
      
 22 
     | 
    
         
            +
                      Builders::Rubocop::Setup,
         
     | 
| 
      
 23 
     | 
    
         
            +
                      Builders::Rubocop::Formatter,
         
     | 
| 
      
 24 
     | 
    
         
            +
                      Builders::Git::Commit
         
     | 
| 
      
 25 
     | 
    
         
            +
                    ].freeze
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                    def initialize builders: BUILDERS, container: Container
         
     | 
| 
      
 28 
     | 
    
         
            +
                      @builders = builders
         
     | 
| 
      
 29 
     | 
    
         
            +
                      @container = container
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    def call = builders.each { |builder| builder.call configuration }
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                    private
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    attr_reader :builders, :container
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                    def configuration = container[__method__]
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Rubysmith
         
     | 
| 
      
 4 
     | 
    
         
            +
              module CLI
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Actions
         
     | 
| 
      
 6 
     | 
    
         
            +
                  # Handles the config action.
         
     | 
| 
      
 7 
     | 
    
         
            +
                  class Config
         
     | 
| 
      
 8 
     | 
    
         
            +
                    def initialize client: CLI::Configuration::Loader::CLIENT, container: Container
         
     | 
| 
      
 9 
     | 
    
         
            +
                      @client = client
         
     | 
| 
      
 10 
     | 
    
         
            +
                      @container = container
         
     | 
| 
      
 11 
     | 
    
         
            +
                    end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    def call selection
         
     | 
| 
      
 14 
     | 
    
         
            +
                      case selection
         
     | 
| 
      
 15 
     | 
    
         
            +
                        when :edit then edit
         
     | 
| 
      
 16 
     | 
    
         
            +
                        when :view then view
         
     | 
| 
      
 17 
     | 
    
         
            +
                        else fail StandardError, "Invalid configuration selection: #{selection}."
         
     | 
| 
      
 18 
     | 
    
         
            +
                      end
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    private
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                    attr_reader :client, :container
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                    def edit = kernel.system("$EDITOR #{client.current}")
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                    def view = kernel.system("cat #{client.current}")
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                    def kernel = container[__method__]
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,78 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "pathname"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "refinements/strings"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Rubysmith
         
     | 
| 
      
 7 
     | 
    
         
            +
              module CLI
         
     | 
| 
      
 8 
     | 
    
         
            +
                module Configuration
         
     | 
| 
      
 9 
     | 
    
         
            +
                  # Defines the common configuration content for use throughout the gem.
         
     | 
| 
      
 10 
     | 
    
         
            +
                  Content = Struct.new(
         
     | 
| 
      
 11 
     | 
    
         
            +
                    :action_build,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    :action_config,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    :action_help,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    :action_version,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    :author_email,
         
     | 
| 
      
 16 
     | 
    
         
            +
                    :author_name,
         
     | 
| 
      
 17 
     | 
    
         
            +
                    :author_url,
         
     | 
| 
      
 18 
     | 
    
         
            +
                    :build_amazing_print,
         
     | 
| 
      
 19 
     | 
    
         
            +
                    :build_bundler_leak,
         
     | 
| 
      
 20 
     | 
    
         
            +
                    :build_console,
         
     | 
| 
      
 21 
     | 
    
         
            +
                    :build_debug,
         
     | 
| 
      
 22 
     | 
    
         
            +
                    :build_documentation,
         
     | 
| 
      
 23 
     | 
    
         
            +
                    :build_git,
         
     | 
| 
      
 24 
     | 
    
         
            +
                    :build_git_lint,
         
     | 
| 
      
 25 
     | 
    
         
            +
                    :build_guard,
         
     | 
| 
      
 26 
     | 
    
         
            +
                    :build_minimum,
         
     | 
| 
      
 27 
     | 
    
         
            +
                    :build_rake,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    :build_reek,
         
     | 
| 
      
 29 
     | 
    
         
            +
                    :build_refinements,
         
     | 
| 
      
 30 
     | 
    
         
            +
                    :build_rspec,
         
     | 
| 
      
 31 
     | 
    
         
            +
                    :build_rubocop,
         
     | 
| 
      
 32 
     | 
    
         
            +
                    :build_setup,
         
     | 
| 
      
 33 
     | 
    
         
            +
                    :build_simple_cov,
         
     | 
| 
      
 34 
     | 
    
         
            +
                    :build_zeitwerk,
         
     | 
| 
      
 35 
     | 
    
         
            +
                    :builders_pragmater_comments,
         
     | 
| 
      
 36 
     | 
    
         
            +
                    :builders_pragmater_includes,
         
     | 
| 
      
 37 
     | 
    
         
            +
                    :documentation_format,
         
     | 
| 
      
 38 
     | 
    
         
            +
                    :documentation_license,
         
     | 
| 
      
 39 
     | 
    
         
            +
                    :now,
         
     | 
| 
      
 40 
     | 
    
         
            +
                    :project_name,
         
     | 
| 
      
 41 
     | 
    
         
            +
                    :target_root,
         
     | 
| 
      
 42 
     | 
    
         
            +
                    :template_path,
         
     | 
| 
      
 43 
     | 
    
         
            +
                    :template_root,
         
     | 
| 
      
 44 
     | 
    
         
            +
                    keyword_init: true
         
     | 
| 
      
 45 
     | 
    
         
            +
                  ) do
         
     | 
| 
      
 46 
     | 
    
         
            +
                    using Refinements::Strings
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                    def initialize *arguments
         
     | 
| 
      
 49 
     | 
    
         
            +
                      super
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                      self[:template_root] ||= Pathname(__dir__).join("../../templates").expand_path
         
     | 
| 
      
 52 
     | 
    
         
            +
                      self[:target_root] ||= Pathname.pwd
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                    def with(attributes) = self.class.new(to_h.merge(attributes))
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                    def minimize
         
     | 
| 
      
 58 
     | 
    
         
            +
                      to_h.except(:build_minimum)
         
     | 
| 
      
 59 
     | 
    
         
            +
                          .select { |key, _value| key.start_with? "build_" }
         
     | 
| 
      
 60 
     | 
    
         
            +
                          .each { |key, _value| self[key] = false }
         
     | 
| 
      
 61 
     | 
    
         
            +
                          .then { self }
         
     | 
| 
      
 62 
     | 
    
         
            +
                    end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                    def project_label = project_name.titleize
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                    def project_class = project_name.camelcase
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                    def project_root = target_root.join(project_name)
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                    def project_path = project_name.snakecase
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                    def to_pathway
         
     | 
| 
      
 73 
     | 
    
         
            +
                      Pathway[start_root: template_root, start_path: template_path, end_root: target_root]
         
     | 
| 
      
 74 
     | 
    
         
            +
                    end
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
                end
         
     | 
| 
      
 77 
     | 
    
         
            +
              end
         
     | 
| 
      
 78 
     | 
    
         
            +
            end
         
     |