Class: Ebuild

Inherits:
Object
  • Object
show all
Defined in:
lib/emerge-gem/ebuild.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dependenciesObject

Returns the value of attribute dependencies.



2
3
4
# File 'lib/emerge-gem/ebuild.rb', line 2

def dependencies
  @dependencies
end

#local_pathObject

Returns the value of attribute local_path.



2
3
4
# File 'lib/emerge-gem/ebuild.rb', line 2

def local_path
  @local_path
end

#sourceObject

Returns the value of attribute source.



2
3
4
# File 'lib/emerge-gem/ebuild.rb', line 2

def source
  @source
end

#specObject

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

#filenameObject



9
10
11
# File 'lib/emerge-gem/ebuild.rb', line 9

def filename
  "#{p}.ebuild"
end

#pObject



13
14
15
# File 'lib/emerge-gem/ebuild.rb', line 13

def p
  "#{pn}-#{pv}"
end

#pnObject Also known as: name



17
18
19
# File 'lib/emerge-gem/ebuild.rb', line 17

def pn
  spec.name.downcase
end

#pvObject



22
23
24
# File 'lib/emerge-gem/ebuild.rb', line 22

def pv
  spec.version.version
end

#uriObject



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