changelog 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ /*.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format nested
data/CHANGELOG ADDED
@@ -0,0 +1,11 @@
1
+ = Version 0.4
2
+ * Fixed the order, the first version is supposed to be at the bottom, not at the top.
3
+
4
+ = Version 0.3
5
+ * CHANGELOG#last_version_changes renamed to CHANGELOG#version_changes and it takes optinal argument with version
6
+
7
+ = Version 0.2
8
+ * Removed Ruby 1.8 compatibility since we need unordered hash from 1.9
9
+
10
+ = Version 0.1
11
+ * Basic functionality
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 – 2010 Jakub Šťastný aka Botanicus
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,15 @@
1
+ h1. About
2
+
3
+ Simple CHANGELOG parser for Ruby 1.9.
4
+
5
+ h1. Usage
6
+
7
+ <pre>
8
+ changelog = CHANGELOG.new("/path/to/my/changelog")
9
+ puts "Changes in the last version #{changelog.last_version_name}: \n- #{changelog.last_version_changes.join("\n- ")}"
10
+ </pre>
11
+
12
+ h1. Links
13
+
14
+ * "RDoc.info API Docs":http://rdoc.info/projects/botanicus/changelog
15
+ * "Yardoc.org API Docs":http://yardoc.org/docs/botanicus-changelog
data/changelog.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env gem build
2
+ # encoding: utf-8
3
+
4
+ $:.unshift(File.join(File.dirname(__FILE__), "lib"))
5
+
6
+ require "changelog"
7
+ require "base64"
8
+
9
+ Gem::Specification.new do |s|
10
+ s.name = "changelog"
11
+ s.version = "0.4"
12
+ s.authors = ["Jakub Šťastný aka Botanicus"]
13
+ s.homepage = "http://github.com/botanicus/changelog"
14
+ s.summary = "Simple CHANGELOG parser for Ruby 1.9"
15
+ s.description = "" # TODO: long description
16
+ s.cert_chain = nil
17
+ s.email = Base64.decode64("c3Rhc3RueUAxMDFpZGVhcy5jeg==\n")
18
+ s.has_rdoc = true
19
+
20
+ # files
21
+ s.files = `git ls-files`.split("\n")
22
+
23
+ s.require_paths = ["lib"]
24
+
25
+ # ruby version
26
+ s.required_ruby_version = ::Gem::Requirement.new("~> 1.9")
27
+
28
+ # post install message
29
+ s.post_install_message = CHANGELOG.new.version_changes
30
+
31
+ # RubyForge
32
+ s.rubyforge_project = "changelog"
33
+ end
data/lib/changelog.rb CHANGED
@@ -22,7 +22,7 @@ class CHANGELOG
22
22
  # @author Jakub Stastny aka Botanicus
23
23
  # @since 0.0.1
24
24
  def last_version_name
25
- self.versions.last
25
+ self.versions.first
26
26
  end
27
27
 
28
28
  # @return [Array<String>, nil]
@@ -33,7 +33,7 @@ class CHANGELOG
33
33
  # changelog.version_changes
34
34
  # changelog.version_changes("Version 0.1")
35
35
  # changelog.version_changes(/0\.1/)
36
- def version_changes(version = self.versions.last)
36
+ def version_changes(version = self.versions.first)
37
37
  self.parse[version].inject(String.new) do |buffer, line|
38
38
  buffer += "[\e[32m#{version}\e[0m] #{line}\n"
39
39
  end
@@ -15,32 +15,35 @@ describe CHANGELOG do
15
15
  end
16
16
 
17
17
  describe "#versions" do
18
- it "should returns all versions described in the CHANGELOG" do
19
- versions = ["Version 0.0.1 Miracle Born",
20
- "Version 0.1", "Version 0.1.1", "Version 0.1.2",
21
- "Version 0.2.0", "Version 0.2.1"]
18
+ it "should return all versions described in the CHANGELOG" do
19
+ versions = ["Version 0.2.1", "Version 0.2.0", "Version 0.1.2",
20
+ "Version 0.1.1", "Version 0.1", "Version 0.0.1 Miracle Born"]
22
21
  @changelog.versions.should eql(versions)
23
22
  end
24
23
  end
25
24
 
26
25
  describe "#last_version_name" do
27
- it "should returns name of the last version" do
26
+ it "should return name of the last version" do
28
27
  @changelog.last_version_name.should eql("Version 0.2.1")
29
28
  end
30
29
  end
31
30
 
32
- describe "#last_version_changes" do
33
- it "should returns changes in the last version" do
34
- @changelog.last_version_changes.should eql(["Cucumber Integration"])
31
+ describe "#version_changes" do
32
+ it "should return changes in the last version by default" do
33
+ @changelog.version_changes.should match(/Cucumber Integration/)
34
+ end
35
+
36
+ it "should return changes in the last version for the given version" do
37
+ @changelog.version_changes("Version 0.0.1 Miracle Born").should match(/Just basics/)
35
38
  end
36
39
  end
37
40
 
38
41
  describe "#[]" do
39
- it "should returns changes for given version" do
42
+ it "should return changes for given version" do
40
43
  @changelog["Version 0.2.1"].should eql(["Cucumber Integration"])
41
44
  end
42
45
 
43
- it "should returns changes for given pattern if only version is matched" do
46
+ it "should return changes for given pattern if only version is matched" do
44
47
  @changelog[/Version 0.2.[12]/].should eql(["Cucumber Integration"])
45
48
  end
46
49
 
@@ -50,8 +53,8 @@ describe CHANGELOG do
50
53
  end
51
54
 
52
55
  describe "#select" do
53
- it "should be able to returns {version => [changes]} hash for all the versions matching given pattern" do
54
- versions = ["Version 0.1", "Version 0.1.1", "Version 0.1.2"]
56
+ it "should return {version => [changes]} hash for all the versions matching given pattern" do
57
+ versions = ["Version 0.1.2", "Version 0.1.1", "Version 0.1"]
55
58
  @changelog.select(/^Version 0.1/).keys.should eql(versions)
56
59
  end
57
60
  end
data/spec/data.txt CHANGED
@@ -1,12 +1,14 @@
1
- = Version 0.0.1 Miracle Born
2
- * Just basics
1
+ = Version 0.2.1
2
+ * Cucumber Integration
3
3
 
4
- = Version 0.1
5
- * [FEATURE] environments support
6
- * [SPECS] All specs passing
7
- * SimpleTemplater, RubyExts & CLI
8
- * [FEATURE] Bundler Support
9
- * [FEATURE] Rack-mount support
4
+ = Version 0.2.0
5
+ * Template helpers can work with paths relative to current template via ./path.html resp. ../path.html. All other paths are relative to the template paths.
6
+ * Use simple-logger as a default logger or standar logger if the simple-logger isn't installed.
7
+
8
+ = Version 0.1.2
9
+ * Sequel support
10
+ * Project generator renamed to stack generator
11
+ * Removed app and bigapp generators
10
12
 
11
13
  = Version 0.1.1
12
14
  * Tilt support
@@ -14,14 +16,12 @@
14
16
  * ImplicitRendering and ExplicitRendering mixins for using locals
15
17
  vs. rendering in context of current controller instance
16
18
 
17
- = Version 0.1.2
18
- * Sequel support
19
- * Project generator renamed to stack generator
20
- * Removed app and bigapp generators
21
-
22
- = Version 0.2.0
23
- * Template helpers can work with paths relative to current template via ./path.html resp. ../path.html. All other paths are relative to the template paths.
24
- * Use simple-logger as a default logger or standar logger if the simple-logger isn't installed.
19
+ = Version 0.1
20
+ * [FEATURE] environments support
21
+ * [SPECS] All specs passing
22
+ * SimpleTemplater, RubyExts & CLI
23
+ * [FEATURE] Bundler Support
24
+ * [FEATURE] Rack-mount support
25
25
 
26
- = Version 0.2.1
27
- * Cucumber Integration
26
+ = Version 0.0.1 Miracle Born
27
+ * Just basics
metadata CHANGED
@@ -1,19 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ version: "0.4"
5
9
  platform: ruby
6
10
  authors:
7
11
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
8
12
  autorequire:
9
13
  bindir: bin
10
14
  cert_chain:
11
- date: 2010-01-10 00:00:00 +01:00
15
+ date: 2011-01-18 00:00:00 +00:00
12
16
  default_executable:
13
17
  dependencies: []
14
18
 
15
19
  description: ""
16
- email: knava.bestvinensis@gmail.com
20
+ email: stastny@101ideas.cz
17
21
  executables: []
18
22
 
19
23
  extensions: []
@@ -21,35 +25,45 @@ extensions: []
21
25
  extra_rdoc_files: []
22
26
 
23
27
  files:
28
+ - .gitignore
29
+ - .rspec
30
+ - CHANGELOG
31
+ - LICENSE
32
+ - README.textile
33
+ - changelog.gemspec
24
34
  - lib/changelog.rb
25
35
  - spec/changelog_spec.rb
26
36
  - spec/data.txt
27
- - spec/spec.opts
28
37
  has_rdoc: true
29
38
  homepage: http://github.com/botanicus/changelog
30
39
  licenses: []
31
40
 
32
- post_install_message: "[\e[32mVersion 0.3\e[0m] CHANGELOG#last_version_changes renamed to CHANGELOG#version_changes and it takes optinal argument with version\n"
41
+ post_install_message: "[\e[32mVersion 0.4\e[0m] Fixed the order, the first version is supposed to be at the bottom, not at the top.\n"
33
42
  rdoc_options: []
34
43
 
35
44
  require_paths:
36
45
  - lib
37
46
  required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
38
48
  requirements:
39
49
  - - ~>
40
50
  - !ruby/object:Gem::Version
51
+ segments:
52
+ - 1
53
+ - 9
41
54
  version: "1.9"
42
- version:
43
55
  required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
44
57
  requirements:
45
58
  - - ">="
46
59
  - !ruby/object:Gem::Version
60
+ segments:
61
+ - 0
47
62
  version: "0"
48
- version:
49
63
  requirements: []
50
64
 
51
65
  rubyforge_project: changelog
52
- rubygems_version: 1.3.5
66
+ rubygems_version: 1.3.7
53
67
  signing_key:
54
68
  specification_version: 3
55
69
  summary: Simple CHANGELOG parser for Ruby 1.9
data/spec/spec.opts DELETED
@@ -1,5 +0,0 @@
1
- --colour
2
- --format
3
- progress
4
- --loadby
5
- mtime