puppetfile-updater 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c4ccff3597955b212abd9580f4525c388c1bf69785bc2f9898f9add676dd75d
4
- data.tar.gz: 9e6590f5e580377b98a70bf7d83436b26cbce26a566215c5d1d09cc3baef12a1
3
+ metadata.gz: 60e02e6b035bd9810d8292e50b3c4213ec687fdf0d6a7c9848bcec3141de7329
4
+ data.tar.gz: aa8c8182320447b00dabad5a20e35b96f53432690379de0a91012dfdf6fa9340
5
5
  SHA512:
6
- metadata.gz: 495bb23e0edc3c3589784efd1e6013ef3a7e8c7edeebc838e2e10a32fd8a99b99c4730a93646fe1f272fd6d3b4d53233b9642b4198dff4e9e3c9982067fad056
7
- data.tar.gz: c9e89efe6b61d65f67d9c9d1f5cf6089a6b05ab91eb32ee267144cb8aadbef93dd6895e7494b9dbf69d5dae97a802eba8eb78b8e3c74f88f2e78ee354961b6ad
6
+ metadata.gz: 0c2f1b4504a1c3aaa5b49df475014539f631fc2444314120819b76ca80c967149c760ed0b57b108a92a3359e0d4c846fadf05862f86480d20be1162ea46849d0
7
+ data.tar.gz: 3a1b9add9a9d2bd8f072cafcb56d62ba4e34e22a9624b1555adf9ab511a84c5abd1b48fca37aa22919ad382ac29f095982991764bb1dd69dcd2dd2908c0230b9
@@ -25,31 +25,44 @@ 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
28
32
 
29
33
  (* View: moduledir
30
34
  The moduledir setting specifies where modules from the Puppetfile will be installed *)
31
- let moduledir = [ Util.indent . key "moduledir" . Sep.space . Quote.any . Util.eol ]
35
+ let moduledir = [ Util.indent . key "moduledir" . Sep.space
36
+ . quote_to_comment_or_eol ]
32
37
 
33
38
  (* View: forge
34
39
  a forge entry *)
35
- 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 ]
36
42
 
37
43
  (* View: metadata
38
44
  a metadata entry *)
39
- let metadata = [ Util.indent . key "metadata" . Util.eol ]
45
+ let metadata = [ Util.indent . key "metadata" . comment_or_eol ]
40
46
 
41
47
  (* View: mod
42
48
  a module entry, with optional version and options *)
43
49
  let mod =
44
50
  let mod_name = Quote.do_quote (store ((Rx.word . /[\/-]/)? . Rx.word))
45
- in let version = [ label "@version" . Quote.do_quote (store /[^:\n]+/) ]
46
- in let opt = [ Util.del_str ":" . key Rx.word . del /[ \t]*=>[ \t]*/ " => "
47
- . Quote.do_quote (store /[^,\n]*/) ]
48
- 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
49
62
  in [ Util.indent . Util.del_str "mod" . seq "mod" . Sep.space . mod_name
50
- . (comma . version)?
51
- . (comma . opts)?
52
- . Util.eol ]
63
+ . (comma_opt_eol_comment . version)?
64
+ . (comma_opt_eol_comment . opts . Util.comment_eol?)?
65
+ . Util.eol ]
53
66
 
54
67
  (* View: lns
55
68
  the Puppetfile lens *)
@@ -14,6 +14,7 @@ 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
19
20
  attr_accessor :debug
@@ -69,21 +70,23 @@ class PuppetfileUpdater
69
70
  abort msg
70
71
  end
71
72
 
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)
73
+ unless @skip_git
74
+ # Update from GitHub
75
+ aug.match("/files/Puppetfile/*[git=~regexp('.*/#{@user}[/-].*')]").each do |mpath|
76
+ m = aug.get(mpath)
77
+ puts "D: Considering #{m} for git update" if @debug
78
+ next if !@module.nil? && @module != m.gsub(%r{.*[-/]}, '')
79
+ puts "D: #{m} selected by filters" if @debug
80
+
81
+ warn "W: #{m} is a fork!" unless m =~ /#{@user}/
82
+
83
+ git_url = aug.get("#{mpath}/git")
84
+ repo = Octokit::Repository.from_url(git_url.gsub(/\.git$/, ''))
85
+ commits = github.commits(repo)
86
+ ref = commits[0].sha[0...7]
87
+ puts "D: New ref for #{m} is #{ref}" if @debug
88
+ aug.set("#{mpath}/ref", ref)
89
+ end
87
90
  end
88
91
 
89
92
  # Update from Forge
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetfile-updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camptocamp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-15 00:00:00.000000000 Z
11
+ date: 2019-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -66,8 +66,8 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: |2
70
- Keep your Puppet file up-to-date with latest versions from the Forge and GitHub.
69
+ description: " Keep your Puppet file up-to-date with latest versions from the Forge
70
+ and GitHub.\n"
71
71
  email: raphael.pinson@camptocamp.com
72
72
  executables: []
73
73
  extensions: []
@@ -96,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubyforge_project:
100
- rubygems_version: 2.7.7
99
+ rubygems_version: 3.0.3
101
100
  signing_key:
102
101
  specification_version: 4
103
102
  summary: Keep your Puppetfile up-to-date.