simple_changelog 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,12 +8,12 @@ module SimpleChangelog
8
8
 
9
9
  def load_history
10
10
  history = {}
11
-
11
+
12
12
  if @tags.any? || @commits.any?
13
13
  middle_tags = convert_tags(@tags).sort_by { |t| t.name }
14
- tags = [tail_tag] + middle_tags + [head_tag]
14
+ tags = [tail_tag] + middle_tags
15
+ tags << head_tag if has_head_commits?(middle_tags)
15
16
  tags.reverse!
16
-
17
17
  tags.each_cons(2) do |prev, succ|
18
18
  history[prev] = commits_between(succ, prev).sort_by { |c| c.message }
19
19
  end
@@ -23,7 +23,7 @@ module SimpleChangelog
23
23
  end
24
24
 
25
25
  def current_version_tag
26
- if @tags.empty?
26
+ if @tags.empty?
27
27
  @commits.empty? ? '' : 'HEAD'
28
28
  else
29
29
  last_tag = @tags.sort_by { |t| t.name }.last
@@ -33,6 +33,11 @@ module SimpleChangelog
33
33
 
34
34
  private
35
35
 
36
+ def has_head_commits?(middle_tags)
37
+ commit = @repo.commits('master', 1).first
38
+ !middle_tags.any? { |t| t.commit_id == commit.id }
39
+ end
40
+
36
41
  def head_tag
37
42
  commit = @repo.commits('master', 1).first
38
43
  Tag.new('HEAD', commit.date, commit.id)
@@ -45,7 +50,6 @@ module SimpleChangelog
45
50
 
46
51
  def commits_between(from, to)
47
52
  commits = @repo.commits_between(from.commit_id, to.commit_id)
48
- commits << @repo.commit(from.commit_id)
49
53
  convert_commits(commits)
50
54
  end
51
55
 
@@ -1,7 +1,7 @@
1
1
  <div class="version-tag">
2
2
  <h2 class="underlined"><%= version_tag.name %>&nbsp;(<%= long_date_format(version_tag.date) %>)</h2>
3
3
  <section class="commits">
4
- <%= render partial: 'commit',
5
- collection: changelog[version_tag] %>
4
+ <%= render partial: 'commit',
5
+ collection: changelog[version_tag] %>
6
6
  </section>
7
7
  </div>
@@ -1,7 +1,7 @@
1
1
  <div id="app-changelog">
2
2
  <h1 class="underlined">Application repository changelog</h1>
3
3
 
4
- <%= render partial: 'version_tag',
5
- collection: @changelog.keys,
6
- locals: { changelog: @changelog } %>
4
+ <%= render partial: 'version_tag',
5
+ collection: @changelog.keys,
6
+ locals: { changelog: @changelog } %>
7
7
  </div>
@@ -1,3 +1,3 @@
1
1
  module SimpleChangelog
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-05 00:00:00.000000000 Z
12
+ date: 2012-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -83,28 +83,28 @@ executables: []
83
83
  extensions: []
84
84
  extra_rdoc_files: []
85
85
  files:
86
- - app/views/layouts/simple_changelog/application.html.erb
86
+ - app/models/simple_changelog/repository.rb
87
+ - app/models/simple_changelog/commit.rb
88
+ - app/models/simple_changelog/tag.rb
89
+ - app/assets/stylesheets/simple_changelog/repositories.css
90
+ - app/assets/stylesheets/simple_changelog/application.css
91
+ - app/assets/javascripts/simple_changelog/repositories.js
92
+ - app/assets/javascripts/simple_changelog/application.js
93
+ - app/controllers/simple_changelog/application_controller.rb
94
+ - app/controllers/simple_changelog/repositories_controller.rb
87
95
  - app/views/simple_changelog/repositories/_version_tag.html.erb
88
96
  - app/views/simple_changelog/repositories/show.html.erb
89
97
  - app/views/simple_changelog/repositories/_commit.html.erb
98
+ - app/views/layouts/simple_changelog/application.html.erb
90
99
  - app/helpers/simple_changelog/application_helper.rb
91
100
  - app/helpers/simple_changelog/repositories_helper.rb
92
- - app/models/simple_changelog/tag.rb
93
- - app/models/simple_changelog/commit.rb
94
- - app/models/simple_changelog/repository.rb
95
- - app/controllers/simple_changelog/application_controller.rb
96
- - app/controllers/simple_changelog/repositories_controller.rb
97
- - app/assets/javascripts/simple_changelog/application.js
98
- - app/assets/javascripts/simple_changelog/repositories.js
99
- - app/assets/stylesheets/simple_changelog/repositories.css
100
- - app/assets/stylesheets/simple_changelog/application.css
101
101
  - config/routes.rb
102
+ - lib/tasks/simple_changelog_tasks.rake
102
103
  - lib/generators/templates/README
103
104
  - lib/generators/simple_changelog/install_generator.rb
104
- - lib/tasks/simple_changelog_tasks.rake
105
- - lib/simple_changelog.rb
106
105
  - lib/simple_changelog/engine.rb
107
106
  - lib/simple_changelog/version.rb
107
+ - lib/simple_changelog.rb
108
108
  - MIT-LICENSE
109
109
  - Rakefile
110
110
  - README.rdoc