jekyll-gitlab-letsencrypt 0.2.1 → 0.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8077836262a44842ecedb9e2f4d2b9867e762739
|
4
|
+
data.tar.gz: 583f08998de45b2126e9645d470c0ffa2e9c7a46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73d66711574fc5a45b6368f17317f35dc8775757cccebac1717593efe8cdaaf530dcabf35260e6058f110bb46abfddfe9bf1574bd186ec5f502b3026aa6dbea1
|
7
|
+
data.tar.gz: 9d4ef45e01dfba73b32322acba2e81e2cfd06cd12d86c9cf14be938790708fa2499a8cac2ae92bb4867c1c69a2cc6d7b70cb01fc4287f8f6ce71b794bd0789ff
|
data/CHANGELOG.markdown
CHANGED
@@ -32,8 +32,8 @@ module Jekyll
|
|
32
32
|
connection.post do |req|
|
33
33
|
req.url "projects/#{repo_id}/repository/branches"
|
34
34
|
req.body = {
|
35
|
-
|
36
|
-
ref:
|
35
|
+
branch: branch,
|
36
|
+
ref: 'master'
|
37
37
|
}.to_json
|
38
38
|
end
|
39
39
|
end
|
@@ -41,11 +41,10 @@ module Jekyll
|
|
41
41
|
def commit_file!
|
42
42
|
Jekyll.logger.info "Commiting challenge file as #{filename}"
|
43
43
|
connection.run_request(request_method_for_commit, nil, nil, nil) do |req|
|
44
|
-
req.url "projects/#{repo_id}/repository/files"
|
44
|
+
req.url "projects/#{repo_id}/repository/files/#{enc_filename}"
|
45
45
|
req.body = {
|
46
|
-
file_path: filename,
|
47
46
|
commit_message: "Automated Let's Encrypt renewal",
|
48
|
-
|
47
|
+
branch: branch,
|
49
48
|
content: content
|
50
49
|
}.to_json
|
51
50
|
end
|
@@ -60,20 +59,27 @@ module Jekyll
|
|
60
59
|
end
|
61
60
|
|
62
61
|
def request_method_for_commit
|
63
|
-
response = connection.get "projects/#{repo_id}/repository/files?ref=#{branch}
|
62
|
+
response = connection.get "projects/#{repo_id}/repository/files/#{enc_filename}?ref=#{branch}"
|
64
63
|
response.status == 404 ? :post : :put
|
65
64
|
end
|
66
65
|
|
66
|
+
def enc_filename
|
67
|
+
filename.gsub "/", "%2f"
|
68
|
+
end
|
69
|
+
|
67
70
|
def repo_id
|
68
71
|
@repo_id ||= begin
|
69
72
|
repo_name = gitlab_repo.gsub "/", "%2f"
|
70
73
|
response = connection.get "projects/#{repo_name}"
|
74
|
+
unless response.success?
|
75
|
+
fail StandardError, "Failed response for projects/#{repo_name}. Please check if personal token and repo name are correct"
|
76
|
+
end
|
71
77
|
JSON.parse(response.body)['id']
|
72
78
|
end
|
73
79
|
end
|
74
80
|
|
75
81
|
def connection
|
76
|
-
@connection ||= Faraday.new(url: "#{gitlab_url}/api/
|
82
|
+
@connection ||= Faraday.new(url: "#{gitlab_url}/api/v4/") do |faraday|
|
77
83
|
faraday.adapter Faraday.default_adapter
|
78
84
|
faraday.headers['Content-Type'] = 'application/json'
|
79
85
|
faraday.headers['PRIVATE-TOKEN'] = personal_access_token
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-gitlab-letsencrypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Aiken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|