stage-ruby 0.0.02

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.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +73 -0
  4. data/README.md +143 -0
  5. data/Rakefile +8 -0
  6. data/docs/AccessFeatureForm.md +8 -0
  7. data/docs/AccessForm.md +9 -0
  8. data/docs/ClientUserForm.md +7 -0
  9. data/docs/ClientUserObjectForm.md +13 -0
  10. data/docs/Field.md +8 -0
  11. data/docs/StageApi.md +167 -0
  12. data/docs/StageError.md +11 -0
  13. data/example.rb +41 -0
  14. data/git_push.sh +55 -0
  15. data/lib/stage-ruby/api/stage_api.rb +232 -0
  16. data/lib/stage-ruby/api_client.rb +388 -0
  17. data/lib/stage-ruby/api_error.rb +57 -0
  18. data/lib/stage-ruby/configuration.rb +205 -0
  19. data/lib/stage-ruby/models/access_feature_form.rb +227 -0
  20. data/lib/stage-ruby/models/access_form.rb +246 -0
  21. data/lib/stage-ruby/models/client_user_form.rb +209 -0
  22. data/lib/stage-ruby/models/client_user_object_form.rb +267 -0
  23. data/lib/stage-ruby/models/field.rb +217 -0
  24. data/lib/stage-ruby/models/stage_error.rb +245 -0
  25. data/lib/stage-ruby/utils.rb +13 -0
  26. data/lib/stage-ruby/version.rb +14 -0
  27. data/lib/stage-ruby.rb +45 -0
  28. data/spec/api/stage_api_spec.rb +69 -0
  29. data/spec/api_client_spec.rb +225 -0
  30. data/spec/base_object_spec.rb +109 -0
  31. data/spec/configuration_spec.rb +41 -0
  32. data/spec/models/access_feature_form_spec.rb +46 -0
  33. data/spec/models/access_form_spec.rb +52 -0
  34. data/spec/models/client_user_form_spec.rb +40 -0
  35. data/spec/models/client_user_object_form_spec.rb +76 -0
  36. data/spec/models/field_spec.rb +46 -0
  37. data/spec/models/stage_error_spec.rb +64 -0
  38. data/spec/spec_helper.rb +110 -0
  39. data/stage-ruby.gemspec +38 -0
  40. metadata +152 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5fca366a510de64357d0fe5b697797ea9ce0915fbde30e1cbff1c5c0a131a311
