bourdain 1.2.14 → 1.2.15

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: d25ccec53a814150f4d724f5e811ca292e1a9442
4
- data.tar.gz: 73c4550bb9b4dd5ca681c461407ee0e5dd654345
3
+ metadata.gz: d0546af0081ec0ed6aef62a0ba68b3289f3d5f91
4
+ data.tar.gz: 0f14f843d1d4d5e461496ebf728efd29638d9312
5
5
  SHA512:
6
- metadata.gz: 145899f67763ada16bd94a97071bfb7405e99bf1a3bfb6cef43bdfbbfc8dc6688a5d81a786615d465c1726329d10ef84c9a199b2d6707262950d88440596001d
7
- data.tar.gz: 61d364fd4924cb08d9de754e1a0ca3ff1377bc09dc6cba93aa1930ecd1ac01047d79179af73340a5a7a5ed874e83590323d2e2682f27007f6d29f749a63d4102
6
+ metadata.gz: f68b33cb79ff3f4d79bad1700eb8f0a7c57daf699ff8a0c4144a5a729e0443fa20db9829cefa71de406743f27a50240f942cd56bb0df257e9b166f3f11f68f1b
7
+ data.tar.gz: 7adb1947b69a3737a44cd6bfda0c61c0511172b93dbd744eb9ca3943bd3874e4765d9df38455faaa6574ca2c73059726ae675d9f5d7208caa20f919e1ea4a606
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.14
1
+ 1.2.15
@@ -42,27 +42,19 @@ module Bourdain
42
42
  end
43
43
  end
44
44
 
45
- matches = File.read('Gemfile.lock').match(/bourdain \((.*?)\)$/)
45
+ local_version = gemfile_version 'bourdain'
46
+ latest_version = rubygems_version 'bourdain'
46
47
 
47
- if matches.nil?
48
- log.warn "Couldn't find Kitchen hooks in your Gemfile lock. Something is amiss..."
48
+ if latest_version == local_version
49
+ log.info 'Your Kitchen is bundled with the latest Bourdain.'
50
+ elsif local_version < latest_version
51
+ log.error 'Your Kitchen is bundled with an older Bourdain. Try "bundle update bourdain".'
49
52
  error!
50
-
51
53
  else
52
- repo_version = matches[1].strip
53
- local_version = File.read(File.join(bourdain, 'VERSION')).strip
54
-
55
- if repo_version == local_version
56
- log.info "Your Chef repo is bundled with the latest Bourdain."
57
- elsif ahead_of_remote
58
- # Don't worry about it, we've already warned them
59
- elsif local_version < repo_version
60
- log.error 'Your Chef repo is bundled with an older Bourdain. Try "bundle update".'
61
- error!
62
- end
54
+ log.warn "You appear to have an unreleased Bourdain. I hope you know what you're doing..."
63
55
  end
64
56
 
65
- # Remove pre-commit hook if installed
57
+ # Remove deprecated pre-commit hook if installed
66
58
  pre_commit_hook = File.join(*bourdain, '.git', 'hooks', 'pre-commit')
67
59
  FileUtils.rm_rf pre_commit_hook
68
60
  end
@@ -3,7 +3,7 @@ module Bourdain
3
3
 
4
4
  class HooksCheck < Check
5
5
  usage :check, <<-END
6
- Check the local copy of Kitchen hooks
6
+ Check the local copy of the Kitchen Hooks
7
7
  hooks
8
8
  END
9
9
 
@@ -18,48 +18,40 @@ module Bourdain
18
18
 
19
19
  private
20
20
  def check_hooks!
21
- # Ensure we have an up-to-date copy of Kitchen hooks
21
+ # Ensure we have an up-to-date copy of the Kitchen Hooks
22
22
  hooks = File.join('utils', 'hooks')
23
23
 
24
24
  ahead_of_remote = false
25
25
  unless Dir.exists? hooks
