Class: Gemaker::Cmd::CreateGem

Inherits:
Base
  • Object
show all
Defined in:
lib/gemaker/commands/create_gem.rb

Instance Method Summary collapse

Methods inherited from Base

#perform

Methods included from Util

#copy_file, #copy_template, #create_dir, #error, #execute, #execute_in_gem, #gem_root_path, #get_destination_path, #get_template_path, #info, #parse_erb, #remove_in_gem, #utils_path

Instance Method Details

#in_engine_contextObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gemaker/commands/create_gem.rb', line 4

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

#in_normal_contextObject



18
19
20
# File 'lib/gemaker/commands/create_gem.rb', line 18

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