changelog 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ = Version 0.5
2
+ * Support for Ruby 1.8 (for some time!).
3
+
1
4
  = Version 0.5
2
5
  * Ordering is solved by ReverseHashMixin.
3
6
 
@@ -9,6 +9,14 @@ changelog = CHANGELOG.new("/path/to/my/changelog")
9
9
  puts "Changes in the last version #{changelog.last_version_name}: \n- #{changelog.last_version_changes.join("\n- ")}"
10
10
  </pre>
11
11
 
12
+ h1. JRuby
13
+
14
+ CHANGELOG _does_ work with JRuby, you just have to use the @--1.9@ switch:
15
+
16
+ <pre>
17
+ jruby --1.9 -S gem install changelog
18
+ </pre>
19
+
12
20
  h1. Links
13
21
 
14
22
  * "RDoc.info API Docs":http://rdoc.info/projects/botanicus/changelog
@@ -8,7 +8,7 @@ require "base64"
8
8
 
9
9
  Gem::Specification.new do |s|
10
10
  s.name = "changelog"
11
- s.version = "0.5"
11
+ s.version = "0.6"
12
12
  s.authors = ["Jakub Šťastný aka Botanicus"]
13
13
  s.homepage = "http://github.com/botanicus/changelog"
14
14
  s.summary = "Simple CHANGELOG parser for Ruby 1.9"
@@ -1,5 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
+ if RUBY_VERSION < "1.9"
4
+ # Yup, this is a disgusting hack.
5
+ require "ordered_hash_1.8"
6
+ Hash = OrderedHash
7
+ end
8
+
3
9
  class CHANGELOG
4
10
  module ReverseHashMixin
5
11
  def reverse
@@ -0,0 +1,49 @@
1
+ # This is a hack from http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/20551
2
+ # But seriously folks, just for fuck sake upgrade your damn Ruby finally :/
3
+ # I shall drop 1.8 support at some point, not very soon, but it's a matter of months,
4
+ # not years, OK?
5
+ class OrderedHash < Hash
6
+ alias_method :store, :[]=
7
+ alias_method :each_pair, :each
8
+
9
+ attr_reader :keys
10
+ def initialize
11
+ @keys = []
12
+ end
13
+
14
+ def []=(key, val)
15
+ @keys << key
16
+ super
17
+ end
18
+
19
+ def delete(key)
20
+ @keys.delete(key)
21
+ super
22
+ end
23
+
24
+ def each
25
+ @keys.each { |k| yield k, self[k] }
26
+ end
27
+
28
+ def each_key
29
+ @keys.each { |k| yield k }
30
+ end
31
+
32
+ def each_value
33
+ @keys.each { |k| yield self[k] }
34
+ end
35
+
36
+ def merge(hash)
37
+ @keys.push(*hash.keys)
38
+ super(hash)
39
+ end
40
+
41
+ def select(&block)
42
+ self.inject(self.class.new) do |buffer, pair|
43
+ if block.call(*pair)
44
+ buffer.merge(pair[0] => pair[1])
45
+ end
46
+ buffer
47
+ end
48
+ end
49
+ end
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: changelog
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 7
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 5
8
- version: "0.5"
8
+ - 6
9
+ version: "0.6"
9
10
  platform: ruby
10
11
  authors:
11
12
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
@@ -32,6 +33,7 @@ files:
32
33
  - README.textile
33
34
  - changelog.gemspec
34
35
  - lib/changelog.rb
36
+ - lib/ordered_hash_1.8.rb
35
37
  - spec/changelog_spec.rb
36
38
  - spec/data.txt
37
39
  has_rdoc: true
@@ -48,6 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
50
  requirements:
49
51
  - - ~>
50
52
  - !ruby/object:Gem::Version
53
+ hash: 29
51
54
  segments:
52
55
  - 1
53
56
  - 9
@@ -57,6 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
60
  requirements:
58
61
  - - ">="
59
62
  - !ruby/object:Gem::Version
63
+ hash: 3
60
64
  segments:
61
65
  - 0
62
66
  version: "0"