jekyll-gitlab-letsencrypt 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1118d4b7321057dddb6e61f731ddbe2a006cd31e
4
- data.tar.gz: df1e23291701da84974b3f568dfc211570062daf
3
+ metadata.gz: 8077836262a44842ecedb9e2f4d2b9867e762739
4
+ data.tar.gz: 583f08998de45b2126e9645d470c0ffa2e9c7a46
5
5
  SHA512:
6
- metadata.gz: 28b0049ba607bd46df91bc17b21f7f57b620cd669b1b6fa26fe2dbe703bb661e337557c1806a706b85f509097dcc979c41a02c53fc411dca2cdffb6b4b807885
7
- data.tar.gz: ab2f7fecfb1ab15cdfdecbd401dd35c94bfe73d60a94da14177839ba3285f1821c263619a46ed6ae4fa568fed9b8058ada5bc6b7713164d94c57c59dcb765839
6
+ metadata.gz: 73d66711574fc5a45b6368f17317f35dc8775757cccebac1717593efe8cdaaf530dcabf35260e6058f110bb46abfddfe9bf1574bd186ec5f502b3026aa6dbea1
7
+ data.tar.gz: 9d4ef45e01dfba73b32322acba2e81e2cfd06cd12d86c9cf14be938790708fa2499a8cac2ae92bb4867c1c69a2cc6d7b70cb01fc4287f8f6ce71b794bd0789ff
@@ -1,3 +1,9 @@
1
+ # 0.3.0
2
+
3
+ - #17 - Check for repo id fetch request status
4
+ - Update to Gitlab API V4
5
+ - Mostly from #18 - thanks @ethernet-zero !
6
+
1
7
  # 0.2.1
2
8
 
3
9
  - Add custom GitLab URL setting
@@ -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
- branch_name: branch,
36
- ref: 'master'
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
- branch_name: branch,
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}&file_path=#{filename}"
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/v3/") do |faraday|
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
@@ -1,7 +1,7 @@
1
1
  module Jekyll
2
2
  module Gitlab
3
3
  module Letsencrypt
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end
7
7
  end
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.2.1
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-03-09 00:00:00.000000000 Z
11
+ date: 2018-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler