Class: Libertine::SCM
- Inherits:
-
Struct
- Object
- Struct
- Libertine::SCM
- Defined in:
- lib/libertine/scm.rb,
lib/libertine/scm/git.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Git
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
Instance Method Summary collapse
-
#files ⇒ Object
FIX: includes & excludes here instead?.
- #implement(method, default = nil) ⇒ Object
- #release ⇒ Object
- #releaseable? ⇒ Boolean
- #released?(version = nil) ⇒ Boolean
- #tags ⇒ Object
- #version ⇒ Object
- #versions ⇒ Object
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir
5 6 7 |
# File 'lib/libertine/scm.rb', line 5 def dir @dir end |
Instance Method Details
#files ⇒ Object
FIX: includes & excludes here instead?
6 7 8 |
# File 'lib/libertine/scm.rb', line 6 def files # FIX: includes & excludes here instead? implement :files, [] end |
#implement(method, default = nil) ⇒ Object
10 11 12 13 |
# File 'lib/libertine/scm.rb', line 10 def implement method, default = nil $stderr.puts "#{self.class.name}##{method} isn't implemented!" default end |
#release ⇒ Object
15 16 17 18 19 |
# File 'lib/libertine/scm.rb', line 15 def release if released? version raise Libertine::Error, "v#{version} is already released!" end end |
#releaseable? ⇒ Boolean
25 26 27 |
# File 'lib/libertine/scm.rb', line 25 def releaseable? false end |
#released?(version = nil) ⇒ Boolean
21 22 23 |
# File 'lib/libertine/scm.rb', line 21 def released? version = nil versions.include? version || self.version end |
#tags ⇒ Object
29 30 31 |
# File 'lib/libertine/scm.rb', line 29 def implement :tags, [] end |
#version ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/libertine/scm.rb', line 33 def version return @version if defined? @version regexp = /VERSION += +([\"\'])([\d][\w\.]+)\1/ files.select { |f| %r%lib/.*\.rb\Z% =~ f }.each do |file| break if @version = File.read(file)[regexp, 2] end @version or raise Libertine::Error, "Can't find VERSION in lib/*.rb. Add it." end |
#versions ⇒ Object
45 46 47 48 |
# File 'lib/libertine/scm.rb', line 45 def versions .select { |t| /\Av#{Gem::Version::VERSION_PATTERN}\Z/ =~ t }. map { |t| t[1..-1] }.sort_by { |v| Gem::Version.new v } end |