26
- log.warn "Hm, I don't see a copy of Kitchen hooks. I'll fix that for you..."
26
+ log.warn "Hm, I don't see a copy of the Kitchen Hooks. I'll fix that for you..."
27
27
  %x| git clone git@git.bluejeansnet.com:kitchen-hooks.git #{hooks} |
28
- log.info "Your copy of Kitchen hooks is now up-to-date."
28
+ log.info "Your copy of the Kitchen Hooks is now up-to-date."
29
29
 
30
30
  else
31
31
  if youre_dirty? hooks
32
- log.warn "Your copy of Kitchen hooks is dirty."
32
+ log.warn "Your copy of the Kitchen Hooks is dirty."
33
33
  elsif youre_ahead? hooks
34
- log.warn "Your copy of Kitchen hooks is ahead of the remote."
34
+ log.warn "Your copy of the Kitchen Hooks is ahead of the remote."
35
35
  ahead_of_remote = true
36
36
  elsif youre_behind? hooks
37
- log.warn "Hey, looks like your copy of Kitchen hooks is out-of-date. I'll fix that for you..."
37
+ log.warn "Hey, looks like your copy of the Kitchen Hooks is out-of-date. I'll fix that for you..."
38
38
  Dir.chdir(bourdain) { %x| git pull | }
39
- log.info "Your copy of Kitchen hooks is now up-to-date."
39
+ log.info "Your copy of the Kitchen Hooks is now up-to-date."
40
40
  else
41
- log.info "Your copy of Kitchen hooks looks up-to-date."
41
+ log.info "Your copy of the Kitchen Hooks looks up-to-date."
42
42
  end
43
43
  end
44
44
 
45
- matches = File.read('Gemfile.lock').match(/kitchen_hooks \((.*?)\)$/)
45
+ local_version = gemfile_version 'bourdain'
46
+ latest_version = rubygems_version 'bourdain'
46
47
 
47
- if matches.nil?
48
- log.warn "Couldn't find Kitchen hooks in your Gemfile lock. Something is amiss..."
48
+ if latest_version == local_version
49
+ log.info 'Your Kitchen is bundled with the latest Kitchen Hooks.'
50
+ elsif local_version < latest_version
51
+ log.error 'Your Kitchen is bundled with older Kitchen Hooks. Try "bundle update kitchen_hooks".'
49
52
  error!
50
-
51
53
  else
52
- repo_version = matches[1].strip
53
- local_version = File.read(File.join(hooks, 'VERSION')).strip
54
-
55
- if repo_version == local_version
56
- log.info "Your Chef repo is bundled with the latest Kitchen hooks."
57
- elsif ahead_of_remote
58
- # Don't worry about it, we've already warned them
59
- elsif local_version < repo_version
60
- log.error 'Your Chef repo is bundled with an older Kitchen hooks. Try "bundle update".'
61
- error!
62
- end
54
+ log.warn "You appear to have unreleased Kitchen Hooks. I hope you know what you're doing..."
63
55
  end
64
56
  end
65
57
  end
@@ -1,11 +1,28 @@
1
- require 'erb'
2
1
  require 'fileutils'
2
+ require 'open-uri'
3
+ require 'json'
4
+ require 'erb'
3
5
 
4
6
 
5
7
  module Bourdain
6
8
  module Checks
7
9
  class Check < Bourdain::Resource
8
10
  protected
11
+ def gemfile_version gem_name
12
+ gemfile_lock = File.read 'Gemfile.lock'
13
+ gemfile_lock =~ /#{gem_name} \((.*?)\)/
14
+ $1
15
+ end
16
+
17
+ def rubygems_version gem_name
18
+ versions_url = "https://rubygems.org/api/v1/versions/#{gem_name}.json"
19
+ open(versions_url) do |f|
20
+ versions = JSON::parse f.read
21
+ versions = versions.sort_by { |v| v['number'] }
22
+ versions.last['number']
23
+ end
24
+ end
25
+
9
26
  def work_tree repo
10
27
  "--work-tree=#{File.join(Dir.pwd, repo)}"
11
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bourdain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.14
4
+ version: 1.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pmap