rpmchange 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 +8 -8
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/rpmchange/cli.rb +22 -13
- data/lib/rpmchange/spec.rb +7 -1
- data/lib/rpmchange/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWQwMjkyNjBmNGE1Zjg4MzU0MjVlNGQxNDAwY2Y0NWE5NWVmYmNlZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODJkNDFhM2M1ZTdkYjgwMjY3ODk5N2Q1OTIwMjExOGI3N2NmNjRiZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjJkN2VmZjViMTdmNGExZTg4ZGQ0ZmRhNDQzMDE1Mzk2Zjg4ODhlNmNkZTM4
|
10
|
+
ZWE2OThmNTdiMzY2NjI0N2E4ZTIyMDIzYmE5YzliZDdlOGVhYWIyMTU5NjM4
|
11
|
+
Y2VhZmI1MzdhNGIzMGE0MzY5MmI2Yzc1NDhkMDEzYjQwNTJkMGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWY1MjYzYmVhNjRhYjA0Yjc3YWZkNDdjMTdiMjM4NDk5MDZjY2EyOWQ5ZGZh
|
14
|
+
YzRkMThhYWZkMjdiNDMyYjY4ZTQxNzU4YWFiZjU4NTcxNmNhZjQxYjUzNGU3
|
15
|
+
NDQyNDUzNzBjNzEwNjc5ZTkxYzYxNmZlMzkyNTgzMjRiMWQ1MmQ=
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/rpmchange/cli.rb
CHANGED
@@ -11,7 +11,7 @@ module Rpmchange
|
|
11
11
|
Spec.loadfile(options['specfile'])
|
12
12
|
end
|
13
13
|
|
14
|
-
def spec_write!(spec)
|
14
|
+
def spec_write!(spec, options)
|
15
15
|
File.open(options['specfile'], 'w') {|f| f.write spec.dump}
|
16
16
|
end
|
17
17
|
end # << self
|
@@ -20,17 +20,23 @@ module Rpmchange
|
|
20
20
|
specfile: {type: :string, desc: "path to spec file", required: true},
|
21
21
|
}
|
22
22
|
|
23
|
-
desc "
|
23
|
+
desc "changelog", "get changelog entries or " +
|
24
|
+
"make a new changelog entry at the end of current entries"
|
24
25
|
shared_options
|
25
|
-
method_option :name, {type: :string, desc: "maintainer name"
|
26
|
-
method_option :email, {type: :string, desc: "maintainer email"
|
27
|
-
method_option :message, {type: :string, desc: "changelog message"
|
28
|
-
|
26
|
+
method_option :name, {type: :string, desc: "maintainer name"}
|
27
|
+
method_option :email, {type: :string, desc: "maintainer email"}
|
28
|
+
method_option :message, {type: :string, desc: "changelog message"}
|
29
|
+
method_option :append, {type: :boolean, desc: "append new changelog entry"}
|
30
|
+
def changelog
|
29
31
|
spec = self.class.spec_construct options
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
if options['append']
|
33
|
+
spec.append_changelog(name: options['name'],
|
34
|
+
email: options['email'],
|
35
|
+
message: options['message'])
|
36
|
+
self.class.spec_write! spec, options
|
37
|
+
else
|
38
|
+
puts spec.changelog_lines
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
42
|
desc "tag", "Get or set spec tag"
|
@@ -41,10 +47,13 @@ module Rpmchange
|
|
41
47
|
spec = self.class.spec_construct options
|
42
48
|
if options['value']
|
43
49
|
spec.set_tag(options['name'], options['value'])
|
44
|
-
self.class.spec_write! spec
|
50
|
+
self.class.spec_write! spec, options
|
45
51
|
else
|
46
|
-
value = spec.tag(options['name'])
|
47
|
-
|
52
|
+
if value = spec.tag(options['name'])
|
53
|
+
puts value
|
54
|
+
else
|
55
|
+
exit(1)
|
56
|
+
end
|
48
57
|
end
|
49
58
|
end
|
50
59
|
end # Cli
|
data/lib/rpmchange/spec.rb
CHANGED
@@ -96,8 +96,14 @@ module Rpmchange
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def append_changelog(name:, email:, message:)
|
99
|
+
message_lines = message.to_s.split("\n")
|
100
|
+
message_lines[0] = "- #{message_lines[0]}"
|
101
|
+
1.upto(message_lines.size - 1).each do |i|
|
102
|
+
message_lines[i] = " #{message_lines[i]}"
|
103
|
+
end
|
104
|
+
|
99
105
|
["* #{Time.now.strftime("%a %b %e %Y")} #{name} <#{email}> - #{full_version}",
|
100
|
-
"
|
106
|
+
message_lines.join("\n"),
|
101
107
|
"",
|
102
108
|
].reverse_each {|line| _prepend_line(lines: changelog_lines, new_line: line)}
|
103
109
|
end
|
data/lib/rpmchange/version.rb
CHANGED