Class: Ebuild
- Inherits:
-
Object
- Object
- Ebuild
- Defined in:
- lib/emerge-gem/ebuild.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
Returns the value of attribute dependencies.
-
#local_path ⇒ Object
Returns the value of attribute local_path.
-
#source ⇒ Object
Returns the value of attribute source.
-
#spec ⇒ Object
Returns the value of attribute spec.
Instance Method Summary collapse
- #atom_of(dependency) ⇒ Object
- #filename ⇒ Object
-
#initialize(spec_pair) ⇒ Ebuild
constructor
A new instance of Ebuild.
- #p ⇒ Object
- #pn ⇒ Object (also: #name)
- #pv ⇒ Object
- #uri ⇒ Object
- #write(target_dir = 'ebuilds') ⇒ Object
Constructor Details
#initialize(spec_pair) ⇒ Ebuild
Returns a new instance of Ebuild.
4 5 6 7 |
# File 'lib/emerge-gem/ebuild.rb', line 4 def initialize( spec_pair ) @spec, @source = spec_pair @dependencies = [] end |
Instance Attribute Details
#dependencies ⇒ Object
Returns the value of attribute dependencies.
2 3 4 |
# File 'lib/emerge-gem/ebuild.rb', line 2 def dependencies @dependencies end |
#local_path ⇒ Object
Returns the value of attribute local_path.
2 3 4 |
# File 'lib/emerge-gem/ebuild.rb', line 2 def local_path @local_path end |
#source ⇒ Object
Returns the value of attribute source.
2 3 4 |
# File 'lib/emerge-gem/ebuild.rb', line 2 def source @source end |
#spec ⇒ Object
Returns the value of attribute spec.
2 3 4 |
# File 'lib/emerge-gem/ebuild.rb', line 2 def spec @spec end |
Instance Method Details
#atom_of(dependency) ⇒ Object
26 27 28 |
# File 'lib/emerge-gem/ebuild.rb', line 26 def atom_of( dependency ) "dev-ruby/#{dependency.name}" end |
#filename ⇒ Object
9 10 11 |
# File 'lib/emerge-gem/ebuild.rb', line 9 def filename "#{p}.ebuild" end |
#p ⇒ Object
13 14 15 |
# File 'lib/emerge-gem/ebuild.rb', line 13 def p "#{pn}-#{pv}" end |
#pn ⇒ Object Also known as: name
17 18 19 |
# File 'lib/emerge-gem/ebuild.rb', line 17 def pn spec.name.downcase end |
#pv ⇒ Object
22 23 24 |
# File 'lib/emerge-gem/ebuild.rb', line 22 def pv spec.version.version end |
#uri ⇒ Object
30 31 32 |
# File 'lib/emerge-gem/ebuild.rb', line 30 def uri "#{source}/gems/#{p}.gem" end |
#write(target_dir = 'ebuilds') ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/emerge-gem/ebuild.rb', line 34 def write( target_dir = 'ebuilds' ) ebuild_dir = "#{target_dir}/#{name}" FileUtils.mkdir_p ebuild_dir output = eruby.result( binding ) @local_path = "#{ebuild_dir}/#{filename}" File.open( @local_path, 'w' ) do |f| f.write output end end |