4
+ data.tar.gz: de34dfc043afd1b479f595536a34de81f8bde868e62aa32e7942f2a5980089b0
5
+ SHA512:
6
+ metadata.gz: 693fae7376e6b09005bc78d00d03450fb1e427a15ed066a562000ddcc244bbe2b9a72c6bd2f44930acbec084d64ebbfa74e9a0b40d07fef6db6a72c1bde0408b
7
+ data.tar.gz: 28fa37e7a9be6100109ea9b570346a28a5a096450525d742afcc5cfb8d7b42c109773a6090574fb79dead0536ac542315fc64ce5f6a7313ea9b4e5646929b32f
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 1.29.0'
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,73 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stage-ruby (0.0.01)
5
+ json (~> 2.1, >= 2.1.0)
6
+ typhoeus (~> 1.0, >= 1.0.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ byebug (11.1.3)
13
+ coderay (1.1.3)
14
+ diff-lcs (1.5.0)
15
+ ethon (0.15.0)
16
+ ffi (>= 1.15.0)
17
+ ffi (1.15.5)
18
+ json (2.6.1)
19
+ method_source (1.0.0)
20
+ parallel (1.22.1)
21
+ parser (3.1.2.0)
22
+ ast (~> 2.4.1)
23
+ pry (0.13.1)
24
+ coderay (~> 1.1)
25
+ method_source (~> 1.0)
26
+ pry-byebug (3.9.0)
27
+ byebug (~> 11.0)
28
+ pry (~> 0.13.0)
29
+ rainbow (3.1.1)
30
+ rake (13.0.6)
31
+ regexp_parser (2.4.0)
32
+ rexml (3.2.5)
33
+ rspec (3.11.0)
34
+ rspec-core (~> 3.11.0)
35
+ rspec-expectations (~> 3.11.0)
36
+ rspec-mocks (~> 3.11.0)
37
+ rspec-core (3.11.0)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-expectations (3.11.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-mocks (3.11.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-support (3.11.0)
46
+ rubocop (1.29.0)
47
+ parallel (~> 1.10)
48
+ parser (>= 3.1.0.0)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ regexp_parser (>= 1.8, < 3.0)
51
+ rexml (>= 3.2.5, < 4.0)
52
+ rubocop-ast (>= 1.17.0, < 2.0)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (>= 1.4.0, < 3.0)
55
+ rubocop-ast (1.17.0)
56
+ parser (>= 3.1.1.0)
57
+ ruby-progressbar (1.11.0)
58
+ typhoeus (1.4.0)
59
+ ethon (>= 0.9.0)
60
+ unicode-display_width (2.1.0)
61
+
62
+ PLATFORMS
63
+ arm64-darwin-21
64
+
65
+ DEPENDENCIES
66
+ pry-byebug
67
+ rake (~> 13.0.1)
68
+ rspec (~> 3.6, >= 3.6.0)
69
+ rubocop (~> 1.29.0)
70
+ stage-ruby!
71
+
72
+ BUNDLED WITH
73
+ 2.2.3
data/README.md ADDED
@@ -0,0 +1,143 @@
1
+ # stage-ruby
2
+
3
+ Stage - the Ruby gem for the Stage API Docs
4
+
5
+ Stage Technologies, Inc. complete API Documentation
6
+
7
+ This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
+
9
+ - API version: 1.0.0
10
+ - `stage-ruby`'s package version: 0.0.01
11
+ - Build package: io.swagger.codegen.v3.generators.ruby.RubyClientCodegen
12
+
13
+ For more information, please visit [https://heystage.com](https://heystage.com)
14
+
15
+ ## 1. Installation
16
+
17
+ ### 1.1. Install RVM, Ruby, and Gemsets
18
+
19
+ 1. Install [RVM](http://rvm.io/):
20
+
21
+ ```shell
22
+ gpg --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
23
+ \curl -sSL https://get.rvm.io | bash -s stable
24
+ source ~/.rvm/scripts/rvm
25
+ ```
26
+
27
+ 2. Install Ruby, and create a gemset:
28
+
29
+ ```shell
30
+ rvm list known
31
+ rvm install 3.0.0
32
+ rvm use 3.0.0
33
+
34
+ rvm gemset list
35
+ rvm 3.0.0@stage-ruby --create
36
+ ```
37
+
38
+ From here on, you can activate ruby version 3.0.0 and the `stage-ruby` gemset by running the following:
39
+
40
+ ```shell
41
+ rvm use 3.0.0@stage-ruby
42
+ ```
43
+
44
+ 3. Install dependencies:
45
+
46
+ ```shell
47
+ bundle install
48
+ ```
49
+
50
+ ### 1.2. Build Gem and Install Locally
51
+
52
+ 1. Build Ruby code into a gem:
53
+
54
+ ```shell
55
+ gem build stage-ruby.gemspec
56
+ ```
57
+
58
+ 2. Install the gem locally, where `{VERSION}` is the gem's version number:
59
+
60
+ ```shell
61
+ gem install ./stage-ruby-{VERSION}.gem
62
+ ```
63
+
64
+ ## 2. Using `stage-ruby` Gem
65
+
66
+ To use a locally installed `stage-ruby` gem, add the following to your project's Gemfile, where `{GEM_DIR}` is your
67
+ local gem installation directory (run `rvm gemdir` to find out):
68
+
69
+ ```shell
70
+ gem 'stage-ruby', "~> 0.0.01", :path => '{GEM_DIR}'
71
+ ```
72
+
73
+ To use the `stage-ruby` that's uploaded to a gem service, add the following to your project's Gemfile, where `{VERSION}`
74
+ is the gem's version number:
75
+
76
+ ```
77
+ gem 'stage-ruby', '~> {VERSION}'
78
+ ```
79
+
80
+ ### 3. Including `stage-ruby` Code Directly
81
+
82
+ To run a script that depends on `stage-ruby`'s code in `/lib`, run the following:
83
+
84
+ ```shell
85
+ ruby -Ilib script.rb
86
+ ```
87
+
88
+ ## 3. Getting Started
89
+
90
+ Please follow the [installation](#installation) procedure, and then run the following code:
91
+
92
+ ```ruby
93
+ require 'stage-ruby'
94
+
95
+ Stage.configure do |config|
96
+ config.host = 'localhost:8080'
97
+ config.api_key['Authorization'] = 'YOUR_API_KEY'
98
+ config.api_key_prefix['Authorization'] = 'stage-api-token'
99
+ end
100
+
101
+ api_instance = Stage::StageApi.new
102
+
103
+ begin
104
+ user_identifier = 'joe@heystage.com'
105
+ new_user = api_instance.create_user(user_identifier, feature_identifier: 'BASIC_PLAN')
106
+ p "Created user: #{new_user}"
107
+
108
+ result = api_instance.has_access(user_identifier, feature_identifier: 'BASIC_PLAN')
109
+ p "User #{user_identifier} has access to plan: #{result}"
110
+
111
+ updated_user = api_instance.update_user_plan(user_identifier, feature_identifier: 'PRO_PLAN')
112
+ p "Updated user: #{updated_user}"
113
+
114
+ rescue Stage::ApiError => e
115
+ puts "Exception caught: #{e}"
116
+ end
117
+ ```
118
+
119
+ ## 4. Documentation for API Endpoints
120
+
121
+ | Class | Method | HTTP request | Description |
122
+ |-------------------|-----------------------------------------------------------|-----------------------------------------------------|--------------------------------------------------------|
123
+ | *Stage::StageApi* | [**create_user**](docs/StageApi.md#create_user) | **POST** /sdk-api/v1/users | Creates a user and assigning it to a pre-defined role. |
124
+ | *Stage::StageApi* | [**has_access**](docs/StageApi.md#has_access) | **GET** /sdk-api/v1/users/{userIdentifier}/features | Checks if a user has access to the identified feature. |
125
+ | *Stage::StageApi* | [**update_user_plan**](docs/StageApi.md#update_user_plan) | **PUT** /sdk-api/v1/users/{userIdentifier}/plans | Updates a user's plan.. |
126
+
127
+ ## 5. Documentation for Models
128
+
129
+ - [Stage::AccessFeatureForm](docs/AccessFeatureForm.md)
130
+ - [Stage::AccessForm](docs/AccessForm.md)
131
+ - [Stage::ClientUserForm](docs/ClientUserForm.md)
132
+ - [Stage::ClientUserObjectForm](docs/ClientUserObjectForm.md)
133
+ - [Stage::Field](docs/Field.md)
134
+ - [Stage::StageError](docs/StageError.md)
135
+
136
+ ## 6. Documentation for Authorization
137
+
138
+ ### stage-api-token
139
+
140
+ - **Type**: API key
141
+ - **API key parameter name**: Authorization
142
+ - **Location**: HTTP header
143
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
6
+ rescue LoadError
7
+ # no rspec available
8
+ end
@@ -0,0 +1,8 @@
1
+ # Stage::AccessFeatureForm
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **has_access** | **BOOLEAN** | A boolean value indicating whether the identified user has access to the feature or not. |
7
+ **identifier** | **String** | The feature identifier. |
8
+
@@ -0,0 +1,9 @@
1
+ # Stage::AccessForm
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **errors** | [**Array&lt;StageError&gt;**](StageError.md) | The list of any errors. |
7
+ **features** | [**Array&lt;AccessFeatureForm&gt;**](AccessFeatureForm.md) | The list of features. |
8
+ **user_identifier** | **String** | The user identifier. |
9
+
@@ -0,0 +1,7 @@
1
+ # Stage::ClientUserForm
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **client_users** | [**Array&lt;ClientUserObjectForm&gt;**](ClientUserObjectForm.md) | A list of client users. | [optional]
7
+
@@ -0,0 +1,13 @@
1
+ # Stage::ClientUserObjectForm
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **arena_id** | **Integer** | The Arena ID of the client user. | [optional]
7
+ **created_at** | **DateTime** | The creation date. | [optional]
8
+ **deleted** | **BOOLEAN** | A boolean value indicating whether the client user is deleted or not. | [optional]
9
+ **id** | **Integer** | The ID of the client user. | [optional]
10
+ **identifier** | **String** | A client user identifier. | [optional]
11
+ **plan_id** | **Integer** | The plan to be assigned to the client user. | [optional]
12
+ **plan_identifier** | **String** | The plan to be assigned to the user. | [optional]
13
+
data/docs/Field.md ADDED
@@ -0,0 +1,8 @@
1
+ # Stage::Field
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **name** | **String** | The name of the field causing the error. | [optional]
7
+ **value** | **String** | The value of the field causing the error. | [optional]
8
+
data/docs/StageApi.md ADDED
@@ -0,0 +1,167 @@
1
+ # Stage::StageApi
2
+
3
+ All URIs are relative to *//localhost:8080/*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**create_user**](StageApi.md#create_user) | **POST** /sdk-api/v1/users | Creates a user and assigning it to a pre-defined role.
8
+ [**has_access**](StageApi.md#has_access) | **GET** /sdk-api/v1/users/{userIdentifier}/features | Checks if a user has access to the identified feature.
9
+ [**update_user_plan**](StageApi.md#update_user_plan) | **PUT** /sdk-api/v1/users/{userIdentifier}/plans | Updates a user&#x27;s plan..
10
+
11
+ # **create_user**
12
+ > ClientUserForm create_user(body)
13
+
14
+ Creates a user and assigning it to a pre-defined role.
15
+
16
+ ### Example
17
+ ```ruby
18
+ # load the gem
19
+ require 'stage-ruby'
20
+ # setup authorization
21
+ Stage.configure do |config|
22
+ # Configure API key authorization: stage-api-token
23
+ config.api_key['Authorization'] = 'YOUR API KEY'
24
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
25
+ #config.api_key_prefix['Authorization'] = 'Bearer'
26
+ end
27
+
28
+ api_instance = Stage::StageApi.new
29
+ body = Stage::ClientUserForm.new # ClientUserForm | The payload containing the information to create a user.
30
+
31
+
32
+ begin
33
+ #Creates a user and assigning it to a pre-defined role.
34
+ result = api_instance.create_user(body)
35
+ p result
36
+ rescue Stage::ApiError => e
37
+ puts "Exception when calling StageApi->create_user: #{e}"
38
+ end
39
+ ```
40
+
41
+ ### Parameters
42
+
43
+ Name | Type | Description | Notes
44
+ ------------- | ------------- | ------------- | -------------
45
+ **body** | [**ClientUserForm**](ClientUserForm.md)| The payload containing the information to create a user. |
46
+
47
+ ### Return type
48
+
49
+ [**ClientUserForm**](ClientUserForm.md)
50
+
51
+ ### Authorization
52
+
53
+ [stage-api-token](../README.md#stage-api-token)
54
+
55
+ ### HTTP request headers
56
+
57
+ - **Content-Type**: application/json
58
+ - **Accept**: application/json
59
+
60
+
61
+
62
+ # **has_access**
63
+ > AccessForm has_access(identifiers, user_identifier)
64
+
65
+ Checks if a user has access to the identified feature.
66
+
67
+ ### Example
68
+ ```ruby
69
+ # load the gem
70
+ require 'stage-ruby'
71
+ # setup authorization
72
+ Stage.configure do |config|
73
+ # Configure API key authorization: stage-api-token
74
+ config.api_key['Authorization'] = 'YOUR API KEY'
75
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
76
+ #config.api_key_prefix['Authorization'] = 'Bearer'
77
+ end
78
+
79
+ api_instance = Stage::StageApi.new
80
+ identifiers = ['identifiers_example'] # Array<String> | identifiers
81
+ user_identifier = 'user_identifier_example' # String | The identifier of the user who is accessing the feature.
82
+
83
+
84
+ begin
85
+ #Checks if a user has access to the identified feature.
86
+ result = api_instance.has_access(identifiers, user_identifier)
87
+ p result
88
+ rescue Stage::ApiError => e
89
+ puts "Exception when calling StageApi->has_access: #{e}"
90
+ end
91
+ ```
92
+
93
+ ### Parameters
94
+
95
+ Name | Type | Description | Notes
96
+ ------------- | ------------- | ------------- | -------------
97
+ **identifiers** | [**Array&lt;String&gt;**](String.md)| identifiers |
98
+ **user_identifier** | **String**| The identifier of the user who is accessing the feature. |
99
+
100
+ ### Return type
101
+
102
+ [**AccessForm**](AccessForm.md)
103
+
104
+ ### Authorization
105
+
106
+ [stage-api-token](../README.md#stage-api-token)
107
+
108
+ ### HTTP request headers
109
+
110
+ - **Content-Type**: Not defined
111
+ - **Accept**: application/json
112
+
113
+
114
+
115
+ # **update_user_plan**
116
+ > ClientUserForm update_user_plan(bodyuser_identifier)
117
+
118
+ Updates a user's plan..
119
+
120
+ ### Example
121
+ ```ruby
122
+ # load the gem
123
+ require 'stage-ruby'
124
+ # setup authorization
125
+ Stage.configure do |config|
126
+ # Configure API key authorization: stage-api-token
127
+ config.api_key['Authorization'] = 'YOUR API KEY'
128
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
129
+ #config.api_key_prefix['Authorization'] = 'Bearer'
130
+ end
131
+
132
+ api_instance = Stage::StageApi.new
133
+ body = Stage::ClientUserForm.new # ClientUserForm | The payload containing the information to update a user's plan. Only identifier and planIdentifier fields are required.
134
+ user_identifier = 'user_identifier_example' # String | The identifier of the user.
135
+
136
+
137
+ begin
138
+ #Updates a user's plan..
139
+ result = api_instance.update_user_plan(bodyuser_identifier)
140
+ p result
141
+ rescue Stage::ApiError => e
142
+ puts "Exception when calling StageApi->update_user_plan: #{e}"
143
+ end
144
+ ```
145
+
146
+ ### Parameters
147
+
148
+ Name | Type | Description | Notes
149
+ ------------- | ------------- | ------------- | -------------
150
+ **body** | [**ClientUserForm**](ClientUserForm.md)| The payload containing the information to update a user&#x27;s plan. Only identifier and planIdentifier fields are required. |
151
+ **user_identifier** | **String**| The identifier of the user. |
152
+
153
+ ### Return type
154
+
155
+ [**ClientUserForm**](ClientUserForm.md)
156
+
157
+ ### Authorization
158
+
159
+ [stage-api-token](../README.md#stage-api-token)
160
+
161
+ ### HTTP request headers
162
+
163
+ - **Content-Type**: application/json
164
+ - **Accept**: application/json
165
+
166
+
167
+
@@ -0,0 +1,11 @@
1
+ # Stage::StageError
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **error** | **String** | The string representation of the HTTP status. | [optional]
7
+ **field** | [**Field**](Field.md) | | [optional]
8
+ **message** | **String** | Additional error messages. | [optional]
9
+ **status** | **Integer** | The HTTP status of this request. | [optional]
10
+ **timestamp** | **Integer** | | [optional]
11
+
data/example.rb ADDED
@@ -0,0 +1,41 @@
1
+ require 'stage-ruby'
2
+
3
+ Stage.configure do |config|
4
+ config.host = 'localhost:8080'
5
+ config.api_key['Authorization'] = 'fakestageapikey'
6
+ config.api_key_prefix['Authorization'] = 'stage-api-token'
7
+ end
8
+
9
+ api_instance = Stage::StageApi.new
10
+ feature_identifier = 'view_arenas'
11
+ feature_identifiers = ['view_arenas', 'edit_arenas']
12
+ user_identifier = 'dennis+1@heystage.com'
13
+
14
+ begin
15
+ p "# has_access_verbose #"
16
+ result = api_instance.has_access_verbose(user_identifier, feature_identifiers)
17
+ p result
18
+
19
+ p "# has_access #"
20
+ result = api_instance.has_access(user_identifier, feature_identifier)
21
+ p result
22
+
23
+ p "# has_access_to_any #"
24
+ result = api_instance.has_access_to_any(user_identifier, feature_identifiers)
25
+ p result
26
+
27
+ p "# has_access_to_all #"
28
+ result = api_instance.has_access_to_all(user_identifier, feature_identifiers)
29
+ p result
30
+
31
+ p "# update_user_plan #"
32
+ # result = api_instance.update_user_plan(user_identifier, '3-Arena: no permission')
33
+ result = api_instance.update_user_plan(user_identifier, '5-Arena: edit')
34
+ p result
35
+
36
+ p "# create_user #"
37
+ result = api_instance.create_user('dennis+3@heystage.com', '3-Arena: no permission')
38
+ p result
39
+ rescue Stage::ApiError => e
40
+ puts "Exception when calling StageApi->has_access: #{e}"
41
+ end
data/git_push.sh ADDED
@@ -0,0 +1,55 @@
1
+ #!/bin/sh
2
+ #
3
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
4
+ #
5
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
6
+ #
7
+ # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
8
+
9
+ git_user_id=$1
10
+ git_repo_id=$2
11
+ release_note=$3
12
+
13
+ if [ "$git_user_id" = "" ]; then
14
+ git_user_id="GIT_USER_ID"
15
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
16
+ fi
17
+
18
+ if [ "$git_repo_id" = "" ]; then
19
+ git_repo_id="GIT_REPO_ID"
20
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
21
+ fi
22
+
23
+ if [ "$release_note" = "" ]; then
24
+ release_note="Minor update"
25
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
26
+ fi
27
+
28
+ # Initialize the local directory as a Git repository
29
+ git init
30
+
31
+ # Adds the files in the local repository and stages them for commit.
32
+ git add .
33
+
34
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
35
+ git commit -m "$release_note"
36
+
37
+ # Sets the new remote
38
+ git_remote=`git remote`
39
+ if [ "$git_remote" = "" ]; then # git remote not defined
40
+
41
+ if [ "$GIT_TOKEN" = "" ]; then
42
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
43
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
44
+ else
45
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
46
+ fi
47
+
48
+ fi
49
+
50
+ git pull origin master
51
+
52
+ # Pushes (Forces) the changes in the local repository up to the remote repository
53
+ echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
54
+ git push origin master 2>&1 | grep -v 'To https'
55
+