Class: Jeweler::Commands::SetupRubyforge

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gemspecObject

Returns the value of attribute gemspec.



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

def gemspec
  @gemspec
end

#outputObject

Returns the value of attribute output.



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

def output
  @output
end

#rubyforgeObject

Returns the value of attribute rubyforge.



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

def rubyforge
  @rubyforge
end

Class Method Details

.build_for(jeweler) ⇒ Object



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

def self.build_for(jeweler)
  command = new

  command.gemspec = jeweler.gemspec
  command.output = jeweler.output
  command.rubyforge = jeweler.rubyforge

  command
end

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/jeweler/commands/setup_rubyforge.rb', line 6

def run
  raise NoRubyForgeProjectInGemspecError unless @gemspec.rubyforge_project

  @rubyforge.configure

  output.puts "Logging into rubyforge"
  @rubyforge.

  output.puts "Creating #{@gemspec.name} package in the #{@gemspec.rubyforge_project} project"
  begin
    @rubyforge.create_package(@gemspec.rubyforge_project, @gemspec.name)
  rescue StandardError => e
    case e.message
    when /no <group_id> configured for <#{Regexp.escape @gemspec.rubyforge_project}>/
      raise RubyForgeProjectNotConfiguredError, @gemspec.rubyforge_project
    else
      raise
    end
  end
end