Class: Jeweler::Commands::WriteGemspec

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWriteGemspec

Returns a new instance of WriteGemspec.



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

def initialize
  self.output = $stdout
end

Instance Attribute Details

#base_dirObject

Returns the value of attribute base_dir.



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

def base_dir
  @base_dir
end

#gemspecObject

Returns the value of attribute gemspec.



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

def gemspec
  @gemspec
end

#gemspec_helperObject

Returns the value of attribute gemspec_helper.



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

def gemspec_helper
  @gemspec_helper
end

#outputObject

Returns the value of attribute output.



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

def output
  @output
end

#versionObject

Returns the value of attribute version.



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

def version
  @version
end

#version_helperObject

Returns the value of attribute version_helper.



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

def version_helper
  @version_helper
end

Class Method Details

.build_for(jeweler) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jeweler/commands/write_gemspec.rb', line 24

def self.build_for(jeweler)
  command = new

  command.base_dir = jeweler.base_dir
  command.gemspec = jeweler.gemspec
  command.version = jeweler.version
  command.output = jeweler.output
  command.gemspec_helper = jeweler.gemspec_helper
  command.version_helper = jeweler.version_helper

  command
end

Instance Method Details

#runObject



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

def run
  version_helper.refresh
  gemspec_helper.spec.version = version_helper.to_s
  gemspec_helper.spec.date    = Time.now

  gemspec_helper.write

  output.puts "Generated: #{gemspec_helper.path}"  
end