labclient 0.1.2 → 0.2.1
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/labclient.rb +16 -6
- data/lib/labclient/access_levels.rb +24 -30
- data/lib/labclient/branches/branch.rb +25 -0
- data/lib/labclient/branches/create.rb +33 -0
- data/lib/labclient/client.rb +47 -7
- data/lib/labclient/commits/project_helpers.rb +4 -0
- data/lib/labclient/commits/show.rb +11 -2
- data/lib/labclient/docs.rb +9 -5
- data/lib/labclient/epics/epic.rb +13 -0
- data/lib/labclient/error.rb +1 -0
- data/lib/labclient/files/create.rb +14 -8
- data/lib/labclient/files/update.rb +1 -1
- data/lib/labclient/generator/generator.rb +9 -21
- data/lib/labclient/generator/names.rb +17 -3
- data/lib/labclient/generator/template_helper.rb +81 -0
- data/lib/labclient/generator/templates/environments.rb +98 -0
- data/lib/labclient/generator/templates/pages.rb +24 -30
- data/lib/labclient/generator/templates/pipeline_trigger.rb +82 -0
- data/lib/labclient/generator/wizard.rb +29 -9
- data/lib/labclient/groups/group.rb +1 -1
- data/lib/labclient/http.rb +3 -2
- data/lib/labclient/issues/issue.rb +23 -1
- data/lib/labclient/issues/update.rb +20 -2
- data/lib/labclient/jobs/delete.rb +1 -1
- data/lib/labclient/jobs/keep.rb +1 -1
- data/lib/labclient/jobs/play.rb +1 -1
- data/lib/labclient/jobs/trace.rb +2 -2
- data/lib/labclient/klass.rb +6 -3
- data/lib/labclient/lab_struct.rb +21 -0
- data/lib/labclient/license/list.rb +2 -2
- data/lib/labclient/members/member.rb +1 -0
- data/lib/labclient/merge_requests/accept.rb +15 -6
- data/lib/labclient/merge_requests/create.rb +12 -0
- data/lib/labclient/merge_requests/merge_request.rb +49 -4
- data/lib/labclient/notes/epics/create.rb +12 -4
- data/lib/labclient/notes/epics/delete.rb +3 -3
- data/lib/labclient/notes/epics/list.rb +21 -4
- data/lib/labclient/notes/epics/show.rb +4 -4
- data/lib/labclient/notes/epics/update.rb +4 -4
- data/lib/labclient/notes/issues/create.rb +11 -1
- data/lib/labclient/notes/issues/list.rb +18 -3
- data/lib/labclient/notes/issues/show.rb +1 -1
- data/lib/labclient/notes/merge_requests/create.rb +8 -0
- data/lib/labclient/notes/merge_requests/list.rb +20 -2
- data/lib/labclient/notes/snippets/create.rb +1 -1
- data/lib/labclient/notes/snippets/list.rb +20 -3
- data/lib/labclient/notes/snippets/show.rb +1 -1
- data/lib/labclient/notifications/update.rb +1 -1
- data/lib/labclient/overview.rb +79 -11
- data/lib/labclient/paginated_response.rb +3 -1
- data/lib/labclient/pipelines/pipeline.rb +41 -0
- data/lib/labclient/projects/environments/project_environment.rb +10 -0
- data/lib/labclient/projects/methods.rb +49 -2
- data/lib/labclient/projects/reference.rb +12 -0
- data/lib/labclient/projects/snippets/project_snippet.rb +12 -0
- data/lib/labclient/protected_branches/protect.rb +6 -5
- data/lib/labclient/protected_environments/list.rb +29 -0
- data/lib/labclient/protected_environments/protect.rb +53 -0
- data/lib/labclient/protected_environments/protected_environment.rb +22 -0
- data/lib/labclient/protected_environments/show.rb +24 -0
- data/lib/labclient/protected_environments/unprotect.rb +31 -0
- data/lib/labclient/snippets/snippet.rb +2 -2
- data/lib/labclient/users/membership.rb +62 -0
- data/lib/labclient/users/memberships.rb +8 -3
- data/lib/labclient/users/user.rb +7 -1
- data/lib/labclient/version.rb +1 -1
- metadata +16 -7
- data/lib/labclient/generator/templates/template.rb +0 -23
- data/lib/labclient/open_struct.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4c0988633436f9872d93e241ceb4c85e5b780b5f419a08054231138d8448dc5
|
4
|
+
data.tar.gz: '06268afb4c985bd5dbffebf72c610aa0c4fe1083af0b86d30d5624a69e25f52e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c558d37e33b7efdad2b9e0621c3a0d437e2345cc987403af2c15bed6e1d0a04c926de86442e1595a7fbfb6b0aae63af8583430f4046782edea2362a0ebf946f7
|
7
|
+
data.tar.gz: 211e88abab828ddc51c7b6a8965a962ec34f95fb4f7e3106611f3af5b5d72e6c75431c3eabedb618a838f29b3b64e4301ed173d38120c9ef4bb0e5b0d45a8e69
|
data/lib/labclient.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# Public Gems
|
2
2
|
require 'oj'
|
3
|
-
require 'pry'
|
4
3
|
require 'typhoeus'
|
5
4
|
require 'active_support/all'
|
6
|
-
require '
|
5
|
+
require 'amazing_print'
|
7
6
|
require 'gitlab_chronic_duration'
|
8
7
|
require 'ostruct'
|
9
8
|
|
@@ -13,8 +12,8 @@ require 'labclient/http'
|
|
13
12
|
require 'labclient/access_levels'
|
14
13
|
require 'labclient/common'
|
15
14
|
require 'labclient/curl'
|
15
|
+
require 'labclient/lab_struct'
|
16
16
|
require 'labclient/klass'
|
17
|
-
require 'labclient/open_struct'
|
18
17
|
require 'labclient/class_helpers'
|
19
18
|
require 'labclient/paginated_response'
|
20
19
|
require 'labclient/error'
|
@@ -36,7 +35,6 @@ require 'labclient/users/current'
|
|
36
35
|
require 'labclient/users/status'
|
37
36
|
require 'labclient/users/counts'
|
38
37
|
require 'labclient/users/activity'
|
39
|
-
require 'labclient/users/memberships'
|
40
38
|
require 'labclient/users/search'
|
41
39
|
require 'labclient/users/create'
|
42
40
|
require 'labclient/users/update'
|
@@ -47,6 +45,8 @@ require 'labclient/users/activate'
|
|
47
45
|
require 'labclient/users/deactivate'
|
48
46
|
require 'labclient/users/delete'
|
49
47
|
require 'labclient/users/delete_identity'
|
48
|
+
require 'labclient/users/memberships'
|
49
|
+
require 'labclient/users/membership'
|
50
50
|
require 'labclient/users/user'
|
51
51
|
|
52
52
|
# ===============================================
|
@@ -149,6 +149,13 @@ require 'labclient/projects/environments/delete'
|
|
149
149
|
require 'labclient/projects/environments/stop'
|
150
150
|
require 'labclient/projects/environments/project_environment'
|
151
151
|
|
152
|
+
# Protected Environments
|
153
|
+
require 'labclient/protected_environments/list'
|
154
|
+
require 'labclient/protected_environments/show'
|
155
|
+
require 'labclient/protected_environments/protect'
|
156
|
+
require 'labclient/protected_environments/unprotect'
|
157
|
+
require 'labclient/protected_environments/protected_environment'
|
158
|
+
|
152
159
|
# Project Deployments
|
153
160
|
require 'labclient/projects/deployments/client'
|
154
161
|
require 'labclient/projects/deployments/list'
|
@@ -768,6 +775,7 @@ require 'labclient/files/delete'
|
|
768
775
|
# Branches
|
769
776
|
require 'labclient/branches/list'
|
770
777
|
require 'labclient/branches/show'
|
778
|
+
require 'labclient/branches/create'
|
771
779
|
require 'labclient/branches/delete'
|
772
780
|
require 'labclient/branches/delete_merged'
|
773
781
|
require 'labclient/branches/branch'
|
@@ -844,12 +852,14 @@ require 'labclient/resource_labels/resource_label'
|
|
844
852
|
|
845
853
|
# Generators
|
846
854
|
require 'labclient/generator/names'
|
847
|
-
require 'labclient/generator/
|
848
|
-
require 'labclient/generator/templates/pages'
|
855
|
+
require 'labclient/generator/template_helper' # Default Include Template
|
849
856
|
|
850
857
|
# Wizard
|
851
858
|
require 'labclient/generator/generator'
|
852
859
|
require 'labclient/generator/wizard'
|
853
860
|
|
861
|
+
# Dynamically Require Templates (Simplify new template creation)
|
862
|
+
Dir["#{File.dirname(__FILE__)}/labclient/generator/templates/*.rb"].sort.each { |file| require file }
|
863
|
+
|
854
864
|
# I am Very Last
|
855
865
|
require 'labclient/client'
|
@@ -2,46 +2,40 @@
|
|
2
2
|
module LabClient
|
3
3
|
# Shared Methods
|
4
4
|
module AccessLevel
|
5
|
+
HUMAN_ACCESS_LEVELS = {
|
6
|
+
0 => :none,
|
7
|
+
10 => :guest,
|
8
|
+
20 => :reporter,
|
9
|
+
30 => :developer,
|
10
|
+
40 => :maintainer,
|
11
|
+
50 => :owner,
|
12
|
+
60 => :admin
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
MACHINE_ACCESS_LEVELS = {
|
16
|
+
none: 0,
|
17
|
+
guest: 10,
|
18
|
+
reporter: 20,
|
19
|
+
developer: 30,
|
20
|
+
maintainer: 40,
|
21
|
+
owner: 50,
|
22
|
+
admin: 60
|
23
|
+
}.freeze
|
24
|
+
|
5
25
|
def human_access_level(level = 10)
|
6
|
-
|
7
|
-
when 0 then :none
|
8
|
-
when 10 then :guest
|
9
|
-
when 20 then :reporter
|
10
|
-
when 30 then :developer
|
11
|
-
when 40 then :maintainer
|
12
|
-
when 50 then :owner
|
13
|
-
when 60 then :admin
|
14
|
-
end
|
26
|
+
HUMAN_ACCESS_LEVELS[level]
|
15
27
|
end
|
16
28
|
|
17
29
|
def machine_access_level(level = :developer)
|
18
|
-
|
19
|
-
when :none then 0
|
20
|
-
when :guest then 10
|
21
|
-
when :reporter then 20
|
22
|
-
when :developer then 30
|
23
|
-
when :maintainer then 40
|
24
|
-
when :owner then 50
|
25
|
-
when :admin then 60
|
26
|
-
end
|
30
|
+
MACHINE_ACCESS_LEVELS[level]
|
27
31
|
end
|
28
32
|
|
29
33
|
def machine_protected_access_level(level = :developer)
|
30
|
-
|
31
|
-
when :none then 0
|
32
|
-
when :developer then 30
|
33
|
-
when :maintainer then 40
|
34
|
-
when :admin then 60
|
35
|
-
end
|
34
|
+
MACHINE_ACCESS_LEVELS[level]
|
36
35
|
end
|
37
36
|
|
38
37
|
def human_protected_access_level(level = 10)
|
39
|
-
|
40
|
-
when 0 then :none
|
41
|
-
when 30 then :developer
|
42
|
-
when 40 then :maintainer
|
43
|
-
when 60 then :admin
|
44
|
-
end
|
38
|
+
HUMAN_ACCESS_LEVELS[level]
|
45
39
|
end
|
46
40
|
end
|
47
41
|
end
|
@@ -11,5 +11,30 @@ module LabClient
|
|
11
11
|
def commit
|
12
12
|
Commit.new(@table[:commit], response, client)
|
13
13
|
end
|
14
|
+
|
15
|
+
def pipelines
|
16
|
+
project_id = collect_project_id
|
17
|
+
client.pipelines.list(project_id, ref: name)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Wait for Import / Set a Hard Limit
|
21
|
+
def wait_for_pipelines(total_time = 300, sleep_time = 15)
|
22
|
+
Timeout.timeout(total_time) do
|
23
|
+
loop do
|
24
|
+
reload
|
25
|
+
puts 'Waiting for Pipelines'
|
26
|
+
break unless pipelines.empty?
|
27
|
+
|
28
|
+
sleep sleep_time
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
help do
|
34
|
+
subtitle 'Branch'
|
35
|
+
option 'commit', 'Show Commit information for branch'
|
36
|
+
option 'pipelines', 'Show Pipelines for this Branch/Ref'
|
37
|
+
option 'wait_for_pipelines', 'Looping, on newly created branches, wait for pipelines to populate (not finish) [Timeout, Interval]'
|
38
|
+
end
|
14
39
|
end
|
15
40
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class Branches < Common
|
5
|
+
doc 'Create' do
|
6
|
+
desc 'Get a list of repository branches from a project, sorted by name alphabetically. [Project ID, String]'
|
7
|
+
example 'client.branches.create(264, branch: :branch, ref: :master)'
|
8
|
+
result '[#<Branch name: feature>, #<Branch name: master>]'
|
9
|
+
|
10
|
+
markdown <<~DOC
|
11
|
+
| Attribute | Type | Required | Description |
|
12
|
+
|----------|--------|---------|-------------------------------------------------------------------------------------------------------------|
|
13
|
+
| id | integer | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
|
14
|
+
| branch | string | yes | Name of the branch. |
|
15
|
+
| ref | string | yes | Branch name or commit SHA to create branch from. |
|
16
|
+
DOC
|
17
|
+
end
|
18
|
+
|
19
|
+
doc 'Create' do
|
20
|
+
desc 'via Project'
|
21
|
+
example <<~DOC
|
22
|
+
project = client.projects.show(264)
|
23
|
+
project.branch_create(branch: :branch, ref: :master)
|
24
|
+
DOC
|
25
|
+
end
|
26
|
+
|
27
|
+
def create(project_id, query)
|
28
|
+
project_id = format_id(project_id)
|
29
|
+
|
30
|
+
client.request(:post, "projects/#{project_id}/repository/branches", Branch, query)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/labclient/client.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Top Namespace
|
2
2
|
module LabClient
|
3
3
|
# API Specifics
|
4
|
+
# rubocop:disable Metrics/ClassLength
|
4
5
|
class Client
|
5
6
|
# include HTTParty
|
6
7
|
attr_accessor :settings, :resp, :klass, :link, :http
|
@@ -55,6 +56,7 @@ module LabClient
|
|
55
56
|
project_runners: ProjectRunners,
|
56
57
|
projects: Projects,
|
57
58
|
protected_branches: ProtectedBranches,
|
59
|
+
protected_environments: ProtectedEnvironments,
|
58
60
|
protected_tags: ProtectedTags,
|
59
61
|
registry: Registry,
|
60
62
|
repo: Repositories,
|
@@ -91,27 +93,64 @@ module LabClient
|
|
91
93
|
end
|
92
94
|
|
93
95
|
# Default setup, pull in settings
|
94
|
-
def initialize(
|
95
|
-
@settings =
|
96
|
+
def initialize(user_settings = nil)
|
97
|
+
@settings = user_settings
|
98
|
+
setup_profile if user_settings&.key?(:profile) || ENV['LABCLIENT_PROFILE']
|
96
99
|
@settings ||= fill_configuration
|
97
100
|
|
98
101
|
# Set Unspecified Defaults
|
99
102
|
unspecified_defaults
|
100
103
|
|
101
|
-
|
104
|
+
prompt_for_url if @settings[:url].blank?
|
105
|
+
|
106
|
+
# Only prompt if explicitly set to nil
|
107
|
+
prompt_for_token if @settings[:token].nil?
|
102
108
|
|
103
109
|
self.http = HTTP.new(@settings)
|
104
110
|
end
|
105
111
|
|
112
|
+
def prompt_for_url
|
113
|
+
print 'Enter GitLab URL (e.g. https://gitlab.com): '
|
114
|
+
@settings[:url] = $stdin.gets.chomp
|
115
|
+
raise 'LabClient Error - Missing URL!' if @settings[:url].blank?
|
116
|
+
end
|
117
|
+
|
118
|
+
def prompt_for_token
|
119
|
+
print 'Enter Personal Access Token: '
|
120
|
+
@settings[:token] = $stdin.gets.chomp
|
121
|
+
end
|
122
|
+
|
106
123
|
def unspecified_defaults
|
107
124
|
@settings[:paginate] = true if @settings[:paginate].nil?
|
108
125
|
@settings[:ssl_verify] = true if @settings[:ssl_verify].nil?
|
126
|
+
@settings[:quiet] = false if @settings[:quiet].nil?
|
109
127
|
end
|
110
128
|
|
111
129
|
def home_file
|
112
|
-
ENV['HOME']
|
130
|
+
"#{ENV['HOME']}/.gitlab-labclient"
|
131
|
+
end
|
132
|
+
|
133
|
+
# Easier Profile Name Access
|
134
|
+
def profile
|
135
|
+
if settings&.key? :profile
|
136
|
+
settings[:profile].to_sym
|
137
|
+
else
|
138
|
+
ENV['LABCLIENT_PROFILE'].to_sym
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Support for Named Profiles
|
143
|
+
def setup_profile
|
144
|
+
return false unless File.exist? home_file
|
145
|
+
|
146
|
+
config = Oj.load_file(home_file, { symbol_keys: true })
|
147
|
+
return false unless config.key? profile
|
148
|
+
|
149
|
+
self.settings ||= {}
|
150
|
+
settings.merge! config[profile]
|
113
151
|
end
|
114
152
|
|
153
|
+
# Load default profile
|
115
154
|
def fill_configuration
|
116
155
|
if File.exist? home_file
|
117
156
|
Oj.load_file(home_file, { symbol_keys: true })
|
@@ -135,14 +174,14 @@ module LabClient
|
|
135
174
|
|
136
175
|
process resp
|
137
176
|
rescue LabClient::Error => e
|
138
|
-
puts e.message
|
177
|
+
puts e.message unless settings[:quiet]
|
139
178
|
resp
|
140
179
|
end
|
141
180
|
|
142
|
-
# Assume we want
|
181
|
+
# Assume we want LabStruct if @klass is ever nil
|
143
182
|
def process(resp)
|
144
183
|
case resp.data
|
145
|
-
when
|
184
|
+
when LabStruct
|
146
185
|
klass ? klass.new(resp.data, resp, self) : resp.data
|
147
186
|
when Array
|
148
187
|
if @klass.nil?
|
@@ -155,4 +194,5 @@ module LabClient
|
|
155
194
|
end
|
156
195
|
end
|
157
196
|
end
|
197
|
+
# rubocop:enable Metrics/ClassLength
|
158
198
|
end
|
@@ -16,10 +16,19 @@ module LabClient
|
|
16
16
|
DOC
|
17
17
|
end
|
18
18
|
|
19
|
+
doc 'Show' do
|
20
|
+
desc 'Via Project'
|
21
|
+
example <<~DOC
|
22
|
+
project = client.projects.show(16)
|
23
|
+
project.commit("b539e5d3")
|
24
|
+
DOC
|
25
|
+
end
|
26
|
+
|
19
27
|
# Show
|
20
|
-
def show(project_id, commit_id)
|
28
|
+
def show(project_id, commit_id, query = {})
|
21
29
|
project_id = format_id(project_id)
|
22
|
-
|
30
|
+
|
31
|
+
client.request(:get, "projects/#{project_id}/repository/commits/#{commit_id}", Commit, query)
|
23
32
|
end
|
24
33
|
end
|
25
34
|
end
|
data/lib/labclient/docs.rb
CHANGED
@@ -26,11 +26,11 @@ module LabClient
|
|
26
26
|
# ---------------------------------
|
27
27
|
|
28
28
|
# Klass Helper
|
29
|
-
def help
|
29
|
+
def help(&block)
|
30
30
|
# require 'active_support/inflector'
|
31
31
|
@group_name ||= group_name.pluralize
|
32
32
|
doc 'Reference' do
|
33
|
-
|
33
|
+
block.call
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -50,10 +50,14 @@ module LabClient
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def desc(value)
|
53
|
-
# @result[:desc] = simple_format value
|
54
53
|
@result[:desc] = value
|
55
54
|
end
|
56
55
|
|
56
|
+
def demo(value)
|
57
|
+
@result[:demo_url] = "https://asciinema.org/a/#{value}.js"
|
58
|
+
@result[:demo] = "<script id='asciicast-#{value}' src='#{@result[:demo_url]}' data-autoplay='true' data-loop='true' async></script>"
|
59
|
+
end
|
60
|
+
|
57
61
|
def example(value)
|
58
62
|
@result[:example] = value
|
59
63
|
end
|
@@ -81,10 +85,10 @@ module LabClient
|
|
81
85
|
subnav = subgroup.gsub(' ', '_')
|
82
86
|
|
83
87
|
# Title
|
84
|
-
subnav +=
|
88
|
+
subnav += "_#{@result[:title].gsub(' ', '_')}" if @result.key? :title
|
85
89
|
|
86
90
|
@result[:nav] = nav
|
87
|
-
@result[:nav] +=
|
91
|
+
@result[:nav] += "-#{subnav}" if subnav
|
88
92
|
end
|
89
93
|
|
90
94
|
def doc(subgroup)
|
data/lib/labclient/epics/epic.rb
CHANGED
@@ -51,6 +51,15 @@ module LabClient
|
|
51
51
|
client.resource_labels.epics.show(group_id, id, resource_event_id)
|
52
52
|
end
|
53
53
|
|
54
|
+
# Notes
|
55
|
+
def notes
|
56
|
+
client.notes.epics.list(group_id, iid)
|
57
|
+
end
|
58
|
+
|
59
|
+
def note_create(query)
|
60
|
+
client.notes.epics.create(group_id, iid, query)
|
61
|
+
end
|
62
|
+
|
54
63
|
date_time_attrs %i[created_at closed_at updated_at]
|
55
64
|
|
56
65
|
help do
|
@@ -64,6 +73,10 @@ module LabClient
|
|
64
73
|
option 'issue_remove', 'Remove issue from Epic [Epic Issue ID]'
|
65
74
|
option 'issue_update', 'Update issue association [Epic Issue ID, Hash]'
|
66
75
|
|
76
|
+
# Notes
|
77
|
+
option 'notes', 'List notes/comments. [Hash]'
|
78
|
+
option 'note_create', 'Creates a new note. [Hash]'
|
79
|
+
|
67
80
|
# Resource Labels
|
68
81
|
option 'resource_labels', 'List of all label events'
|
69
82
|
option 'resource_label', 'Show single label event [Resource Event ID]'
|
data/lib/labclient/error.rb
CHANGED
@@ -16,15 +16,18 @@ module LabClient
|
|
16
16
|
result '{:file_path=>"new.md", :branch=>"master"}'
|
17
17
|
|
18
18
|
markdown <<~DOC
|
19
|
-
|
19
|
+
Parameters
|
20
|
+
|
21
|
+
| **Attribute** | **Required** | **Description** |
|
22
|
+
| -------------- | ------------ | ----------------------------------------------- |
|
23
|
+
| branch | yes | Name of the branch |
|
24
|
+
| content | yes | File content |
|
25
|
+
| start_branch | no | Name of the branch to start the new commit from |
|
26
|
+
| encoding | no | Change encoding to ‘base64’. Default is text. |
|
27
|
+
| author_email | no | Specify the commit author’s email address |
|
28
|
+
| author_name | no | Specify the commit author’s name |
|
29
|
+
| commit_message | no | Commit message |
|
20
30
|
|
21
|
-
* branch (required) - Name of the branch
|
22
|
-
* start_branch (optional) - Name of the branch to start the new commit from
|
23
|
-
* encoding (optional) - Change encoding to ‘base64’. Default is text.
|
24
|
-
* author_email (optional) - Specify the commit author’s email address
|
25
|
-
* author_name (optional) - Specify the commit author’s name
|
26
|
-
* content (required) - File content
|
27
|
-
* commit_message (required) - Commit message
|
28
31
|
|
29
32
|
DOC
|
30
33
|
end
|
@@ -43,6 +46,9 @@ module LabClient
|
|
43
46
|
def create(project_id, file_path, query)
|
44
47
|
project_id = format_id(project_id)
|
45
48
|
|
49
|
+
# Path Name Encoding
|
50
|
+
file_path = CGI.escape(file_path)
|
51
|
+
|
46
52
|
client.request(:post, "projects/#{project_id}/repository/files/#{file_path}", nil, query)
|
47
53
|
end
|
48
54
|
end
|