ra10ke 0.1.1 → 0.2.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 483f8c67bc228bd5affa23eaac538347581de8c0
4
- data.tar.gz: 771f7dbb80a893cada40224390c052b36d1c61d3
3
+ metadata.gz: 22fd36a3a88f9a05d15fb0b4e964e3151e0eff8f
4
+ data.tar.gz: f9234354db77a8bf07d29e826c7570ffc6bc29d0
5
5
  SHA512:
6
- metadata.gz: fc9710e7143356792a1c25f160ef454bd4877d367336a5c1f4c6bafa8363acb6188f20dce7293b547f9938b7223200349eb47ea70569c035a076e81d560acdf4
7
- data.tar.gz: 6eacea7b1ec0d8d3b80c3c72f14e17b4ac57341cde6da14b253e2e43fbe04cbe22761f80afacee1f41638b619fec45bdff96082b1c27c10c7d83e06b209dd509
6
+ metadata.gz: 8bba17ade9b5e494e75f604e8ec734c1c5489a127adc366554c2b35c69cade5a3e49d50b725fb036ac03e92e98db0651f18856e6eb2f4d0e1db797f1027636c4
7
+ data.tar.gz: 3f59f147b0d1709ae9e3c4aa5cfbd2a2e1770b2d789661b9f501a003b99e4ad7e778b667aeba4166b836ffbfe20547d98838519f2f51433426a4221d5b23c451
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 0.2.0
5
+ -----
6
+
7
+ 2017-01-03
8
+
9
+ * Moved to [Vox Pupuli](https://voxpupuli.org/)
10
+ * [#3](https://github.com/voxpupuli/ra10ke/pull/3) Update ra10ke with r10k 2.4.0 support
11
+ * [#4](https://github.com/voxpupuli/ra10ke/pull/4) Added git support
12
+
13
+ Many thanks to [Alexander "Ace" Olofsson](https://github.com/ace13) and [James Powis](https://github.com/james-powis) for their contributions!
14
+
4
15
  0.1.1
5
16
  -----
6
17
 
data/README.md CHANGED
@@ -31,9 +31,20 @@ command.
31
31
  This rake task goes through the modules that are declared in the Puppetfile,
32
32
  and prints outdated modules.
33
33
 
34
+ Supports:
35
+ - Puppet Forge
36
+ - Git (SHA-ref and Tagging)
37
+
38
+ Ignoring specific modules:
39
+
40
+ Under specific conditions you may not wish to report on specific modules being out of date,
41
+ to ignore a module create `.r10kignore` file in the same directory as your Puppetfile.
42
+
34
43
  #### Limitations
35
44
 
36
- * It works only with modules from the [Forge](https://forge.puppetlabs.com).
37
- Git and SVN modules will be ignored.
45
+ * It works only with modules from the [Forge](https://forge.puppetlabs.com), and Git.
46
+ SVN modules will be ignored.
47
+ * Git support is explicitly SHA Ref and Tag supported. If tag is used it must follow
48
+ `v0.0.0` convention, other wise it will be ignored.
38
49
  * The version has to be specified explicitly. If it is omitted, or it is
39
50
  `:latest`, the module will be ignored.
@@ -1,3 +1,3 @@
1
1
  module Ra10ke
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/ra10ke.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'rake'
2
2
  require 'rake/tasklib'
3
3
  require 'ra10ke/version'
4
+ require 'git'
4
5
 
5
6
  module Ra10ke
6
7
  class RakeTask < ::Rake::TaskLib
@@ -12,9 +13,17 @@ module Ra10ke
12
13
  require 'puppet_forge'
13
14
 
14
15
  PuppetForge.user_agent = "ra10ke/#{Ra10ke::VERSION}"
15
- puppetfile = R10K::Puppetfile.new('.').load
16
+ puppetfile = R10K::Puppetfile.new('.')
17
+ puppetfile.load!
16
18
 
17
- puppetfile.each do |puppet_module|
19
+ # ignore file allows for "don't tell me about this"
20
+ ignore_modules = []
21
+ if File.exist?('.r10kignore')
22
+ ignore_modules = File.readlines('.r10kignore').each {|l| l.chomp!}
23
+ end
24
+
25
+ puppetfile.modules.each do |puppet_module|
26
+ next if ignore_modules.include? puppet_module.title
18
27
  if puppet_module.class == R10K::Module::Forge
19
28
  module_name = puppet_module.title.gsub('/', '-')
20
29
  forge_version = PuppetForge::Module.find(module_name).current_release.version
@@ -23,6 +32,39 @@ module Ra10ke
23
32
  puts "#{puppet_module.title} is OUTDATED: #{installed_version} vs #{forge_version}"
24
33
  end
25
34
  end
35
+
36
+ if puppet_module.class == R10K::Module::Git
37
+ remote = puppet_module.instance_variable_get(:@remote)
38
+ ref = puppet_module.instance_variable_get(:@desired_ref)
39
+
40
+ # some guards to prevent unnessicary execution
41
+ next unless ref
42
+ next if ref == 'master'
43
+
44
+ remote_refs = Git.ls_remote(remote)
45
+
46
+ # skip if ref is a branch
47
+ next if remote_refs['branches'].key?(ref)
48
+
49
+ ref_type = 'sha' if ref.match(/^[a-z0-9]{40}$/)
50
+ ref_type = 'tag' if remote_refs['tags'].key?(ref)
51
+ case ref_type
52
+ when 'sha'
53
+ latest_ref = remote_refs['head'][:sha]
54
+ when 'tag'
55
+ # we have to be opinionated here, due to multiple conventions only one can reign suppreme
56
+ # as such tag v#.#.# is what will pick.
57
+ if ref.match(/^[vV]\d/)
58
+ tags = remote_refs['tags']
59
+ version_tags = tags.select { |f| /^[vV]\d/.match(f) }
60
+ latest_ref = version_tags.keys.sort.last
61
+ end
62
+ else
63
+ raise "Unable to determine ref_type for #{puppet_module.title}"
64
+ end
65
+
66
+ puts "#{puppet_module.title} is OUTDATED: #{ref} vs #{latest_ref}" if ref != latest_ref
67
+ end
26
68
  end
27
69
  end
28
70
 
data/ra10ke.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["tampakrap@gmail.com"]
10
10
  spec.description = %q{R10K and Puppetfile rake tasks}
11
11
  spec.summary = %q{Syntax check for the Puppetfile, check for outdated installed puppet modules}
12
- spec.homepage = "https://github.com/tampakrap/ra10ke"
12
+ spec.homepage = "https://github.com/voxpupuli/ra10ke"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
@@ -18,4 +18,5 @@ Gem::Specification.new do |spec|
18
18
  spec.add_dependency "rake"
19
19
  spec.add_dependency "puppet_forge"
20
20
  spec.add_dependency "r10k"
21
+ spec.add_dependency "git"
21
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ra10ke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theo Chatzimichos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: git
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: R10K and Puppetfile rake tasks
56
70
  email:
57
71
  - tampakrap@gmail.com
@@ -59,6 +73,7 @@ executables: []
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
76
+ - ".gitignore"
62
77
  - CHANGELOG.md
63
78
  - Gemfile
64
79
  - LICENSE.txt
@@ -66,7 +81,7 @@ files:
66
81
  - lib/ra10ke.rb
67
82
  - lib/ra10ke/version.rb
68
83
  - ra10ke.gemspec
69
- homepage: https://github.com/tampakrap/ra10ke
84
+ homepage: https://github.com/voxpupuli/ra10ke
70
85
  licenses:
71
86
  - MIT
72
87
  metadata: {}