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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGE2OWI4NjlkOTk2YTgyMmIyZTU4NDI4YWQwY2M0YTdlMzQzN2Y4OA==
4
+ YWQwMjkyNjBmNGE1Zjg4MzU0MjVlNGQxNDAwY2Y0NWE5NWVmYmNlZg==
5
5
  data.tar.gz: !binary |-
6
- NDQ4ZTY1NGE2OTNkNDMwZDg3YTI3ZDQyZGQxMGJiYzczZjVmZGEzNA==
6
+ ODJkNDFhM2M1ZTdkYjgwMjY3ODk5N2Q1OTIwMjExOGI3N2NmNjRiZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDBhYTk5OGM5OWE1MDc5NjkwM2E3NDdjZTBlMjYzNDI4YTNiMDViODFmZjA5
10
- NmZkYjVlOTViYWMyZDk5M2Y4YjBjMTQ0ZTZmZGE2ODI0YjhlMjg5ZGE2NWEz
11
- NzkxMjllZWQ3Njc3YTc1NzQ3MzI1ZjIzYTUzMDFlMjk0MmJiODM=
9
+ YjJkN2VmZjViMTdmNGExZTg4ZGQ0ZmRhNDQzMDE1Mzk2Zjg4ODhlNmNkZTM4
10
+ ZWE2OThmNTdiMzY2NjI0N2E4ZTIyMDIzYmE5YzliZDdlOGVhYWIyMTU5NjM4
11
+ Y2VhZmI1MzdhNGIzMGE0MzY5MmI2Yzc1NDhkMDEzYjQwNTJkMGI=
12
12
  data.tar.gz: !binary |-
13
- MTU1MjMxYzFlMjFiODdkN2ZjZWQ4ZTU5Y2Q1Y2Y4YmRjMzE1MDk2NjAyMzhh
14
- YTdiN2M1YmNmNjEwMTcxNTg0MjllMDY2MjhhZjQ0ZTM0MzZiODRhZTdkNzJk
15
- YWQ1YzZkODk3OThlMWQ4MWExNmVkODAwZGYwZjg5NzIxYWQ1MzY=
13
+ ZWY1MjYzYmVhNjRhYjA0Yjc3YWZkNDdjMTdiMjM4NDk5MDZjY2EyOWQ5ZGZh
14
+ YzRkMThhYWZkMjdiNDMyYjY4ZTQxNzU4YWFiZjU4NTcxNmNhZjQxYjUzNGU3
15
+ NDQyNDUzNzBjNzEwNjc5ZTkxYzYxNmZlMzkyNTgzMjRiMWQ1MmQ=
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ *.swp
1
2
  *.gem
2
3
  *.rbc
3
4
  /.config
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rpmchange (0.0.1)
4
+ rpmchange (0.0.2)
5
5
  diffy (>= 3.1.0, < 4.0)
6
6
  thor (>= 0.19.1, < 1.0)
7
7
 
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 "append_changelog", "Make a new changelog entry at the end of current entries"
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", required: true}
26
- method_option :email, {type: :string, desc: "maintainer email", required: true}
27
- method_option :message, {type: :string, desc: "changelog message", required: true}
28
- def append_changelog
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
- spec.append_changelog(name: options['name'],
31
- email: options['email'],
32
- message: options['message'])
33
- self.class.spec_write! spec
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
- puts value if value
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
@@ -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
- "- #{message}",
106
+ message_lines.join("\n"),
101
107
  "",
102
108
  ].reverse_each {|line| _prepend_line(lines: changelog_lines, new_line: line)}
103
109
  end
@@ -1,3 +1,3 @@
1
1
  module Rpmchange
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end # Rpmchange
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpmchange
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - flant