rubysmith 4.3.0 → 4.5.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 +3 -3
- data/lib/rubysmith/builder.rb +12 -6
- data/lib/rubysmith/builders/git/commit.rb +2 -3
- data/lib/rubysmith/builders/git/safe.rb +32 -0
- data/lib/rubysmith/builders/git_hub_ci.rb +1 -1
- data/lib/rubysmith/builders/rake.rb +16 -6
- data/lib/rubysmith/cli/actions/build.rb +3 -2
- data/lib/rubysmith/cli/actions/config.rb +2 -2
- data/lib/rubysmith/cli/parser.rb +2 -2
- data/lib/rubysmith/cli/parsers/build.rb +2 -4
- data/lib/rubysmith/cli/parsers/core.rb +2 -4
- data/lib/rubysmith/cli/shell.rb +4 -4
- data/lib/rubysmith/templates/%project_name%/.github/workflows/ci.yml.erb +8 -0
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/Guardfile.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/README.adoc.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/README.md.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/bin/rake.erb +5 -0
- data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +6 -2
- data/rubysmith.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +5 -3
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 55c3866c9490668be3c681aec460463b9d364f140736382438305bb0221ce8c7
         | 
| 4 | 
            +
              data.tar.gz: cfcaffcad4bd532a71ba36c08b9795296cd06fa200541109d9ce5479d479fcc3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e1727976ede3f428d8bfffef997eed72fd99036721af4b611b9c17b328e3106544cac1378d60b39905423303e34f2a5e7ba141c442c56400419edd85a2d033b3
         | 
| 7 | 
            +
              data.tar.gz: 6e1debe8fb64513c5240d626f10fb1d6c6bf14b66b041ae0384a6d3905d8dd3f19c3a5a88dc8c398ba41bb095994f139739390cf80798a5b8556aec668cfb09f
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/README.adoc
    CHANGED
    
    | @@ -222,14 +222,14 @@ doesn't require use of the `--git_hub` option but is encouraged. | |
| 222 222 |  | 
| 223 223 | 
             
            ===== Git
         | 
| 224 224 |  | 
| 225 | 
            -
            The `--git` option allows you add link:https://git-scm.com[Git] repository support.
         | 
| 225 | 
            +
            The `--git` option allows you add link:https://git-scm.com[Git] repository support. Includes link:https://www.alchemists.io/screencasts/git_safe[Git Safe] functionality so you don't have to prefix commands with the `bin/` path prefix. Instead, you can call the command directly (assuming you have configured your link:https://www.alchemists.io/projects/dotfiles[Dotfiles] accordingly).
         | 
| 226 226 |  | 
| 227 227 | 
             
            ===== GitHub
         | 
| 228 228 |  | 
| 229 229 | 
             
            The `--git_hub` option allows you add link:https://github.com[GitHub] templates to your project for
         | 
| 230 230 | 
             
            issues and pull requests.
         | 
| 231 231 |  | 
| 232 | 
            -
             | 
| 232 | 
            +
            ===== GitHub CI
         | 
| 233 233 |  | 
| 234 234 | 
             
            The `--git_hub_ci` option allows you to build your project with link:https://docs.github.com/en/actions[GitHub Actions] configured so you can get your project building as quickly as possible.
         | 
| 235 235 |  | 
| @@ -556,7 +556,7 @@ To test, run: | |
| 556 556 |  | 
| 557 557 | 
             
            [source,bash]
         | 
| 558 558 | 
             
            ----
         | 
| 559 | 
            -
             | 
| 559 | 
            +
            bin/rake
         | 
| 560 560 | 
             
            ----
         | 
| 561 561 |  | 
| 562 562 | 
             
            == link:https://www.alchemists.io/policies/license[License]
         | 
    
        data/lib/rubysmith/builder.rb
    CHANGED
    
    | @@ -15,14 +15,14 @@ module Rubysmith | |
| 15 15 |  | 
| 16 16 | 
             
                def self.call(...) = new(...)
         | 
| 17 17 |  | 
| 18 | 
            -
                def initialize | 
