Class: Lookout::Rake::Tasks::Gem
- Defined in:
- lib/lookout/rake/tasks/gem.rb
Instance Attribute Summary collapse
-
#specification ⇒ Object
readonly
Returns the value of attribute specification.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(specification = Lookout::Rake::Tasks.specification!) {|_self| ... } ⇒ Gem
constructor
A new instance of Gem.
Constructor Details
#initialize(specification = Lookout::Rake::Tasks.specification!) {|_self| ... } ⇒ Gem
Returns a new instance of Gem.
4 5 6 7 8 9 10 11 12 |
# File 'lib/lookout/rake/tasks/gem.rb', line 4 def initialize(specification = Lookout::Rake::Tasks.specification!) specification or raise ArgumentError, 'gem specification was not given and could not be found in project root: %s' % Lookout::Rake::Tasks.top_srcdir @specification = specification yield self if block_given? define end |
Instance Attribute Details
#specification ⇒ Object (readonly)
Returns the value of attribute specification.
48 49 50 |
# File 'lib/lookout/rake/tasks/gem.rb', line 48 def specification @specification end |
Instance Method Details
#define ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/lookout/rake/tasks/gem.rb', line 14 def define desc 'Build %s' % specification.file_name task :build => specification.file_name file specification.file_name => specification.files do when_writing 'Building %s' % specification.file_name do require 'rubygems' unless defined? Gem require 'rubygems/installer' unless defined? Gem::Builder Gem::Builder.new(specification).build end end desc 'Check %s' % specification.file_name task :check => :build do require 'rubygems' unless defined? Gem require 'rubygems/installer' unless defined? Gem::Installer checkdir = specification.full_name Gem::Installer.new(specification.file_name, :unpack => true).unpack checkdir sh 'rake --rakefile %s/Rakefile -s test' % checkdir rm_r checkdir end desc 'Install %s and its dependencies' % specification.file_name task :install do require 'rubygems' unless defined? Gem require 'rubygems/dependency_installer' unless defined? Gem::DependencyInstaller Gem::DependencyInstaller.new.install specification.file_name end desc 'Push %s to rubygems.org' % specification.file_name task :push => :check do sh 'gem push -%s-verbose %s' % [verbose ? '' : '-no', specification.file_name] end end |