simple_changelog 0.0.8 → 0.0.9

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.
@@ -9,7 +9,4 @@
9
9
  //
10
10
  // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
11
  // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
12
  //= require_tree .
@@ -7,20 +7,18 @@ module SimpleChangelog
7
7
  def highlight_commit_tags(commit_message)
8
8
  highlighted_message = commit_message.gsub(/\[[^\[\]]+\]/) do |tag|
9
9
  tag_class = tag.gsub(/[^A-Za-z]/, '').downcase
10
- content_tag(:span, class:tag_class) { tag }
10
+ content_tag(:span, class: tag_class) { tag }
11
11
  end
12
12
 
13
- highlighted_message.html_safe
13
+ highlighted_message.html_safe
14
14
  end
15
15
 
16
16
  def current_version_tag
17
17
  Repository.new.current_version_tag
18
18
  end
19
19
 
20
- def changelog_link
21
- unless Rails.env.production?
22
- link_to current_version_tag, simple_changelog_url
23
- end
20
+ def changelog_link(html_options = {})
21
+ link_to current_version_tag, simple_changelog_path, html_options
24
22
  end
25
23
  end
26
24
  end
@@ -1,4 +1,3 @@
1
1
  module SimpleChangelog
2
- class Commit < Struct.new(:message, :date, :id)
3
- end
2
+ Commit = Struct.new(:message, :date, :id)
4
3
  end
@@ -3,13 +3,14 @@ module SimpleChangelog
3
3
  def initialize(path = Rails.root)
4
4
  @repo = Grit::Repo.new path
5
5
  @tags = @repo.tags
6
- @commits = @repo.commits
6
+ @commits = @repo.commits
7
7
  end
8
8
 
9
9
  def load_history
10
10
  history = {}
11
+
11
12
  if @tags.any? || @commits.any?
12
- middle_tags = convert_tags(@tags).sort_by { |t| t.date }
13
+ middle_tags = convert_tags(@tags).sort_by { |t| t.name }
13
14
  tags = [tail_tag] + middle_tags + [head_tag]
14
15
  tags.reverse!
15
16
 
@@ -25,7 +26,8 @@ module SimpleChangelog
25
26
  if @tags.empty?
26
27
  @commits.empty? ? '' : 'HEAD'
27
28
  else
28
- @tags.last.name
29
+ last_tag = @tags.sort_by { |t| t.name }.last
30
+ last_tag.name
29
31
  end
30
32
  end
31
33
 
@@ -48,19 +50,11 @@ module SimpleChangelog
48
50
  end
49
51
 
50
52
  def convert_commits(commits)
51
- commits.map do |c|
52
- Commit.new(c.short_message,
53
- c.date,
54
- c.id)
55
- end
53
+ commits.map { |c| Commit.new(c.short_message, c.date, c.id) }
56
54
  end
57
55
 
58
56
  def convert_tags(tags)
59
- tags.map do |t|
60
- Tag.new(t.name,
61
- t.tag_date,
62
- t.commit.id)
63
- end
57
+ tags.map { |t| Tag.new(t.name, t.tag_date, t.commit.id) }
64
58
  end
65
59
  end
66
60
  end
@@ -1,4 +1,3 @@
1
1
  module SimpleChangelog
2
- class Tag < Struct.new(:name, :date, :commit_id)
3
- end
2
+ Tag = Struct.new(:name, :date, :commit_id)
4
3
  end
@@ -1,16 +1,16 @@
1
1
  module SimpleChangelog
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
4
- source_root File.expand_path("../../templates", __FILE__)
4
+ source_root File.expand_path('../../templates', __FILE__)
5
5
 
6
- desc "Mounts simple_changelog to your application."
6
+ desc 'Mounts simple_changelog to your application.'
7
7
 
8
8
  def mount_engine
9
- route 'mount SimpleChangelog::Engine => "/simple_changelog", as: "simple_changelog" '
9
+ route 'mount SimpleChangelog::Engine => \'/changelog\', as: \'simple_changelog\''
10
10
  end
11
11
 
12
12
  def show_readme
13
- readme "README" if behavior == :invoke
13
+ readme 'README' if behavior == :invoke
14
14
  end
15
15
  end
16
16
  end
@@ -3,12 +3,13 @@ Generator mounted SimpleChangelog
3
3
  in your config/routes.rb file:
4
4
 
5
5
  It will also generate simple_changelog_url
6
- and simple_changelog_uri methods
6
+ and simple_changelog_path methods
7
7
 
8
8
  SimpleChangelog::RepositoriesHelper has been
9
9
  connected to your app.
10
10
 
11
- You can use the following methods:
11
+ You can use the following helper methods:
12
12
  #long_date_format(datetime)
13
13
  #highlight_commit_tags(commit_message)
14
14
  #current_version_tag
15
+ #changelog_link(html_options)
@@ -1,3 +1,3 @@
1
1
  module SimpleChangelog
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
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.8
4
+ version: 0.0.9
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-04 00:00:00.000000000 Z
12
+ date: 2012-12-05 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/helpers/simple_changelog/repositories_helper.rb
86
+ - app/views/layouts/simple_changelog/application.html.erb
87
+ - app/views/simple_changelog/repositories/_version_tag.html.erb
88
+ - app/views/simple_changelog/repositories/show.html.erb
89
+ - app/views/simple_changelog/repositories/_commit.html.erb
87
90
  - app/helpers/simple_changelog/application_helper.rb
88
- - app/controllers/simple_changelog/application_controller.rb
89
- - app/controllers/simple_changelog/repositories_controller.rb
91
+ - app/helpers/simple_changelog/repositories_helper.rb
90
92
  - app/models/simple_changelog/tag.rb
91
93
  - app/models/simple_changelog/commit.rb
92
94
  - app/models/simple_changelog/repository.rb
93
- - app/views/simple_changelog/repositories/_commit.html.erb
94
- - app/views/simple_changelog/repositories/_version_tag.html.erb
95
- - app/views/simple_changelog/repositories/show.html.erb
96
- - app/views/layouts/simple_changelog/application.html.erb
95
+ - app/controllers/simple_changelog/application_controller.rb
96
+ - app/controllers/simple_changelog/repositories_controller.rb
97
97
  - app/assets/javascripts/simple_changelog/application.js
98
98
  - app/assets/javascripts/simple_changelog/repositories.js
99
99
  - app/assets/stylesheets/simple_changelog/repositories.css
100
100
  - app/assets/stylesheets/simple_changelog/application.css
101
101
  - config/routes.rb
102
- - lib/simple_changelog.rb
102
+ - lib/generators/templates/README
103
+ - lib/generators/simple_changelog/install_generator.rb
103
104
  - lib/tasks/simple_changelog_tasks.rake
105
+ - lib/simple_changelog.rb
104
106
  - lib/simple_changelog/engine.rb
105
107
  - lib/simple_changelog/version.rb
106
- - lib/generators/simple_changelog/install_generator.rb
107
- - lib/generators/templates/README
108
108
  - MIT-LICENSE
109
109
  - Rakefile
110
110
  - README.rdoc