knife-changelog 0.0.6 → 0.0.7
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 +4 -4
- data/lib/chef/knife/changelog.rb +18 -1
- data/lib/knife/changelog/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34152ac50aad8ec013bfbd082912c1fb3f4dd69b
|
4
|
+
data.tar.gz: 2b7628639511e0b1f6b2ea5209ae41e26695d28f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16ee8cd9af20fc1a9b15f498314ccdee066591eca64a30b66cac25486b49350dad72b95479ffb8b7767401ec745bb71faaf161d1b7de2bd073976a0773d0c334
|
7
|
+
data.tar.gz: 051449529d72c8223eeefd7d3798b3e4aeab3165c4a4a49bf471a02af6468343327726bc6c35d56fb4d9a4a419a19195de451e2e894d2579b93416db97d2e7be
|
data/lib/chef/knife/changelog.rb
CHANGED
@@ -102,7 +102,7 @@ class Chef
|
|
102
102
|
when /github.com\/(.*)(.git)?/
|
103
103
|
options = {
|
104
104
|
:github => $1,
|
105
|
-
:revision =>
|
105
|
+
:revision => version_for(name),
|
106
106
|
}
|
107
107
|
location = Berkshelf::GithubLocation.new dep, options
|
108
108
|
handle_git(location)
|
@@ -111,11 +111,28 @@ class Chef
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
+
def revision_exists?(dir, revision)
|
115
|
+
Log.debug "Testing existence of #{revision}"
|
116
|
+
revlist = Mixlib::ShellOut.new("git rev-list --quiet #{revision}", :cwd => dir)
|
117
|
+
revlist.run_command
|
118
|
+
not revlist.error?
|
119
|
+
end
|
120
|
+
|
121
|
+
def detect_cur_revision(dir, rev)
|
122
|
+
unless revision_exists?(dir, rev)
|
123
|
+
prefixed_rev = 'v' + rev
|
124
|
+
return prefixed_rev if revision_exists?(dir, prefixed_rev)
|
125
|
+
fail "#{rev} is not a valid revision"
|
126
|
+
end
|
127
|
+
rev
|
128
|
+
end
|
129
|
+
|
114
130
|
def handle_git(location)
|
115
131
|
tmp_dir = shallow_clone(@tmp_prefix,location.uri)
|
116
132
|
|
117
133
|
rev_parse = location.instance_variable_get(:@rev_parse)
|
118
134
|
cur_rev = location.revision.rstrip
|
135
|
+
cur_rev = detect_cur_revision(tmp_dir, cur_rev)
|
119
136
|
ls_tree = Mixlib::ShellOut.new("git ls-tree -r #{rev_parse}", :cwd => tmp_dir)
|
120
137
|
ls_tree.run_command
|
121
138
|
changelog = ls_tree.stdout.lines.find { |line| line =~ /\s(changelog.*$)/i }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-changelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregoire Seux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|