puppetfile-updater 0.2.1 → 0.3.0

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
- YzY4Y2ZlOTU5M2RjMDQ0NjYxYjAxNjU3NWY1MmFjZjJiYmNmZThiMA==
4
+ MzYyZDZiNzAxNzA4Njg4MjEwYjFjODViMDMzZDNkNjcxNGJjMTA4NA==
5
5
  data.tar.gz: !binary |-
6
- MWVkZDQ0ZmExYTc2NWQ4OTg3MTgwZjAxMmU2NWNhYTU5MTQ2MDFhZg==
6
+ MTk2NTgxNGZlMjcyZDg2Y2I3NjlmMmJjOGJlMGY3YjJjMTYxNzc0Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTMwN2EyYjQ4MDY1YmUwNmE5ZTgyMDVhNTdlOTI5NjBkYzEzMmYxY2IwNjIx
10
- ZTRkMDYzYWFhODg1ZTFhNzk0Y2RkYzNhN2MwNjcwOTZmMmQxYmYyNjgyMDNm
11
- YjA4Zjg3YjUwZmE0ZWFlOGMwNDM4NzYzNDllYzFlMTllMzkzMDM=
9
+ NzYzNjQ4ODhiMDFiYTlhOWYwYzM1YmMxZmRlZTE5NGNkMjEyZDc2NDE4ODJl
10
+ MjMyMmU5MjljMjI0ZWM1ZDQ5ODliNWQ0ZDA2YmFmOTcwNTZiMmUxNjg4YzUz
11
+ YjJiYTI5MzQ4OGE4MjJiNzMzYjJkOTlhZDBhN2U1ZTc5ZjY5N2U=
12
12
  data.tar.gz: !binary |-
13
- ODE4OTc1ODQwNWJmMzA1NDhlMzhmODYxYWY2YWUxN2NhN2M1M2ZjMjEzMzlm
14
- ZmU2Mzk5ZTI1NDA0NDM5YzY2YTA1ZDVhMDliOTQxYjM2NjVhZmE1YTNlODJi
15
- Y2M5ZGVhMDBiNmIzNzBjMWIwYTcxZTk4ZGFhMTFkMzY2Njk2NmU=
13
+ YmFiNDIzNmIxODFkNWE1M2NmOGFkMzlhZDA4MDc5MjgwZWQ5Njg4MDJhZmNk
14
+ ZGViZDllNjdlMWI0ZGRjZWJlMmU0YTJkNDUxZDM2ZWM3MThhNDI1NDk2ZjI0
15
+ YzI1NzM3ZmEzYTg0YmMxMTFmNDMyODFmYjcyZjIzYWM5NDBhYzU=
data/README.md CHANGED
@@ -33,6 +33,7 @@ PuppetfileUpdater::RakeTask.new :sync_c2c_refs do |config|
33
33
  config.gh_login = 'github_robot'
34
34
  config.gh_password = 'github_password'
35
35
  config.major = true
36
+ config.debug = true
36
37
  end
37
38
  ```
38
39
 
@@ -16,6 +16,7 @@ class PuppetfileUpdater
16
16
  attr_accessor :major
17
17
  attr_accessor :gh_login
18
18
  attr_accessor :gh_password
19
+ attr_accessor :debug
19
20
 
20
21
  # Public: Initialise a new PuppetfileUpdater::RakeTask.
21
22
  #
@@ -60,28 +61,43 @@ class PuppetfileUpdater
60
61
  )
61
62
  aug.load!
62
63
 
64
+ error_path = '/augeas/files/Puppetfile/error'
65
+ unless aug.match('/augeas/files/Puppetfile/error').size == 0
66
+ msg = "Failed to parse Puppetfile at line #{aug.get(error_path+'/line')}, "
67
+ msg << "character #{aug.get(error_path+'/char')}: "
68
+ msg << aug.get('/augeas/files/Puppetfile/error/message')
69
+ abort msg
70
+ end
71
+
63
72
  # Update from GitHub
64
73
  aug.match("/files/Puppetfile/*[git=~regexp('.*/#{@user}/.*')]").each do |mpath|
65
74
  m = aug.get(mpath)
75
+ puts "D: Considering #{m} for git update" if @debug
66
76
  next if !@module.nil? && @module != m.gsub(%r{.*[-/]}, '')
77
+ puts "D: #{m} selected by filters" if @debug
67
78
 
68
79
  warn "W: #{m} is a fork!" unless m =~ /#{@user}/
69
80
 
70
81
  git_url = aug.get("#{mpath}/git")
71
82
  repo = Octokit::Repository.from_url(git_url.gsub(/\.git$/, ''))
72
83
  commits = github.commits(repo)
73
- aug.set("#{mpath}/ref", commits[0].sha[0...7])
84
+ ref = commits[0].sha[0...7]
85
+ puts "D: New ref for #{m} is #{ref}" if @debug
86
+ aug.set("#{mpath}/ref", ref)
74
87
  end
75
88
 
76
89
  # Update from Forge
77
90
  PuppetForge.user_agent = 'Puppetfile-Updater/0.1.0'
78
91
  aug.match("/files/Puppetfile/*[label()!='#comment' and .=~regexp('#{@user}/.*') and @version]").each do |mpath|
79
92
  m = aug.get(mpath).gsub('/', '-')
93
+ puts "D: Considering #{m} for forge update" if @debug
80
94
  next if !@module.nil? && @module != m.gsub(%r{.*[-/]}, '')
95
+ puts "D: #{m} selected by filters"
81
96
  v = aug.get("#{mpath}/@version")
82
97
  forge_m = PuppetForge::Module.find(m)
83
98
  release = forge_m.releases.select { |r| r.deleted_at.nil? }[0]
84
99
  new_v = release.version
100
+ puts "D: New version for #{m} is #{new_v}" if @debug
85
101
  if new_v.split('.')[0] != v.split('.')[0]
86
102
  if @major
87
103
  warn "W: #{m} has incompatible changes between #{v} and #{new_v}"
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.2.1
4
+ version: 0.3.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-06-24 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake