puppetfile-updater 0.3.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTIzM2VlM2ZlYmNlZDE0MWQ0ZjM4YWQ2NTlmZDYyNDA2YTU0ZjhkNQ==
5
- data.tar.gz: !binary |-
6
- ZGQwZTA3ZmU4YjVlMmJhZjk2NjQ3ZmNjNGQxMDEyMjFmYWQ2NjFiNQ==
2
+ SHA256:
3
+ metadata.gz: 67afad5138980f13a131de2838390bce5e7a282288c38dea365e4051ab525350
4
+ data.tar.gz: 85a0eade9472640b6f027f5b665f8013399bf6e1bd904ba22f8372433d6e53f7
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MGFmMGIyMTY3Njk2MjRjNTA3ZWZhNTViYzc3YTg5ZDJiOGVhMDRjMWQyNWYx
10
- N2Q2YjdkZGRmMTAwZjQwYjY2ZDU0YWU3NjUwOTRhMDNlYjZhNDRkMjQyMDBj
11
- ZGYwZjllZDBkNWJlMjRlY2ViZmZiMmI0NjY2YjcxNmU0ZjJhM2U=
12
- data.tar.gz: !binary |-
13
- NGJjYjY1YWUzN2QwMTYzMDVkYTgyYzBjNWE5ZTM1Mjc5ZGVkM2FlZjM3ZTE4
14
- Y2E1NjRmNmFlOGQ5ZjI2NjI2Njk0ZDMxNTM4NjMzMzY3NTE1Zjg1NWJjNGIz
15
- NDkxNjhjZTRlNjFkODYyYjhkZTQ3MTUwN2E4ODdiMzI4YmFmYTM=
6
+ metadata.gz: c004f77860c1d0c7bc3f24468ec5cf60a368302b81fef164d56c37440b504c4ef40992b68e654fd554f34ee7501599a8365ab2f93ef60f4457f50698261fae7f
7
+ data.tar.gz: e36fa66babe89ed420b98fd72522d4385b59de76be8b55551b8220bbdf1c355df671782ad73f4602403a2bbfb7e41c76c26c11e30cf5d944d0612d4814b8d68a
@@ -25,28 +25,45 @@ module Puppetfile =
25
25
  (* View: comma
26
26
  a comma, optionally preceded or followed by spaces or newlines *)
27
27
  let comma = del /[ \t\n]*,[ \t\n]*/ ", "
28
+ let comma_nospace = del /[ \t\n]*,/ ","
29
+
30
+ let comment_or_eol = Util.eol | Util.comment_eol
31
+ let quote_to_comment_or_eol = Quote.do_quote (store /[^#\n]*/) . comment_or_eol
32
+
33
+ (* View: moduledir
34
+ The moduledir setting specifies where modules from the Puppetfile will be installed *)
35
+ let moduledir = [ Util.indent . key "moduledir" . Sep.space
36
+ . quote_to_comment_or_eol ]
28
37
 
29
38
  (* View: forge
30
39
  a forge entry *)
31
- let forge = [ Util.indent . key "forge" . Sep.space . Quote.any . Util.eol ]
40
+ let forge = [ Util.indent . key "forge" . Sep.space
41
+ . quote_to_comment_or_eol ]
32
42
 
33
43
  (* View: metadata
34
44
  a metadata entry *)
35
- let metadata = [ Util.indent . key "metadata" . Util.eol ]
45
+ let metadata = [ Util.indent . key "metadata" . comment_or_eol ]
36
46
 
37
47
  (* View: mod
38
48
  a module entry, with optional version and options *)
39
49
  let mod =
40
50
  let mod_name = Quote.do_quote (store ((Rx.word . /[\/-]/)? . Rx.word))
41
- in let version = [ label "@version" . Quote.do_quote (store /[^:\n]+/) ]
42
- in let opt = [ Util.del_str ":" . key Rx.word . del /[ \t]*=>[ \t]*/ " => "
43
- . Quote.do_quote (store /[^,\n]*/) ]
44
- in let opts = Build.opt_list opt comma
51
+ in let version = [ label "@version" . Quote.do_quote (store /[^#:\n]+/) . Util.comment_eol? ]
52
+ in let sto_opt_val = store /[^#"', \t\n][^#"',\n]*[^#"', \t\n]|[^#"', \t\n]/
53
+ in let opt = [
54
+ Util.del_str ":" . key Rx.word
55
+ . (del /[ \t]*=>[ \t]*/ " => " . Quote.do_quote_opt sto_opt_val)?
56
+ ]
57
+ in let opt_eol = del /([ \t\n]*\n)?/ ""
58
+ in let opt_space_or_eol = del /[ \t\n]*/ " "
59
+ in let comma_opt_eol_comment = comma_nospace . (opt_eol . Util.comment_eol)*
60
+ . opt_space_or_eol
61
+ in let opts = Build.opt_list opt comma_opt_eol_comment
45
62
  in [ Util.indent . Util.del_str "mod" . seq "mod" . Sep.space . mod_name
46
- . (comma . version)?
47
- . (comma . opts)?
48
- . Util.eol ]
63
+ . (comma_opt_eol_comment . version)?
64
+ . (comma_opt_eol_comment . opts . Util.comment_eol?)?
65
+ . Util.eol ]
49
66
 
50
67
  (* View: lns
51
68
  the Puppetfile lens *)
52
- let lns = (Util.empty | Util.comment | forge | metadata | mod)*
69
+ let lns = (Util.empty | Util.comment | forge | metadata | mod | moduledir )*
@@ -14,8 +14,10 @@ class PuppetfileUpdater
14
14
  attr_accessor :user
15
15
  attr_accessor :module
16
16
  attr_accessor :major
17
+ attr_accessor :skip_git
17
18
  attr_accessor :gh_login
18
19
  attr_accessor :gh_password
20
+ attr_accessor :gh_token
19
21
  attr_accessor :debug
20
22
 
21
23
  # Public: Initialise a new PuppetfileUpdater::RakeTask.
@@ -44,10 +46,21 @@ class PuppetfileUpdater
44
46
 
45
47
  @user ||= '.*'
46
48
 
47
- gh_opts = @gh_login.nil? ? { } : {
48
- :login => @gh_login,
49
- :password => @gh_password,
50
- }
49
+ gh_opts = {}
50
+
51
+ unless @gh_user.nil?
52
+ gh_opts = {
53
+ :login => @gh_login,
54
+ :password => @gh_password,
55
+ }
56
+ end
57
+
58
+ unless @gh_token.nil?
59
+ gh_opts = {
60
+ :access_token => @gh_token,
61
+ }
62
+ end
63
+
51
64
  github = Octokit::Client.new gh_opts
52
65
 
53
66
  libdir = File.dirname(__FILE__)
@@ -62,33 +75,35 @@ class PuppetfileUpdater
62
75
  aug.load!
63
76
 
64
77
  error_path = '/augeas/files/Puppetfile/error'
65
- unless aug.match('/augeas/files/Puppetfile/error').size == 0
78
+ unless aug.match(error_path).size == 0
66
79
  msg = "Failed to parse Puppetfile at line #{aug.get(error_path+'/line')}, "
67
80
  msg << "character #{aug.get(error_path+'/char')}: "
68
- msg << aug.get('/augeas/files/Puppetfile/error/message')
81
+ msg << aug.get(error_path+'/message')
69
82
  abort msg
70
83
  end
71
84
 
72
- # Update from GitHub
73
- aug.match("/files/Puppetfile/*[git=~regexp('.*/#{@user}/.*')]").each do |mpath|
74
- m = aug.get(mpath)
75
- puts "D: Considering #{m} for git update" if @debug
76
- next if !@module.nil? && @module != m.gsub(%r{.*[-/]}, '')
77
- puts "D: #{m} selected by filters" if @debug
78
-
79
- warn "W: #{m} is a fork!" unless m =~ /#{@user}/
80
-
81
- git_url = aug.get("#{mpath}/git")
82
- repo = Octokit::Repository.from_url(git_url.gsub(/\.git$/, ''))
83
- commits = github.commits(repo)
84
- ref = commits[0].sha[0...7]
85
- puts "D: New ref for #{m} is #{ref}" if @debug
86
- aug.set("#{mpath}/ref", ref)
85
+ unless @skip_git
86
+ # Update from GitHub
87
+ aug.match("/files/Puppetfile/*[git=~regexp('.*/#{@user}[/-].*')]").each do |mpath|
88
+ m = aug.get(mpath)
89
+ puts "D: Considering #{m} for git update" if @debug
90
+ next if !@module.nil? && @module != m.gsub(%r{.*[-/]}, '')
91
+ puts "D: #{m} selected by filters" if @debug
92
+
93
+ warn "W: #{m} is a fork!" unless m =~ /#{@user}/
94
+
95
+ git_url = aug.get("#{mpath}/git")
96
+ repo = Octokit::Repository.from_url(git_url.gsub(/\.git$/, ''))
97
+ commits = github.commits(repo)
98
+ ref = commits[0].sha[0...7]
99
+ puts "D: New ref for #{m} is #{ref}" if @debug
100
+ aug.set("#{mpath}/ref", ref)
101
+ end
87
102
  end
88
103
 
89
104
  # Update from Forge
90
105
  PuppetForge.user_agent = 'Puppetfile-Updater/0.1.0'
91
- aug.match("/files/Puppetfile/*[label()!='#comment' and .=~regexp('#{@user}/.*') and @version]").each do |mpath|
106
+ aug.match("/files/Puppetfile/*[label()!='#comment' and .=~regexp('#{@user}[/-].*') and @version]").each do |mpath|
92
107
  m = aug.get(mpath).gsub('/', '-')
93
108
  puts "D: Considering #{m} for forge update" if @debug
94
109
  next if !@module.nil? && @module != m.gsub(%r{.*[-/]}, '')
@@ -98,6 +113,8 @@ class PuppetfileUpdater
98
113
  release = forge_m.releases.select { |r| r.deleted_at.nil? }[0]
99
114
  new_v = release.version
100
115
  puts "D: New version for #{m} is #{new_v}" if @debug
116
+
117
+ warn "W: #{m} looks abandoned (version = #{new_v})" if new_v =~ /^99/
101
118
  if new_v.split('.')[0] != v.split('.')[0]
102
119
  if @major
103
120
  warn "W: #{m} has incompatible changes between #{v} and #{new_v}"
metadata CHANGED
@@ -1,75 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetfile-updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camptocamp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-augeas
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: octokit
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: puppet_forge
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: ! ' Keep your Puppet file up-to-date with latest versions from the
70
- Forge and GitHub.
71
-
72
- '
69
+ description: " Keep your Puppet file up-to-date with latest versions from the Forge
70
+ and GitHub.\n"
73
71
  email: raphael.pinson@camptocamp.com
74
72
  executables: []
75
73
  extensions: []
@@ -89,17 +87,17 @@ require_paths:
89
87
  - lib
90
88
  required_ruby_version: !ruby/object:Gem::Requirement
91
89
  requirements:
92
- - - ! '>='
90
+ - - ">="
93
91
  - !ruby/object:Gem::Version
94
92
  version: '0'
95
93
  required_rubygems_version: !ruby/object:Gem::Requirement
96
94
  requirements:
97
- - - ! '>='
95
+ - - ">="
98
96
  - !ruby/object:Gem::Version
99
97
  version: '0'
100
98
  requirements: []
101
99
  rubyforge_project:
102
- rubygems_version: 2.4.5
100
+ rubygems_version: 2.7.7
103
101
  signing_key:
104
102
  specification_version: 4
105
103
  summary: Keep your Puppetfile up-to-date.