Class: Rake::RPMTask
- Inherits:
-
TaskLib
- Object
- TaskLib
- Rake::RPMTask
- Defined in:
- lib/rake/rpmtask.rb
Overview
Create a build task that will generate an RPM package from a .spec file.
- Author
-
Steve Sloan ([email protected])
- Copyright
-
Copyright © 2006-2009 Steve Sloan
- License
-
MIT
Direct Known Subclasses
Instance Attribute Summary collapse
-
#build_srpms ⇒ Object
Returns the value of attribute build_srpms.
-
#name ⇒ Object
Returns the value of attribute name.
-
#spec_path ⇒ Object
Returns the value of attribute spec_path.
Instance Method Summary collapse
- #define_tasks ⇒ Object
-
#initialize(args) {|_self| ... } ⇒ RPMTask
constructor
A new instance of RPMTask.
- #spec ⇒ Object
Constructor Details
#initialize(args) {|_self| ... } ⇒ RPMTask
Returns a new instance of RPMTask.
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/rake/rpmtask.rb', line 108 def initialize( args, &blk ) @name, @prereqs = args.keys.first, args.values.first @spec_path = @prereqs.find { |t| File.extname(t.to_s) == '.spec' } @build_srpm = false yield self if block_given? raise "Unable to find spec file for \"#{@name}\"" unless @spec_path define_tasks end |
Instance Attribute Details
#build_srpms ⇒ Object
Returns the value of attribute build_srpms.
106 107 108 |
# File 'lib/rake/rpmtask.rb', line 106 def build_srpms @build_srpms end |
#name ⇒ Object
Returns the value of attribute name.
106 107 108 |
# File 'lib/rake/rpmtask.rb', line 106 def name @name end |
#spec_path ⇒ Object
Returns the value of attribute spec_path.
106 107 108 |
# File 'lib/rake/rpmtask.rb', line 106 def spec_path @spec_path end |
Instance Method Details
#define_tasks ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/rake/rpmtask.rb', line 127 def define_tasks task @name => @prereqs do |t| for rpm in spec.packages spec.install_sources file rpm.path => spec.path do |t| rpm_names = spec.packages.map { |p| p.name }.join(', ') puts '', '-' * 80, "Building #{rpm_names} ...", '-' * 80 flags = @build_srpms ? RPM::BUILD__ALL_PACKAGE : RPM::BUILD__BINARY_PACKAGE raise "RPM Build failed" unless spec.build(flags).zero? end.invoke # CLOBBER.include pkg.path end # CLEAN.include File.join( RPM::BuildDir, "#{spec.name}-#{spec.version}" ) # CLOBBER.include @spec.sources.map { |s| File.join RPM::SRPMDir, s.filename } end end |