giteaucrat 0.0.1 → 0.0.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmY4NGEwNmU2Zjg2NmZjZmExOGYwMjViNjFjNWE3YWE4YjI3NGI4ZQ==
4
+ YWQ5ZjA3Yzk3OGU1OTIwNWU3NmYyMjkyYzJmNGFjYzk0NTY4MGU1ZQ==
5
5
  data.tar.gz: !binary |-
6
- NDRlODhhZTQxNWU0OTI4ZWVlMzVmZGY0MjkzNmZhY2U1ZWZmMzZhMQ==
6
+ NDlhZWYxZDU2ZjIxMmY3MWIzZTA2NDk2ZjVmMWFmNDY1Y2M1NTFkYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjRlNWVjNjI4ZDlhZGE3MDEzZWZjMWM4NzY3YzA2OGJhODhiNzdhZmViYzE5
10
- ODhlMjc3ZTUxY2JkM2RiZDc4OTViN2IzYTllMDQwNTM0YzNiNmMzYmMxYjkw
11
- NmE0YTRjNjE4YmU0MzY1NzIyNGFjNmY3YjBjMzIxMmZiYzRlMTg=
9
+ MDJkMjJmZDIwNzIyODE4ZTYxNWQ3YzQ3MGYxMDE3NmMxNzJmMzlkNjFjMjk4
10
+ MzVlNjRkNjY1ZDdkNGExOWRlMWQ0YWIxYWEwZjk2ZGIxYzZlMjljY2U4NDU1
11
+ ZDYwY2E2MGZkNWI4M2MzZGM0Mjc3ODE1NzdlMTZmYjc0MmNkM2I=
12
12
  data.tar.gz: !binary |-
13
- NTZhYWE2MDgzYmZkZGUyNTQ2MTFkNjdlMGRmMjI0YmY2MzI4MGRhZmNjNThj
14
- NTZiOTg5MjYzZGE0NWJhZDY5ZDI4YTkyYjExMGE0OTdkNmZjMzI2NWNlZmM3
15
- MTM4OTY0MDcyNDAxODgxMTQzOGY5MWRiNjJjNzM0ZDhhZmMxMDY=
13
+ NDAxMGFiNGY1NzdlNzZiMjAyZDMyNWY2MzFlMmY0NjZhYWUxZjUxZWVkYzI4
14
+ YWMzNzlhYTZkNjE5YmM3MmU4Y2E4OWRmZTEwOTYyZmFkYjE3YTJiNzkxMDU2
15
+ ZTRmYmYxMDRkZGY4OTM5MDM5NWFiMTc4ZGRmOWNmYWY3MGRkZGU=
@@ -41,10 +41,12 @@ module Giteaucrat
41
41
  last = Regexp.escape(last)
42
42
  contents = ::File.read(name)
43
43
  ruler = "(#{first}(#{middle})*#{last}\n)"
44
- coding = "(#{first}\s*.*coding:\s*utf-8\s*\n+)?"
44
+ coding = "\\A(#{first}\s*.*coding:\s*utf-8\s*\n+)?"
45
45
  header = /#{coding}#{ruler}(#{first}.*#{last}\n)*\2\n*/m
46
46
  if repo.include_encoding?
47
- contents.sub!(header, "#{copyright}\n\n")
47
+ contents.sub!(header, '')
48
+ contents.sub!(/#{coding}/, '')
49
+ contents = "#{copyright}\n\n#{contents}"
48
50
  else
49
51
  contents.sub!(/(#{coding})/, "\1#{copyright}\n\n")
50
52
  end
@@ -57,7 +57,7 @@ module Giteaucrat
57
57
 
58
58
  def copyrights
59
59
  repo.write_copyrights!
60
- repo.commit("#{defaults[:commit_keyword]}: Update copyrights in source code") if options[:commit]
60
+ repo.commit!("#{defaults[:commit_keyword]}: Update copyrights in source code") if options[:commit]
61
61
  FileUtils.mkdir_p(::File.join(path, 'tmp'))
62
62
  ::File.write(::File.join(path, 'tmp', 'giteaucrat_authors.yml'), Author.to_yaml)
63
63
  end
@@ -79,7 +79,7 @@ module Giteaucrat
79
79
  end
80
80
 
81
81
  config = options.inject({}) do |config, (key, value)|
82
- config[key] = value unless %w(config git path timeout).include?(key); config
82
+ config[key] = value unless %w(config git path timeout commit).include?(key); config
83
83
  end.to_yaml
84
84
 
85
85
  unless ::File.file?(options[:config])
@@ -6,5 +6,5 @@
6
6
  ################################################
7
7
 
8
8
  module Giteaucrat
9
- VERSION = '0.0.1'
9
+ VERSION = '0.0.2'
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giteaucrat
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
  - Alexander Semyonov