Sha256: f873b2a9d9214dae07f2db78c310041b801b75756a2503e3a271d05b10070707

Contents?: true

Size: 1.74 KB

Versions: 3

Compression:

Stored size: 1.74 KB

Contents

module Gemaker
  module Cmd
    class CreateGem < Gemaker::Cmd::Base
      def in_engine_context
        mountable_opt = "--mountable" if @config.mountable?

        commands = [
          "echo \"source 'https://rubygems.org'\" > GemakerGemfile",
          "echo \"gem 'rails', '~> #{Gemaker::RAILS_VERSION}'\" > GemakerGemfile",
          "BUNDLE_GEMFILE=GemakerGemfile bundle install",
          "BUNDLE_GEMFILE=GemakerGemfile bundle exec rails plugin new #{@config.gem_name} -T #{mountable_opt} --dummy-path=spec/dummy", # rubocop:disable Metrics/LineLength
          "rm -f GemakerGemfile GemakerGemfile.lock"
        ]

        create_customized_gem(commands.join('; '))
      end

      def in_normal_context
        create_customized_gem("bundle gem #{@config.gem_name}")
      end

      private

      # rubocop:disable Metrics/MethodLength
      def create_customized_gem(cmd)
        execute(cmd)
        Gemaker::Cmd::AddReadme.for(config: @config)
        Gemaker::Cmd::AddChangelog.for(config: @config)
        Gemaker::Cmd::CustomizeGemspec.for(config: @config)
        Gemaker::Cmd::AddLicense.for(config: @config)
        Gemaker::Cmd::AddCliStructure.for(config: @config)
        Gemaker::Cmd::ConfigureTestEnv.for(config: @config)
        Gemaker::Cmd::AddRubyVersion.for(config: @config)
        Gemaker::Cmd::CustomizeEngine.for(config: @config)
        Gemaker::Cmd::CustomizeRakefile.for(config: @config)
        Gemaker::Cmd::CustomizeMainLibFile.for(config: @config)
        Gemaker::Cmd::AddInstallGenerator.for(config: @config)
        Gemaker::Cmd::AddHoundRules.for(config: @config)
        Gemaker::Cmd::ConfigureTravis.for(config: @config)
        Gemaker::Cmd::ConfigureGit.for(config: @config)
        info("Done!")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gemaker-0.6.0 lib/gemaker/commands/create_gem.rb
gemaker-0.5.0 lib/gemaker/commands/create_gem.rb
gemaker-0.4.0 lib/gemaker/commands/create_gem.rb