katip 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/bin/katip +8 -73
- data/lib/katip.rb +2 -16
- data/lib/katip/change_logger.rb +88 -0
- data/lib/katip/railtie.rb +1 -1
- data/lib/katip/version.rb +1 -1
- data/lib/tasks/katip.rake +3 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 690f6aaa08505bf7e21b73a68048e28e5b9a5dd1
|
4
|
+
data.tar.gz: 90c088694013922737a29660b12ea97afef9ae26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab17bb4e401f6b1a773dfa44a166c5c02ff503f75171a764bb6f47e1940143584cfaead3a1235de1e27b4ee2ef667f1dbbeb4c77b3018558c01f8a535422f02c
|
7
|
+
data.tar.gz: 2aab1ecad2507045edb5a8d315c2c23eb86b8291460ac97cbad33e307a777641e6713d1293d01ee87b88d2b78db3a8cd0a41d9fcdcbd97333c811844471f90a5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
|
2
2
|
#### [Current]
|
3
|
+
* [632117c](../../commit/632117c) - __(Murat Kemal BAYGÜN)__ [#20](../../issues/20) Resolve unexpected autorun behaviour caused by initialize
|
4
|
+
|
5
|
+
#### 1.2.1
|
6
|
+
* [05b92d4](../../commit/05b92d4) - __(Murat Kemal BAYGÜN)__ Release 1.2.1
|
3
7
|
* [6391f34](../../commit/6391f34) - __(Murat Kemal BAYGÜN)__ [#21](../../issues/21) Add multiline commit support
|
4
8
|
|
5
9
|
Multiline commit note support added as referenced in common
|
data/Gemfile.lock
CHANGED
data/bin/katip
CHANGED
@@ -1,80 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
ISSUE_URL='../../issues/'
|
3
|
+
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
require 'katip'
|
6
|
+
require 'katip/change_logger'
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
initialized
|
8
|
+
if ARGV.size > 0
|
9
|
+
change_logger = Katip::ChangeLogger.new(ARGV.first)
|
10
|
+
else
|
11
|
+
change_logger = Katip::ChangeLogger.new()
|
14
12
|
end
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
file_name='CHANGELOG.md'
|
19
|
-
|
20
|
-
if ARGV.length > 0
|
21
|
-
file_name=ARGV[0]
|
22
|
-
end
|
23
|
-
|
24
|
-
begin
|
25
|
-
file = File.open(file_name, 'w')
|
26
|
-
file.puts output
|
27
|
-
|
28
|
-
puts "Create #{file_name}"
|
29
|
-
rescue IOError => e
|
30
|
-
#some error occur, dir not writable etc.
|
31
|
-
ensure
|
32
|
-
file.close unless file == nil
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def parse_change_log
|
37
|
-
|
38
|
-
output = []
|
39
|
-
|
40
|
-
tags=`git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags | grep -v '^$'`
|
41
|
-
|
42
|
-
tags = tags.split
|
43
|
-
|
44
|
-
tags.reverse!
|
45
|
-
|
46
|
-
output << "\n#### [Current]"
|
47
|
-
|
48
|
-
previous_tag=''
|
49
|
-
tags.each do |tag|
|
50
|
-
current_tag = tag
|
51
|
-
|
52
|
-
unless previous_tag.empty?
|
53
|
-
output << "\n#### #{previous_tag}"
|
54
|
-
end
|
55
|
-
|
56
|
-
output << `git log --pretty=format:" * [%h](#{COMMIT_URL}%h) - __(%an)__ %s%n%n%-b" "#{current_tag}".."#{previous_tag}" | grep -v "Merge branch "`
|
57
|
-
|
58
|
-
previous_tag = current_tag
|
59
|
-
end
|
60
|
-
|
61
|
-
output << "\n#### #{previous_tag}"
|
62
|
-
|
63
|
-
output << `git log --pretty=format:" * [%h](#{COMMIT_URL}%h) - __(%an)__ %s%n%n%-b" #{previous_tag} | grep -v "Merge branch "`
|
64
|
-
|
65
|
-
output.each do |line|
|
66
|
-
|
67
|
-
line.encode!('utf-8', invalid: :replace, undef: :replace, replace: '')
|
68
|
-
|
69
|
-
if line.index(/#[1-9][0-9]*/)
|
70
|
-
line.gsub!(/#[1-9][0-9]*/) {|s| "[#{s}](#{ISSUE_URL}#{s[-(s.length-1)..-1]})"}
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
output
|
75
|
-
end
|
76
|
-
|
77
|
-
if git_repository?
|
78
|
-
write_file parse_change_log
|
79
|
-
end
|
14
|
+
change_logger.log_changes
|
80
15
|
|
data/lib/katip.rb
CHANGED
@@ -1,20 +1,6 @@
|
|
1
1
|
require 'katip/version'
|
2
|
+
require 'katip/change_logger'
|
3
|
+
require 'katip/railtie'
|
2
4
|
|
3
5
|
module Katip
|
4
|
-
require 'katip/railtie' if defined?(Rails)
|
5
|
-
|
6
|
-
@@katip = `katip`
|
7
|
-
|
8
|
-
def self.set(param)
|
9
|
-
@@katip = param
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.get
|
13
|
-
@@katip
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.get_file(file_name)
|
17
|
-
@@katip = "katip #{file_name}"
|
18
|
-
end
|
19
|
-
|
20
6
|
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'katip'
|
3
|
+
require 'katip/change_logger'
|
4
|
+
module Katip
|
5
|
+
class ChangeLogger
|
6
|
+
COMMIT_URL='../../commit/'
|
7
|
+
ISSUE_URL='../../issues/'
|
8
|
+
|
9
|
+
# initialize
|
10
|
+
#
|
11
|
+
# @param [String] file_name with path
|
12
|
+
def initialize(file_name='CHANGELOG.md')
|
13
|
+
@file_name = file_name
|
14
|
+
end
|
15
|
+
|
16
|
+
def log_changes
|
17
|
+
if git_repository?
|
18
|
+
write_file parse_change_log
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def git_repository?
|
24
|
+
initialized = `git rev-parse --is-inside-work-tree`.chomp
|
25
|
+
|
26
|
+
if initialized != 'true'
|
27
|
+
initialized = false
|
28
|
+
puts 'Exiting. Nothing to create log file.'
|
29
|
+
end
|
30
|
+
initialized
|
31
|
+
end
|
32
|
+
|
33
|
+
def write_file(output)
|
34
|
+
|
35
|
+
begin
|
36
|
+
file = File.open(@file_name, 'w')
|
37
|
+
file.puts output
|
38
|
+
|
39
|
+
puts "Create #{@file_name}"
|
40
|
+
rescue IOError => e
|
41
|
+
#some error occur, dir not writable etc.
|
42
|
+
ensure
|
43
|
+
file.close unless file == nil
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse_change_log
|
48
|
+
|
49
|
+
output = []
|
50
|
+
|
51
|
+
tags=`git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags | grep -v '^$'`
|
52
|
+
|
53
|
+
tags = tags.split
|
54
|
+
|
55
|
+
tags.reverse!
|
56
|
+
|
57
|
+
output << "\n#### [Current]"
|
58
|
+
|
59
|
+
previous_tag=''
|
60
|
+
tags.each do |tag|
|
61
|
+
current_tag = tag
|
62
|
+
|
63
|
+
unless previous_tag.empty?
|
64
|
+
output << "\n#### #{previous_tag}"
|
65
|
+
end
|
66
|
+
|
67
|
+
output << `git log --pretty=format:" * [%h](#{COMMIT_URL}%h) - __(%an)__ %s%n%n%-b" "#{current_tag}".."#{previous_tag}" | grep -v "Merge branch "`
|
68
|
+
|
69
|
+
previous_tag = current_tag
|
70
|
+
end
|
71
|
+
|
72
|
+
output << "\n#### #{previous_tag}"
|
73
|
+
|
74
|
+
output << `git log --pretty=format:" * [%h](#{COMMIT_URL}%h) - __(%an)__ %s%n%n%-b" #{previous_tag} | grep -v "Merge branch "`
|
75
|
+
|
76
|
+
output.each do |line|
|
77
|
+
|
78
|
+
line.encode!('utf-8', invalid: :replace, undef: :replace, replace: '')
|
79
|
+
|
80
|
+
if line.index(/#[1-9][0-9]*/)
|
81
|
+
line.gsub!(/#[1-9][0-9]*/) {|s| "[#{s}](#{ISSUE_URL}#{s[-(s.length-1)..-1]})"}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
output
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/katip/railtie.rb
CHANGED
data/lib/katip/version.rb
CHANGED
data/lib/tasks/katip.rake
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
namespace :katip do
|
2
|
-
desc 'Create
|
2
|
+
desc 'Create change log'
|
3
3
|
task :create => [:environment] do
|
4
4
|
|
5
5
|
file_name = ENV['file'] || 'CHANGELOG.md'
|
6
6
|
|
7
|
-
|
7
|
+
change_logger = Katip::ChangeLogger.new(file_name)
|
8
8
|
|
9
|
+
change_logger.log_changes
|
9
10
|
end
|
10
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: katip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lab2023
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- bin/katip
|
57
57
|
- katip.gemspec
|
58
58
|
- lib/katip.rb
|
59
|
+
- lib/katip/change_logger.rb
|
59
60
|
- lib/katip/railtie.rb
|
60
61
|
- lib/katip/version.rb
|
61
62
|
- lib/tasks/katip.rake
|