Class: Jeweler::Commands::BuildGem

Inherits:
Object
  • Object
show all
Defined in:
lib/jeweler/commands/build_gem.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBuildGem

Returns a new instance of BuildGem.



6
7
8
# File 'lib/jeweler/commands/build_gem.rb', line 6

def initialize
  self.file_utils = FileUtils
end

Instance Attribute Details

#base_dirObject

Returns the value of attribute base_dir.



4
5
6
# File 'lib/jeweler/commands/build_gem.rb', line 4

def base_dir
  @base_dir
end

#file_utilsObject

Returns the value of attribute file_utils.



4
5
6
# File 'lib/jeweler/commands/build_gem.rb', line 4

def file_utils
  @file_utils
end

#gemspec_helperObject

Returns the value of attribute gemspec_helper.



4
5
6
# File 'lib/jeweler/commands/build_gem.rb', line 4

def gemspec_helper
  @gemspec_helper
end

Class Method Details

.build_for(jeweler) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/jeweler/commands/build_gem.rb', line 21

def self.build_for(jeweler)
  command = new

  command.base_dir = jeweler.base_dir
  command.gemspec_helper = jeweler.gemspec_helper

  command
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/jeweler/commands/build_gem.rb', line 10

def run
  gemspec = gemspec_helper.parse
  gem_file_name = Gem::Builder.new(gemspec).build

  pkg_dir = File.join(base_dir, 'pkg')
  file_utils.mkdir_p pkg_dir

  gem_file_name = File.join(base_dir, gem_file_name)
  file_utils.mv gem_file_name, pkg_dir
end