Class: Bundler::Geminabox::CLI::Gem
- Inherits:
-
Object
- Object
- Bundler::Geminabox::CLI::Gem
- Defined in:
- lib/bundler/geminabox/cli/gem.rb
Instance Attribute Summary collapse
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#thor ⇒ Object
readonly
Returns the value of attribute thor.
Instance Method Summary collapse
-
#initialize(options, gem_name, thor) ⇒ Gem
constructor
A new instance of Gem.
- #run ⇒ Object
Constructor Details
#initialize(options, gem_name, thor) ⇒ Gem
Returns a new instance of Gem.
5 6 7 8 9 |
# File 'lib/bundler/geminabox/cli/gem.rb', line 5 def initialize(, gem_name, thor) = @gem_name = gem_name @thor = thor end |
Instance Attribute Details
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
4 5 6 |
# File 'lib/bundler/geminabox/cli/gem.rb', line 4 def gem_name @gem_name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/bundler/geminabox/cli/gem.rb', line 4 def end |
#thor ⇒ Object (readonly)
Returns the value of attribute thor.
4 5 6 |
# File 'lib/bundler/geminabox/cli/gem.rb', line 4 def thor @thor end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bundler/geminabox/cli/gem.rb', line 11 def run name = gem_name.chomp("/") # remove trailing slash if present target = File.join(Dir.pwd, name) underscored_name = name.tr('-', '_') opts = { :geminabox => ENV['GEMINABOX'] || 'https://your.rubygems.org', :gem_tasks => ENV['CUSTOM_GEM_TASKS'] || 'bundler/geminabox/gem_tasks', :name => name, :underscored_name => underscored_name, :test => [:test], :ext => [:ext] } opts[:force] = true thor.template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts) thor.template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts) end |