Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removing requirement on YAML to use version, and moving VERSION to a …

…file in lib
  • Loading branch information...
commit fdb1fbfe9a53b179b5e319c6e061bce0e7ccc62d 1 parent f35decc
@mikel authored
View
5 VERSION.yml
@@ -1,5 +0,0 @@
----
-:patch: 3
-:major: 2
-:build:
-:minor: 2
View
4 lib/VERSION
@@ -0,0 +1,4 @@
+patch:4
+major:2
+build:
+minor:2
View
16 lib/mail/version.rb
@@ -3,13 +3,19 @@ module Mail
module VERSION
def self.version
- YAML.load_file(File.join(File.dirname(__FILE__), '../../', 'VERSION.yml'))
+ version_hash = {}
+ File.read(File.join(File.dirname(__FILE__), '../', 'VERSION')).each_line do |line|
+ type, value = line.chomp.split(":")
+ next if type =~ /^\s+$/ || value =~ /^\s+$/
+ version_hash[type] = value
+ end
+ version_hash
end
- MAJOR = version[:major]
- MINOR = version[:minor]
- PATCH = version[:patch]
- BUILD = version[:build]
+ MAJOR = version['major']
+ MINOR = version['minor']
+ PATCH = version['patch']
+ BUILD = version['build']
STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
end
View
11 mail.gemspec
@@ -1,6 +1,11 @@
def self.load_version
- vh = YAML.load_file(File.join(File.dirname(__FILE__), 'VERSION.yml'))
- [ vh[:major], vh[:minor], vh[:patch], vh[:build] ].compact.join(".")
+ vh = {}
+ File.read(File.join(File.dirname(__FILE__), 'lib/VERSION')).lines do |line|
+ type, value = line.chomp.split(":")
+ next if type =~ /^\s+$/ || value =~ /^\s+$/
+ vh[type] = value
+ end
+ [ vh['major'], vh['minor'], vh['patch'], vh['build'] ].compact.join(".")
end
Gem::Specification.new do |s|
@@ -21,5 +26,5 @@ Gem::Specification.new do |s|
s.add_dependency('treetop', '>= 1.4.5')
s.require_path = 'lib'
- s.files = %w(README.rdoc Rakefile TODO.rdoc VERSION.yml) + Dir.glob("lib/**/*")
+ s.files = %w(README.rdoc Rakefile TODO.rdoc) + Dir.glob("lib/**/*")
end
View
58 spec/matchers/break_down_to.rb
@@ -1,35 +1,33 @@
-# encoding: utf-8
-module CustomMatchers
- class BreakDownTo
- def initialize(expected)
- @expected = expected
- end
- def matches?(target)
- @target = target
- @failed = false
- @expected.each_pair do |k,v|
- unless @target.send(k) == @expected[k]
- @failed = k
+ module CustomMatchers
+ class BreakDownTo
+ def initialize(expected)
+ @expected = expected
end
- end
- !@failed
- end
- def failure_message
- "expected #{@failed} to be |#{@expected[@failed]}| " +
- "but was |#{@target.send(@failed)}|"
- end
+ def matches?(target)
+ @target = target
+ @failed = false
+ @expected.each_pair do |k,v|
+ @failed = k unless @target.send(k) == @expected[k]
+ end
+ !@failed
+ end
- def negative_failure_message
- "expected #{@failed} not to be |#{@expected[@failed]}| " +
- "and was |#{@target.send(@failed)}|"
- end
-
- end
+ def failure_message
+ "expected #{@failed} to be |#{@expected[@failed]}| " +
+ "but was |#{@target.send(@failed)}|"
+ end
+
+ def negative_failure_message
+ "expected #{@failed} not to be |#{@expected[@failed]}| " +
+ "and was |#{@target.send(@failed)}|"
+ end
+
+ end
- # Actual matcher that is exposed.
- def break_down_to(expected)
- BreakDownTo.new(expected)
- end
-end
+ # Actual matcher that is exposed.
+ def break_down_to(expected)
+ BreakDownTo.new(expected)
+ end
+ end
Please sign in to comment.
Something went wrong with that request. Please try again.