Class: Gaffer::Base
- Inherits:
-
Object
- Object
- Gaffer::Base
- Defined in:
- lib/gaffer/base.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
Returns the value of attribute build.
-
#depends ⇒ Object
Returns the value of attribute depends.
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#git ⇒ Object
Returns the value of attribute git.
-
#maintainer ⇒ Object
Returns the value of attribute maintainer.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#project ⇒ Object
Returns the value of attribute project.
-
#readme ⇒ Object
Returns the value of attribute readme.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gaffer/base.rb', line 5 def initialize() @dir = [:dir] || Dir.pwd @git = Git.open(@dir) @version = [:version] @project = [:project] || File.basename(File.dirname(@git.repo.path)) @maintainer = "#{@git.config["user.name"]} <#{@git.config["user.email"]}>" @prefix = [:prefix] || "opt/#{@project}" @git.chdir do @readme = File.read("README") rescue "no README file" @depends = File.read("DEPENDS").chomp rescue "libc6 (>= 2.10)" @version ||= File.read("VERSION").chomp end puts "======> #{@version.inspect}" build_id = @git..map { |a| a.name =~ /^#{@version}-(.+)/; $1.to_i }.sort.last.to_i + 1 @build = "#{@version}-#{build_id}" raise "Bad version #{@version}" unless @version =~ /^\d+[.]\d+[.]\d+$/ end |
Instance Attribute Details
#build ⇒ Object
Returns the value of attribute build.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def build @build end |
#depends ⇒ Object
Returns the value of attribute depends.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def depends @depends end |
#dir ⇒ Object
Returns the value of attribute dir.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def dir @dir end |
#git ⇒ Object
Returns the value of attribute git.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def git @git end |
#maintainer ⇒ Object
Returns the value of attribute maintainer.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def maintainer @maintainer end |
#prefix ⇒ Object
Returns the value of attribute prefix.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def prefix @prefix end |
#project ⇒ Object
Returns the value of attribute project.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def project @project end |
#readme ⇒ Object
Returns the value of attribute readme.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def readme @readme end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/gaffer/base.rb', line 3 def version @version end |
Instance Method Details
#compile ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/gaffer/base.rb', line 26 def compile @git.add_tag(@build) ## check version - tag repo [ "i386", "amd64" ].each do |arch| Gaffer::Deb.new(self, arch, project, depends).compile Gaffer::Deb.new(self, arch, "#{project}-dev", "#{project} (>= #{@version})").compile end end |