knife-github 0.1.8 → 0.1.9
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 +8 -8
- data/lib/chef/knife/github_repo_create.rb +33 -11
- data/lib/knife-github/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWUwODg1N2Y4MTRjNjBkNDRkMTgxNWUxZmNmMDlmYzAwZmE4YWRmYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDBjNmYxOGVmYzUyYmI0NDRkN2ZhMGY5NGU4NWJmZmRiZWQ4YWQzMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmQ2Y2Q3OWZjYjdjNjk0ZjBiMDk2ZDY3N2MyY2JjYmUwZTc1OTYwNzRkNTFj
|
10
|
+
M2E0MWUyMzYyMTMzYWI1NGM3ZmQ3ZjRjYmY0OGFhNmFhNDY0YTAzODA5NmYx
|
11
|
+
ZTExYTQxMDA3ZTIxZWM1YzdkNWY1NWFmOGRiNzk2OTIzYmUyODc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWE3OGFhOWVkMThmOTYzNTQxOTRjMDNlYTdlZWI1ZDQ0YWM4Njc0Zjc0MzM2
|
14
|
+
MDJiNDNmZjdiYmRlMGU3YWQxMzNiOTYyNTAyZjIwYWE0Zjg0OWIwOGEzODhk
|
15
|
+
NzYwZjZhMmYzZjdiMDRiMWUzMmQ1MDJhYmY0NDhjOTA0YTg0MDc=
|
@@ -102,11 +102,22 @@ module KnifeGithubRepoCreate
|
|
102
102
|
# Creating the github repository
|
103
103
|
Chef::Log.debug("Creating the github repository")
|
104
104
|
repo = connection.request(params)
|
105
|
-
|
106
|
-
|
107
|
-
|
105
|
+
if @github_url =~ /^https:\/\/.*$/
|
106
|
+
token = get_github_token
|
107
|
+
if token.nil? || token.empty?
|
108
|
+
github_connection_url = repo['html_url']
|
109
|
+
else
|
110
|
+
uri = URI.parse(repo['html_url'])
|
111
|
+
uri.userinfo = "#{token}:x-oauth-basic"
|
112
|
+
github_connection_url = URI.join(uri)
|
113
|
+
end
|
114
|
+
else
|
115
|
+
github_connection_url = repo['ssh_url']
|
116
|
+
end
|
117
|
+
|
118
|
+
Chef::Log.debug("Commit and push local repository, using URL: #{github_connection_url}")
|
108
119
|
# Initialize the local git repo
|
109
|
-
git_commit_and_push(cookbook_dir,
|
120
|
+
git_commit_and_push(cookbook_dir, github_connection_url)
|
110
121
|
|
111
122
|
puts "Finished creating #{name} and uploading #{cookbook_dir}"
|
112
123
|
else
|
@@ -121,11 +132,22 @@ module KnifeGithubRepoCreate
|
|
121
132
|
# Creating the github repository
|
122
133
|
Chef::Log.debug("Creating the github repository")
|
123
134
|
repo = connection.request(params)
|
124
|
-
|
125
|
-
|
126
|
-
|
135
|
+
if @github_url =~ /^https:\/\/.*$/
|
136
|
+
token = get_github_token
|
137
|
+
if token.nil? || token.empty?
|
138
|
+
github_connection_url = repo['html_url']
|
139
|
+
else
|
140
|
+
uri = URI.parse(repo['html_url'])
|
141
|
+
uri.userinfo = "#{token}:x-oauth-basic"
|
142
|
+
github_connection_url = URI.join(uri)
|
143
|
+
end
|
144
|
+
else
|
145
|
+
github_connection_url = repo['ssh_url']
|
146
|
+
end
|
147
|
+
|
148
|
+
Chef::Log.debug("Commit and push local repository, using URL: #{github_connection_url}")
|
127
149
|
# Initialize the local git repo
|
128
|
-
git_commit_and_push(cookbook_dir,
|
150
|
+
git_commit_and_push(cookbook_dir, github_connection_url)
|
129
151
|
|
130
152
|
Chef::Log.debug("Removing temp files")
|
131
153
|
FileUtils.remove_entry(@github_tmp)
|
@@ -184,8 +206,8 @@ module KnifeGithubRepoCreate
|
|
184
206
|
|
185
207
|
# Set the username in README.md
|
186
208
|
# @param cookbook_path [String] cookbook path
|
187
|
-
#
|
188
|
-
def git_commit_and_push(cookbook_path,
|
209
|
+
# github_url [String] github ssh url from repo
|
210
|
+
def git_commit_and_push(cookbook_path, github_url)
|
189
211
|
if File.exists?(File.join(cookbook_path, ".git"))
|
190
212
|
shell_out("git remote rm origin", :cwd => cookbook_path)
|
191
213
|
else
|
@@ -194,7 +216,7 @@ module KnifeGithubRepoCreate
|
|
194
216
|
shell_out!("echo - $(date): Uploaded with knife github plugin. >> CHANGELOG.md ", :cwd => cookbook_path)
|
195
217
|
shell_out!("git add .", :cwd => cookbook_path)
|
196
218
|
shell_out!("git commit -m 'creating initial cookbook structure from the knife-github plugin' ", :cwd => cookbook_path)
|
197
|
-
shell_out!("git remote add origin #{
|
219
|
+
shell_out!("git remote add origin #{github_url} ", :cwd => cookbook_path)
|
198
220
|
shell_out!("git push -u origin master", :cwd => cookbook_path)
|
199
221
|
end
|
200
222
|
|
data/lib/knife-github/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sander Botman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
12
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mixlib-versioning
|