changi 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/lib/changi/configuration.rb +1 -1
- data/lib/changi/entry.rb +11 -5
- data/lib/changi/entry_set.rb +7 -9
- data/lib/changi/flexible_attributes.rb +1 -1
- data/lib/changi/reader/category_reader.rb +2 -2
- data/lib/changi/reader/multiline_reader.rb +4 -4
- data/lib/changi/reader/string_reader.rb +1 -1
- data/lib/changi/release.rb +1 -1
- data/lib/changi/renderer.rb +1 -1
- data/lib/changi/updater/prepend_updater.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cca32b966703139ad94bf778717d6710bfb80aac
|
4
|
+
data.tar.gz: 607d733dce85ede99d73368ba03e9ecb4284d26d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6a866ca18edb40ed3f9911a8f02ea13cb732f213e6b37718048733bd5bf072a8585584e383a25b065dee8d169261a6fa6f6a37e4a838c91251f083438424de9
|
7
|
+
data.tar.gz: 653b5e814348386f29cf17725a88da47c6efe35f60777cf0054b79a97798dde907de05b2483f6ed6a86cb12de86baffe922c0b6be77a67c7e9673889a50a837e
|
data/lib/changi/configuration.rb
CHANGED
@@ -14,7 +14,7 @@ module Changi
|
|
14
14
|
config.updater = Updater::PrependUpdater
|
15
15
|
config.changelog_template = <<-eod
|
16
16
|
# <%= release.version %>, <%= Time.now.strftime('%Y-%m-%d') %><%= release.notes and ", \#{release.notes}" %>
|
17
|
-
<% entry_set.
|
17
|
+
<% entry_set.entries.group_by(&:category).each do |category, entries| %>
|
18
18
|
## <%= category %>
|
19
19
|
|
20
20
|
<%=
|
data/lib/changi/entry.rb
CHANGED
@@ -6,11 +6,11 @@ module Changi
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def build entry_set, yaml_path
|
9
|
-
new(entry_set, yaml_path).tap
|
9
|
+
new(entry_set, yaml_path).tap(&:read_in_attributes)
|
10
10
|
end
|
11
11
|
|
12
12
|
def load entry_set, yaml_path
|
13
|
-
new(entry_set, yaml_path).tap
|
13
|
+
new(entry_set, yaml_path).tap(&:read_in_yaml)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -34,9 +34,7 @@ module Changi
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def destroy
|
37
|
-
|
38
|
-
FileUtils.rm_f @path
|
39
|
-
end
|
37
|
+
git_rm || file_rm
|
40
38
|
end
|
41
39
|
|
42
40
|
private
|
@@ -44,5 +42,13 @@ module Changi
|
|
44
42
|
def to_yaml
|
45
43
|
self.class.attribute_names.map { |name| [name, send(name.to_sym)] }.to_h.to_yaml
|
46
44
|
end
|
45
|
+
|
46
|
+
def git_rm
|
47
|
+
system "git rm '#{@path}' >/dev/null 2>&1"
|
48
|
+
end
|
49
|
+
|
50
|
+
def file_rm
|
51
|
+
FileUtils.rm_f @path
|
52
|
+
end
|
47
53
|
end
|
48
54
|
end
|
data/lib/changi/entry_set.rb
CHANGED
@@ -17,16 +17,12 @@ module Changi
|
|
17
17
|
@entries ||= yamls.map { |yml| Entry.load self, yml }
|
18
18
|
end
|
19
19
|
|
20
|
-
def entries_by_category
|
21
|
-
entries.group_by &:category
|
22
|
-
end
|
23
|
-
|
24
20
|
def previous_categories
|
25
|
-
entries.map
|
21
|
+
entries.map(&:category)
|
26
22
|
end
|
27
23
|
|
28
24
|
def destroy_all
|
29
|
-
entries.each
|
25
|
+
entries.each(&:destroy)
|
30
26
|
end
|
31
27
|
|
32
28
|
private
|
@@ -40,10 +36,12 @@ module Changi
|
|
40
36
|
end
|
41
37
|
|
42
38
|
def make_entry_name
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
git_branch = `git rev-parse --abbrev-ref HEAD 2>/dev/null`.strip
|
40
|
+
|
41
|
+
if git_branch.empty?
|
46
42
|
"#{Time.now.strftime('%y%m%d%H%M%S')}.yml"
|
43
|
+
else
|
44
|
+
"#{Time.now.strftime('%y%m%d%H%M%S')}_from_#{git_branch}.yml"
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
@@ -2,11 +2,11 @@ module Changi
|
|
2
2
|
module Reader
|
3
3
|
class CategoryReader < StringReader
|
4
4
|
def read attribute, owner
|
5
|
-
|
5
|
+
raise 'CategoryReader can only be used for Entry attributes.' unless owner.is_a? Entry
|
6
6
|
|
7
7
|
cli.say "#{attribute[:name].capitalize}:\n"
|
8
8
|
cli.choose do |menu|
|
9
|
-
menu.choices
|
9
|
+
menu.choices(*categories(owner.entry_set))
|
10
10
|
menu.choice 'Other (create new)' do
|
11
11
|
cli.ask "Please insert #{attribute[:name]}:"
|
12
12
|
end
|
@@ -3,7 +3,7 @@ require 'tempfile'
|
|
3
3
|
module Changi
|
4
4
|
module Reader
|
5
5
|
class MultilineReader
|
6
|
-
def read attribute,
|
6
|
+
def read attribute, _
|
7
7
|
tmpfile = Tempfile.new 'changi'
|
8
8
|
|
9
9
|
intro tmpfile, attribute
|
@@ -28,8 +28,8 @@ module Changi
|
|
28
28
|
tmpfile.puts
|
29
29
|
tmpfile.puts
|
30
30
|
tmpfile.puts "# Please enter #{attribute[:name]} above."
|
31
|
-
tmpfile.puts
|
32
|
-
tmpfile.puts
|
31
|
+
tmpfile.puts '# Lines starting with # will be ignored.'
|
32
|
+
tmpfile.puts '# Empty tmpfile will abort the process.' if attribute[:opts][:required]
|
33
33
|
tmpfile.sync
|
34
34
|
tmpfile.close
|
35
35
|
end
|
@@ -42,7 +42,7 @@ module Changi
|
|
42
42
|
|
43
43
|
def editor
|
44
44
|
editor_tests.lazy.map(&:call).find { |e| !(e.nil? || e.empty?) }.tap do |e|
|
45
|
-
|
45
|
+
raise 'could not detect editor' unless e
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -3,7 +3,7 @@ require 'highline'
|
|
3
3
|
module Changi
|
4
4
|
module Reader
|
5
5
|
class StringReader
|
6
|
-
def read attribute,
|
6
|
+
def read attribute, _
|
7
7
|
cli.ask("#{attribute[:name]}: ").tap do |x|
|
8
8
|
if attribute[:opts][:required] && [nil, ''].include?(x)
|
9
9
|
abort "required #{attribute[:name]} attribute empty, abort"
|
data/lib/changi/release.rb
CHANGED
data/lib/changi/renderer.rb
CHANGED
@@ -2,7 +2,7 @@ module Changi
|
|
2
2
|
module Updater
|
3
3
|
class PrependUpdater
|
4
4
|
def update changelog_path, release_data
|
5
|
-
previous = File.read changelog_path if File.
|
5
|
+
previous = File.read changelog_path if File.exist? changelog_path
|
6
6
|
|
7
7
|
File.open changelog_path, 'w' do |fd|
|
8
8
|
fd.puts release_data
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: changi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mobisol GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -58,7 +58,7 @@ files:
|
|
58
58
|
- lib/changi/renderer.rb
|
59
59
|
- lib/changi/tasks.rb
|
60
60
|
- lib/changi/updater/prepend_updater.rb
|
61
|
-
homepage: https://github.
|
61
|
+
homepage: https://github.com/plugintheworld/changi
|
62
62
|
licenses:
|
63
63
|
- MIT
|
64
64
|
metadata: {}
|