| 19 | 
            -
                  super(** | 
| 18 | 
            +
                def initialize(configuration, helpers: HELPERS, **)
         | 
| 19 | 
            +
                  super(**)
         | 
| 20 20 | 
             
                  @configuration = configuration
         | 
| 21 21 | 
             
                  @helpers = helpers
         | 
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 24 | 
             
                def append content
         | 
| 25 | 
            -
                  log_debug "Appending: #{relative_build_path}"
         | 
| 25 | 
            +
                  log_debug "Appending content to: #{relative_build_path}"
         | 
| 26 26 | 
             
                  build_path.rewrite { |body| body + content }
         | 
| 27 27 | 
             
                  self
         | 
| 28 28 | 
             
                end
         | 
| @@ -33,15 +33,21 @@ module Rubysmith | |
| 33 33 | 
             
                  self
         | 
| 34 34 | 
             
                end
         | 
| 35 35 |  | 
| 36 | 
            +
                def insert_after pattern, content
         | 
| 37 | 
            +
                  log_debug "Inserting content after pattern in: #{relative_build_path}"
         | 
| 38 | 
            +
                  build_path.write inserter.new(build_path.readlines, :after).call(content, pattern).join
         | 
| 39 | 
            +
                  self
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
             | 
| 36 42 | 
             
                def insert_before pattern, content
         | 
| 37 43 | 
             
                  log_debug "Inserting content before pattern in: #{relative_build_path}"
         | 
| 38 44 | 
             
                  build_path.write inserter.new(build_path.readlines, :before).call(content, pattern).join
         | 
| 39 45 | 
             
                  self
         | 
| 40 46 | 
             
                end
         | 
| 41 47 |  | 
| 42 | 
            -
                def  | 
| 43 | 
            -
                  log_debug " | 
| 44 | 
            -
                  build_path. | 
| 48 | 
            +
                def make_path
         | 
| 49 | 
            +
                  log_debug "Creating path: #{relative_build_path}"
         | 
| 50 | 
            +
                  build_path.make_path
         | 
| 45 51 | 
             
                  self
         | 
| 46 52 | 
             
                end
         | 
| 47 53 |  | 
| @@ -9,9 +9,8 @@ module Rubysmith | |
| 9 9 |  | 
| 10 10 | 
             
                    def self.call(...) = new(...).call
         | 
| 11 11 |  | 
| 12 | 
            -
                    def initialize | 
| 13 | 
            -
                      super(** | 
| 14 | 
            -
             | 
| 12 | 
            +
                    def initialize(configuration, builder: Builder, **)
         | 
| 13 | 
            +
                      super(**)
         | 
| 15 14 | 
             
                      @configuration = configuration
         | 
| 16 15 | 
             
                      @builder = builder
         | 
| 17 16 | 
             
                    end
         | 
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "refinements/structs"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module Rubysmith
         | 
| 6 | 
            +
              module Builders
         | 
| 7 | 
            +
                module Git
         | 
| 8 | 
            +
                  # Initializes project skeleton with Git Safe support.
         | 
| 9 | 
            +
                  class Safe
         | 
| 10 | 
            +
                    using Refinements::Structs
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                    def self.call(...) = new(...).call
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    def initialize configuration, builder: Builder
         | 
| 15 | 
            +
                      @configuration = configuration
         | 
| 16 | 
            +
                      @builder = builder
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    def call
         | 
| 20 | 
            +
                      return configuration unless configuration.build_git
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      builder.call(configuration.merge(template_path: "%project_name%/.git/safe")).make_path
         | 
| 23 | 
            +
                      configuration
         | 
| 24 | 
            +
                    end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                    private
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    attr_reader :configuration, :builder
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
            end
         | 
| @@ -18,6 +18,22 @@ module Rubysmith | |
| 18 18 | 
             
                  def call
         | 
| 19 19 | 
             
                    return configuration unless configuration.build_rake
         | 
| 20 20 |  | 
| 21 | 
            +
                    add_binstub
         | 
| 22 | 
            +
                    add_configuration
         | 
| 23 | 
            +
                    configuration
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  private
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  attr_reader :configuration, :builder
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                  def add_binstub
         | 
| 31 | 
            +
                    builder.call(configuration.merge(template_path: "%project_name%/bin/rake.erb"))
         | 
| 32 | 
            +
                           .render
         | 
| 33 | 
            +
                           .permit 0o755
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  def add_configuration
         | 
| 21 37 | 
             
                    builder.call(configuration.merge(template_path: "%project_name%/Rakefile.erb"))
         | 
| 22 38 | 
             
                           .render
         | 
| 23 39 | 
             
                           .replace(/\[\s+/, "[")
         | 
| @@ -26,13 +42,7 @@ module Rubysmith | |
| 26 42 | 
             
                           .replace("task.", "  task.")
         | 
| 27 43 | 
             
                           .replace(/\n+(?=require)/, "\n")
         | 
| 28 44 | 
             
                           .replace(/\n{2,}/, "\n\n")
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                    configuration
         | 
| 31 45 | 
             
                  end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                  private
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                  attr_reader :configuration, :builder
         | 
| 36 46 | 
             
                end
         | 
| 37 47 | 
             
              end
         | 
| 38 48 | 
             
            end
         | 
| @@ -17,6 +17,7 @@ module Rubysmith | |
| 17 17 | 
             
                      Builders::Documentation::Version,
         | 
| 18 18 | 
             
                      Builders::Git::Setup,
         | 
| 19 19 | 
             
                      Builders::Git::Ignore,
         | 
| 20 | 
            +
                      Builders::Git::Safe,
         | 
| 20 21 | 
             
                      Builders::Bundler,
         | 
| 21 22 | 
             
                      Builders::Rake,
         | 
| 22 23 | 
             
                      Builders::Console,
         | 
| @@ -37,8 +38,8 @@ module Rubysmith | |
| 37 38 | 
             
                      Builders::Git::Commit
         | 
| 38 39 | 
             
                    ].freeze
         | 
| 39 40 |  | 
| 40 | 
            -
                    def initialize | 
| 41 | 
            -
                      super(** | 
| 41 | 
            +
                    def initialize(builders: BUILDERS, **)
         | 
| 42 | 
            +
                      super(**)
         | 
| 42 43 | 
             
                      @builders = builders
         | 
| 43 44 | 
             
                    end
         | 
| 44 45 |  | 
| @@ -7,8 +7,8 @@ module Rubysmith | |
| 7 7 | 
             
                  class Config
         | 
| 8 8 | 
             
                    include Rubysmith::Import[:kernel, :logger]
         | 
| 9 9 |  | 
| 10 | 
            -
                    def initialize | 
| 11 | 
            -
                      super(** | 
| 10 | 
            +
                    def initialize(client: Configuration::Loader::CLIENT, **)
         | 
| 11 | 
            +
                      super(**)
         | 
| 12 12 | 
             
                      @client = client
         | 
| 13 13 | 
             
                    end
         | 
| 14 14 |  | 
    
        data/lib/rubysmith/cli/parser.rb
    CHANGED
    
    | @@ -12,8 +12,8 @@ module Rubysmith | |
| 12 12 | 
             
                  CLIENT = OptionParser.new nil, 40, "  "
         | 
| 13 13 | 
             
                  SECTIONS = [Parsers::Core, Parsers::Build].freeze # Order is important.
         | 
| 14 14 |  | 
| 15 | 
            -
                  def initialize | 
| 16 | 
            -
                    super(** | 
| 15 | 
            +
                  def initialize(sections: SECTIONS, client: CLIENT, **)
         | 
| 16 | 
            +
                    super(**)
         | 
| 17 17 | 
             
                    @sections = sections
         | 
| 18 18 | 
             
                    @client = client
         | 
| 19 19 | 
             
                    @configuration_duplicate = configuration.dup
         | 
| @@ -14,10 +14,8 @@ module Rubysmith | |
| 14 14 |  | 
| 15 15 | 
             
                    def self.call(...) = new(...).call
         | 
| 16 16 |  | 
| 17 | 
            -
                    def initialize | 
| 18 | 
            -
             | 
| 19 | 
            -
                                   **dependencies
         | 
| 20 | 
            -
                      super(**dependencies)
         | 
| 17 | 
            +
                    def initialize(configuration = Container[:configuration], client: Parser::CLIENT, **)
         | 
| 18 | 
            +
                      super(**)
         | 
| 21 19 | 
             
                      @configuration = configuration
         | 
| 22 20 | 
             
                      @client = client
         | 
| 23 21 | 
             
                    end
         | 
| @@ -14,10 +14,8 @@ module Rubysmith | |
| 14 14 |  | 
| 15 15 | 
             
                    def self.call(...) = new(...).call
         | 
| 16 16 |  | 
| 17 | 
            -
                    def initialize | 
| 18 | 
            -
             | 
| 19 | 
            -
                                   **dependencies
         | 
| 20 | 
            -
                      super(**dependencies)
         | 
| 17 | 
            +
                    def initialize(configuration = Container[:configuration], client: Parser::CLIENT, **)
         | 
| 18 | 
            +
                      super(**)
         | 
| 21 19 | 
             
                      @configuration = configuration
         | 
| 22 20 | 
             
                      @client = client
         | 
| 23 21 | 
             
                    end
         | 
    
        data/lib/rubysmith/cli/shell.rb
    CHANGED
    
    | @@ -9,13 +9,13 @@ module Rubysmith | |
| 9 9 | 
             
                class Shell
         | 
| 10 10 | 
             
                  include Actions::Import[:config, :build, :publish, :specification, :logger]
         | 
| 11 11 |  | 
| 12 | 
            -
                  def initialize | 
| 13 | 
            -
                    super(** | 
| 12 | 
            +
                  def initialize(parser: Parser.new, **)
         | 
| 13 | 
            +
                    super(**)
         | 
| 14 14 | 
             
                    @parser = parser
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 |  | 
| 17 17 | 
             
                  def call arguments = Core::EMPTY_ARRAY
         | 
| 18 | 
            -
                     | 
| 18 | 
            +
                    act_on parser.call(arguments)
         | 
| 19 19 | 
             
                  rescue OptionParser::ParseError, Milestoner::Error => error
         | 
| 20 20 | 
             
                    logger.error { error.message }
         | 
| 21 21 | 
             
                  end
         | 
| @@ -24,7 +24,7 @@ module Rubysmith | |
| 24 24 |  | 
| 25 25 | 
             
                  attr_reader :parser
         | 
| 26 26 |  | 
| 27 | 
            -
                  def  | 
| 27 | 
            +
                  def act_on configuration
         | 
| 28 28 | 
             
                    case configuration
         | 
| 29 29 | 
             
                      in action_config: Symbol => action then config.call action
         | 
| 30 30 | 
             
                      in action_build: true then build.call configuration
         | 
| @@ -11,7 +11,7 @@ source "https://rubygems.org" | |
| 11 11 |  | 
| 12 12 | 
             
            group :code_quality do
         | 
| 13 13 | 
             
              <% if configuration.build_caliber %>
         | 
| 14 | 
            -
                gem "caliber", "~> 0. | 
| 14 | 
            +
                gem "caliber", "~> 0.25"
         | 
| 15 15 | 
             
              <% end %>
         | 
| 16 16 | 
             
              <% if configuration.build_git && configuration.build_git_lint %>
         | 
| 17 17 | 
             
                gem "git-lint", "~> 5.0"
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            guard :rspec, cmd: "NO_COVERAGE=true  | 
| 1 | 
            +
            guard :rspec, cmd: "NO_COVERAGE=true bin/rspec --format documentation" do
         | 
| 2 2 | 
             
              watch %r(^spec/.+_spec\.rb$)
         | 
| 3 3 | 
             
              watch(%r(^lib/(.+)\.rb$)) { |m| "spec/lib/#{m[1]}_spec.rb" }
         | 
| 4 4 | 
             
              watch("spec/spec_helper.rb") { "spec" }
         | 
| @@ -20,12 +20,16 @@ require "refinements" | |
| 20 20 | 
             
            <% end %>
         | 
| 21 21 |  | 
| 22 22 | 
             
            <% if configuration.build_refinements %>
         | 
| 23 | 
            +
            SPEC_ROOT = Pathname(__dir__).realpath.freeze
         | 
| 24 | 
            +
             | 
| 23 25 | 
             
            using Refinements::Pathnames
         | 
| 24 26 |  | 
| 25 | 
            -
            Pathname.require_tree  | 
| 27 | 
            +
            Pathname.require_tree SPEC_ROOT, "support/shared_contexts/**/*.rb"
         | 
| 26 28 | 
             
            <% else %>
         | 
| 27 29 |  | 
| 28 | 
            -
             | 
| 30 | 
            +
            SPEC_ROOT = Pathname(__dir__).realpath.freeze
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            Dir[File.join(SPEC_ROOT, "support", "shared_contexts", "**/*.rb")].each { |path| require path }
         | 
| 29 33 | 
             
            <% end %>
         | 
| 30 34 |  | 
| 31 35 | 
             
            RSpec.configure do |config|
         | 
    
        data/rubysmith.gemspec
    CHANGED
    
    
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rubysmith
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4. | 
| 4 | 
            +
              version: 4.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Brooke Kuhlmann
         | 
| @@ -28,7 +28,7 @@ cert_chain: | |
| 28 28 | 
             
              CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
         | 
| 29 29 | 
             
              RFE=
         | 
| 30 30 | 
             
              -----END CERTIFICATE-----
         | 
| 31 | 
            -
            date: 2023- | 
| 31 | 
            +
            date: 2023-02-05 00:00:00.000000000 Z
         | 
| 32 32 | 
             
            dependencies:
         | 
| 33 33 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 34 34 | 
             
              name: cogger
         | 
| @@ -252,6 +252,7 @@ files: | |
| 252 252 | 
             
            - lib/rubysmith/builders/documentation/version.rb
         | 
| 253 253 | 
             
            - lib/rubysmith/builders/git/commit.rb
         | 
| 254 254 | 
             
            - lib/rubysmith/builders/git/ignore.rb
         | 
| 255 | 
            +
            - lib/rubysmith/builders/git/safe.rb
         | 
| 255 256 | 
             
            - lib/rubysmith/builders/git/setup.rb
         | 
| 256 257 | 
             
            - lib/rubysmith/builders/git_hub.rb
         | 
| 257 258 | 
             
            - lib/rubysmith/builders/git_hub_ci.rb
         | 
| @@ -316,6 +317,7 @@ files: | |
| 316 317 | 
             
            - lib/rubysmith/templates/%project_name%/VERSIONS.md.erb
         | 
| 317 318 | 
             
            - lib/rubysmith/templates/%project_name%/bin/console.erb
         | 
| 318 319 | 
             
            - lib/rubysmith/templates/%project_name%/bin/guard.erb
         | 
| 320 | 
            +
            - lib/rubysmith/templates/%project_name%/bin/rake.erb
         | 
| 319 321 | 
             
            - lib/rubysmith/templates/%project_name%/bin/rspec.erb
         | 
| 320 322 | 
             
            - lib/rubysmith/templates/%project_name%/bin/rubocop.erb
         | 
| 321 323 | 
             
            - lib/rubysmith/templates/%project_name%/bin/setup.erb
         | 
| @@ -350,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 350 352 | 
             
                - !ruby/object:Gem::Version
         | 
| 351 353 | 
             
                  version: '0'
         | 
| 352 354 | 
             
            requirements: []
         | 
| 353 | 
            -
            rubygems_version: 3.4. | 
| 355 | 
            +
            rubygems_version: 3.4.6
         | 
| 354 356 | 
             
            signing_key:
         | 
| 355 357 | 
             
            specification_version: 4
         | 
| 356 358 | 
             
            summary: A command line interface for smithing Ruby projects.
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |