change-log 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +86 -0
- data/app/assets/javascripts/change_log/application.js +26 -2
- data/app/assets/stylesheets/change_log/application.css +10 -0
- data/app/controllers/change_log/application_controller.rb +9 -2
- data/app/controllers/change_log/base_controller.rb +3 -3
- data/app/helpers/change_log/application_helper.rb +1 -1
- data/app/views/change_log/base/index.html.erb +26 -5
- data/lib/change-log.rb +1 -0
- data/lib/change_log/config.rb +3 -1
- data/lib/change_log/version.rb +1 -1
- data/lib/generators/change_log/install_generator.rb +1 -1
- data/lib/generators/change_log/templates/initializer.erb +3 -2
- data/lib/generators/change_log/templates/migration.rb +2 -4
- data/lib/tasks/change_log_tasks.rake +15 -11
- metadata +7 -6
- data/README.rdoc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d28c518959559f38238447798ea9d4411b3d1ee
|
4
|
+
data.tar.gz: f058ea66fdbcbc6fe273146715e31d17c7272150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac27c2deba965ae351b17f41ef92aa680d6dd9d1a05162ba8966d7fd1437b7f0f51a8af02acb403fd80130630800f120b74f9adb70ab7aaf5abe091d05665dfe
|
7
|
+
data.tar.gz: 81ce28ae28a52c2cd8b1445aa4f4fecde3b63a58dbaba4a68586cebc876f5eecb0fe78d1788b6f021793c49cf1d5e061e489c9aa48ee0f5132d53e9b43ddaa04
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# ChangeLog
|
2
|
+
|
3
|
+
ChangeLog is a Rails engine designed to facilitate parsing change log from git commit message and display in the browser.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
ChangeLog is compatible with Rails > 3.1
|
8
|
+
|
9
|
+
ChangeLog works with `activerecord` and `mongoid`
|
10
|
+
|
11
|
+
##Usage
|
12
|
+
ChangeLog does not consider all the commit messages but with a special prefix. (`~~~` is default but you can override with other in the `change_log.rb` config file )
|
13
|
+
|
14
|
+
You can tag your messages. Like you may have 3/4 tags in each build.
|
15
|
+
|
16
|
+
If you commit with a message like this:
|
17
|
+
```bash
|
18
|
+
~~~VERSION_NUMBER(optional) # it will starts from 0.0.1 and path option will be increased if VERSION_NUMBER is not given
|
19
|
+
~~feature # here feature is a tag
|
20
|
+
- feature one
|
21
|
+
- feature two
|
22
|
+
- feature three implemented
|
23
|
+
|
24
|
+
~~bug
|
25
|
+
- bug 1 resolved
|
26
|
+
- bug 2 resolved
|
27
|
+
- bug 3 resolved
|
28
|
+
|
29
|
+
~~api
|
30
|
+
+ api foo implemented
|
31
|
+
+ api bar modified
|
32
|
+
```
|
33
|
+
|
34
|
+
and run
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
rake change_log:update_log
|
38
|
+
```
|
39
|
+
You will have output like:
|
40
|
+
|
41
|
+
##0.0.1 {TIME}
|
42
|
+
<p>feature:</p>
|
43
|
+
- feature one
|
44
|
+
- feature two
|
45
|
+
- feature three implemented
|
46
|
+
|
47
|
+
<p>bug:</p>
|
48
|
+
- bug 1 resolved
|
49
|
+
- bug 2 resolved
|
50
|
+
- bug 3 resolved
|
51
|
+
|
52
|
+
<p>api:</p>
|
53
|
+
+ api foo implemented
|
54
|
+
+ api bar modified
|
55
|
+
|
56
|
+
The commit message is markdown enabled
|
57
|
+
## Installation & Setup
|
58
|
+
|
59
|
+
To install add the following to your Gemfile:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
gem 'change-log'
|
63
|
+
```
|
64
|
+
|
65
|
+
To setup just run:
|
66
|
+
|
67
|
+
```bash
|
68
|
+
$ rake change_log:setup
|
69
|
+
```
|
70
|
+
|
71
|
+
and follow the guide !
|
72
|
+
|
73
|
+
## Authentication
|
74
|
+
|
75
|
+
If you want to authenticate users who can access ChangeLog, you need to provide <tt>ChangeLog::ApplicationController.authenticator</tt> proc. For example :
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
# config/initializers/change_log.rb
|
79
|
+
ChangeLog::ApplicationController.authenticator = proc {
|
80
|
+
authenticate_or_request_with_http_basic do |user_name, password|
|
81
|
+
user_name == 'change-log' && password == 'passme'
|
82
|
+
end
|
83
|
+
}
|
84
|
+
```
|
85
|
+
|
86
|
+
Authenticator proc will be run from a before filter in controller context.
|
@@ -11,5 +11,29 @@
|
|
11
11
|
// GO AFTER THE REQUIRES BELOW.
|
12
12
|
//
|
13
13
|
//= require jquery.min
|
14
|
-
//=
|
15
|
-
|
14
|
+
//= require_self
|
15
|
+
|
16
|
+
(function ($) {
|
17
|
+
$(document).on('click', 'ul.tag-list input[type=checkbox]', function () {
|
18
|
+
$('.version-wrapper').show();
|
19
|
+
|
20
|
+
$('ul.tag-list input[type=checkbox]:not(:checked)').each(function () {
|
21
|
+
var tagDiv = $('.tag-start.' + $(this).val());
|
22
|
+
tagDiv.hide();
|
23
|
+
|
24
|
+
});
|
25
|
+
|
26
|
+
$('ul.tag-list input[type=checkbox]:checked').each(function () {
|
27
|
+
var tagDiv = $('.tag-start.' + $(this).val());
|
28
|
+
tagDiv.show();
|
29
|
+
if (tagDiv.parent('.version-wrapper').find('div.tag-start:visible').length > 0)
|
30
|
+
tagDiv.parent('.version-wrapper').show()
|
31
|
+
});
|
32
|
+
|
33
|
+
$('.version-wrapper').each(function () {
|
34
|
+
if ($(this).find('div.tag-start:visible').length <= 0)
|
35
|
+
$(this).hide()
|
36
|
+
});
|
37
|
+
|
38
|
+
})
|
39
|
+
})(jQuery);
|
@@ -297,3 +297,13 @@
|
|
297
297
|
.markdown-body pre code:before, .markdown-body pre code:after, .markdown-body pre tt:before, .markdown-body pre tt:after {
|
298
298
|
content: normal;
|
299
299
|
}
|
300
|
+
|
301
|
+
.markdown-body ul.tag-list {
|
302
|
+
margin: 0;
|
303
|
+
padding: 0;
|
304
|
+
list-style-type: none;
|
305
|
+
}
|
306
|
+
.markdown-body ul.tag-list li{
|
307
|
+
display: inline;
|
308
|
+
padding: 7px 15px;
|
309
|
+
}
|
@@ -1,5 +1,12 @@
|
|
1
|
-
require 'rdiscount'
|
2
1
|
module ChangeLog
|
3
|
-
class ApplicationController <
|
2
|
+
class ApplicationController < ::ApplicationController
|
3
|
+
|
4
|
+
cattr_accessor :authenticator
|
5
|
+
|
6
|
+
before_filter :authenticate_change_log
|
7
|
+
|
8
|
+
def authenticate_change_log
|
9
|
+
instance_exec(nil, &self.authenticator) if self.authenticator && self.authenticator.respond_to?(:instance_exec)
|
10
|
+
end
|
4
11
|
end
|
5
12
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ChangeLog
|
2
|
-
class BaseController < ::ApplicationController
|
2
|
+
class BaseController < ChangeLog::ApplicationController
|
3
3
|
layout ChangeLog.config.layout
|
4
4
|
|
5
5
|
def index
|
@@ -8,9 +8,9 @@ module ChangeLog
|
|
8
8
|
|
9
9
|
def _model
|
10
10
|
if ChangeLog.config.orm == 'activerecord'
|
11
|
-
ChangeLog::ActiverecordModel
|
11
|
+
@change_log_model = ChangeLog::ActiverecordModel
|
12
12
|
else
|
13
|
-
ChangeLog::MongoidModel
|
13
|
+
@change_log_model = ChangeLog::MongoidModel
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -1,5 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<% cache @change_log_model.last_release do %>
|
2
|
+
<% if ChangeLog.config.tag_filter_enabled %>
|
3
|
+
<fieldset>
|
4
|
+
<legend>Tags:</legend>
|
5
|
+
<ul class="tag-list">
|
6
|
+
<% @items.collect(&:tags).join(',').split(',').uniq.each do |tag| %>
|
7
|
+
<li>
|
8
|
+
<%= check_box_tag '_', tag, true %> <%= tag %>
|
9
|
+
</li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
</fieldset>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<% @items.each do |item| %>
|
16
|
+
<div class="version-wrapper">
|
17
|
+
<h2> <%= item.version %> {<%= l item.time.to_date %>}</h2>
|
18
|
+
<%= md item.message %>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
<% if @items.count == 0 %>
|
22
|
+
Please run <code>rake change_log:update_log</code> to get change logs here. <br/>
|
23
|
+
For more information please visit: <a href="https://github.com/amuntasim/change-log">ChangeLog Wiki</a>
|
24
|
+
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
data/lib/change-log.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "change_log"
|
data/lib/change_log/config.rb
CHANGED
@@ -2,7 +2,6 @@ require 'active_support/core_ext/class/attribute_accessors'
|
|
2
2
|
|
3
3
|
module ChangeLog
|
4
4
|
module Config
|
5
|
-
|
6
5
|
class << self
|
7
6
|
# Table prefix to avoid collision
|
8
7
|
attr_accessor :table_prefix
|
@@ -17,11 +16,14 @@ module ChangeLog
|
|
17
16
|
|
18
17
|
attr_accessor :tag_prefix
|
19
18
|
|
19
|
+
attr_accessor :tag_filter_enabled
|
20
|
+
|
20
21
|
def reset
|
21
22
|
@layout = 'change_log/application'
|
22
23
|
@table_prefix = nil
|
23
24
|
@commit_prefix = '~~~'
|
24
25
|
@tag_prefix = '~~'
|
26
|
+
@tag_filter_enabled = true
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
data/lib/change_log/version.rb
CHANGED
@@ -32,7 +32,7 @@ module ChangeLog
|
|
32
32
|
@table_prefix = ask_for("Do you want to add #{_table} prefix?", nil, table_prefix)
|
33
33
|
template "initializer.erb", "config/initializers/change_log.rb"
|
34
34
|
else
|
35
|
-
display "You already have a config file.
|
35
|
+
display "You already have a config file. generating a new 'change_log.rb.example' that you can review."
|
36
36
|
template "initializer.erb", "config/initializers/change_log.rb.example"
|
37
37
|
end
|
38
38
|
|
@@ -23,12 +23,13 @@ ChangeLog.config do |config|
|
|
23
23
|
#config.commit_prefix = '~~~'
|
24
24
|
|
25
25
|
#config.tag_prefix = '~~'
|
26
|
+
|
27
|
+
#config.tag_filter_enabled = true
|
28
|
+
|
26
29
|
end if defined? ChangeLog
|
27
30
|
|
28
|
-
<% if @table_prefix.present? %>
|
29
31
|
<% if @orm == 'mongoid' -%>
|
30
32
|
ChangeLog::MongoidModel.store_in collection: :'<%= [@table_prefix, 'change_logs'].compact.join('_') %>'
|
31
33
|
<% else %>
|
32
34
|
ChangeLog::ActiverecordModel.table_name = '<%= [@table_prefix, 'change_logs'].compact.join('_') %>'
|
33
35
|
<% end -%>
|
34
|
-
<% end %>
|
@@ -1,16 +1,14 @@
|
|
1
|
-
class
|
1
|
+
class CreateChangeLogTables < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
create_table :<%= [table_prefix, 'change_logs'].compact.join('_') %> do |t|
|
4
4
|
t.string :version, limit: 20
|
5
5
|
t.datetime :time
|
6
6
|
t.string :message, limit: 1000
|
7
7
|
t.string :author, limit: 50
|
8
|
+
t.string :tags, limit: 100
|
8
9
|
t.datetime :created_at
|
9
10
|
t.datetime :updated_at
|
10
11
|
end
|
11
|
-
|
12
|
-
add_index :<%= [table_prefix, 'change_logs'].compact.join('_') %>, :category
|
13
|
-
|
14
12
|
end
|
15
13
|
|
16
14
|
def self.down
|
@@ -5,27 +5,26 @@ namespace :change_log do
|
|
5
5
|
desc "Copying settings, models etc."
|
6
6
|
task :setup => :environment do
|
7
7
|
system 'rails g change_log:install'
|
8
|
+
Rake::Task['db:migrate'].invoke
|
8
9
|
end
|
9
10
|
|
10
11
|
desc "parse release notes and put into db"
|
11
12
|
task :update_log , [:repo_path] => :environment do |t, args|
|
13
|
+
require 'git'
|
12
14
|
repo_path = args.repo_path || Rails.root
|
13
|
-
repo =
|
14
|
-
walker = Rugged::Walker.new(repo)
|
15
|
-
walker.push(repo.head.target_id)
|
16
|
-
walker.sorting(Rugged::SORT_DATE) # optional
|
15
|
+
repo = Git.open(repo_path)
|
17
16
|
last_release = base_model.last_release
|
18
17
|
if last_release
|
19
|
-
records =
|
18
|
+
records = repo.log.since(last_release.time).select { |c| c.message =~ /#{ChangeLog.config.commit_prefix}/ }
|
20
19
|
else
|
21
|
-
records =
|
20
|
+
records = repo.log.select { |c| c.message =~ /#{ChangeLog.config.commit_prefix}/ }
|
22
21
|
end
|
23
22
|
records.each do |record|
|
24
|
-
|
23
|
+
parse_and_store_commit_message(record, last_release)
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
|
-
def
|
27
|
+
def parse_and_store_commit_message(record, last_release)
|
29
28
|
# messages = <<-eos
|
30
29
|
# ###
|
31
30
|
# ##api
|
@@ -46,18 +45,23 @@ namespace :change_log do
|
|
46
45
|
formatted_message = []
|
47
46
|
lines.each do |line|
|
48
47
|
if tag = parse_tag(line)
|
48
|
+
formatted_message << "</div>" if o_tag.any?
|
49
|
+
formatted_message << "<div class='tag-start #{tag}'>"
|
50
|
+
|
49
51
|
o_tag << tag
|
50
|
-
formatted_message << "<p>#{tag}
|
52
|
+
formatted_message << "<p>#{tag}:</p>"
|
51
53
|
else
|
52
54
|
formatted_message << line
|
53
55
|
end
|
54
56
|
end
|
55
|
-
|
57
|
+
formatted_message << "\n </div>"
|
58
|
+
|
59
|
+
base_model.create(version: version, author: record.author, message: formatted_message.join(''), time: record.date, tags: o_tag.join(','))
|
56
60
|
#base_model.create(version: version, author: 'record.author', message: formatted_message.join(''), time: 'record.time', tags: o_tag.join(','))
|
57
61
|
end
|
58
62
|
|
59
63
|
def parse_tag(line)
|
60
|
-
line.gsub(ChangeLog.config.tag_prefix
|
64
|
+
line.gsub(/#{ChangeLog.config.tag_prefix}|\:/, '').strip if line =~ /#{ChangeLog.config.tag_prefix}/
|
61
65
|
end
|
62
66
|
|
63
67
|
def version_number(line)
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: change-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muntasim Ahmed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: git
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.2.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.2.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: orm_adapter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +95,7 @@ extensions: []
|
|
95
95
|
extra_rdoc_files: []
|
96
96
|
files:
|
97
97
|
- MIT-LICENSE
|
98
|
-
- README.
|
98
|
+
- README.md
|
99
99
|
- Rakefile
|
100
100
|
- app/assets/javascripts/change_log/application.js
|
101
101
|
- app/assets/stylesheets/change_log/application.css
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- app/views/change_log/base/index.html.erb
|
108
108
|
- app/views/layouts/change_log/application.html.erb
|
109
109
|
- config/routes.rb
|
110
|
+
- lib/change-log.rb
|
110
111
|
- lib/change_log.rb
|
111
112
|
- lib/change_log/config.rb
|
112
113
|
- lib/change_log/engine.rb
|
data/README.rdoc
DELETED