Class: Buildr::PackageGemTask

Inherits:
ArchiveTask show all
Defined in:
lib/buildr/packaging/gems.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ArchiveTask

#clean, #contain?, #empty?, #exclude, #include, #invoke_prerequisites, #merge, #needed?, #path, #root, #with

Methods inherited from Rake::FileTask

#contain?, #empty?, #exist?

Constructor Details

#initialize(*args) ⇒ PackageGemTask

Returns a new instance of PackageGemTask.



27
28
29
30
31
32
33
# File 'lib/buildr/packaging/gems.rb', line 27

def initialize(*args)
  super
  @spec = Gem::Specification.new
  prepare do
    include(changelog) if changelog
  end
end

Instance Attribute Details

#changelogObject

Returns the value of attribute changelog.



35
36
37
# File 'lib/buildr/packaging/gems.rb', line 35

def changelog
  @changelog
end

Instance Method Details

#installObject



42
43
44
# File 'lib/buildr/packaging/gems.rb', line 42

def install
  Util::Gems.command 'install', name
end

#spec {|@spec| ... } ⇒ Object

Yields:



37
38
39
40
# File 'lib/buildr/packaging/gems.rb', line 37

def spec
  yield @spec if block_given?
  @spec
end

#uninstallObject



46
47
48
# File 'lib/buildr/packaging/gems.rb', line 46

def uninstall
  Util::Gems.command 'uninstall', spec.name, '-v', spec.version.to_s
end

#uploadObject



50
51
52
53
54
55
# File 'lib/buildr/packaging/gems.rb', line 50

def upload
  rubyforge = RubyForge.new
  rubyforge.
  rubyforge.userconfig.merge!('release_changes'=>changelog.to_s, 'preformatted'=>true) if changelog
  rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version, package(:gem).to_s
end