remocon 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/Gemfile.lock +44 -1
- data/README.md +10 -1
- data/lib/remocon/cli.rb +8 -1
- data/lib/remocon/command/get_token_command.rb +34 -0
- data/lib/remocon/command/lib/config.rb +6 -2
- data/lib/remocon/version.rb +1 -1
- data/lib/remocon.rb +3 -0
- data/remocon.gemspec +2 -0
- metadata +31 -3
- data/prj/config.json +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1e9a56ef5554b17a03ae98b922f7e97976febca
|
4
|
+
data.tar.gz: d19f3990a7453ec8bcbf9934260fe0b783645f20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5420808ce826240856509947c16c68de6e3db4795d77d3cf38722b4a2181a7d6be756451ddebd7e8b6c18e9a7fcd53d52ad7376c2fcc272bdbcc22fba0a51d49
|
7
|
+
data.tar.gz: e6b69061bc6093b098b9b1a4aacf588d5de01963e3145042da28b32518846e6fe402ebd88ec8b825b947910a83be7e77c9dc4772f6d63d964efb77988b8c893a
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
remocon (0.
|
4
|
+
remocon (0.3.0)
|
5
5
|
activesupport
|
6
|
+
google-api-client (~> 0.11)
|
7
|
+
googleauth
|
6
8
|
thor
|
7
9
|
|
8
10
|
GEM
|
@@ -13,15 +15,44 @@ GEM
|
|
13
15
|
i18n (>= 0.7, < 2)
|
14
16
|
minitest (~> 5.1)
|
15
17
|
tzinfo (~> 1.1)
|
18
|
+
addressable (2.5.2)
|
19
|
+
public_suffix (>= 2.0.2, < 4.0)
|
16
20
|
ast (2.4.0)
|
17
21
|
coderay (1.1.2)
|
18
22
|
concurrent-ruby (1.0.5)
|
23
|
+
declarative (0.0.10)
|
24
|
+
declarative-option (0.1.0)
|
19
25
|
diff-lcs (1.3)
|
26
|
+
faraday (0.15.2)
|
27
|
+
multipart-post (>= 1.2, < 3)
|
28
|
+
google-api-client (0.23.4)
|
29
|
+
addressable (~> 2.5, >= 2.5.1)
|
30
|
+
googleauth (>= 0.5, < 0.7.0)
|
31
|
+
httpclient (>= 2.8.1, < 3.0)
|
32
|
+
mime-types (~> 3.0)
|
33
|
+
representable (~> 3.0)
|
34
|
+
retriable (>= 2.0, < 4.0)
|
35
|
+
googleauth (0.6.4)
|
36
|
+
faraday (~> 0.12)
|
37
|
+
jwt (>= 1.4, < 3.0)
|
38
|
+
memoist (~> 0.12)
|
39
|
+
multi_json (~> 1.11)
|
40
|
+
os (>= 0.9, < 2.0)
|
41
|
+
signet (~> 0.7)
|
42
|
+
httpclient (2.8.3)
|
20
43
|
i18n (1.1.0)
|
21
44
|
concurrent-ruby (~> 1.0)
|
22
45
|
jaro_winkler (1.5.1)
|
46
|
+
jwt (2.1.0)
|
47
|
+
memoist (0.16.0)
|
23
48
|
method_source (0.9.0)
|
49
|
+
mime-types (3.1)
|
50
|
+
mime-types-data (~> 3.2015)
|
51
|
+
mime-types-data (3.2016.0521)
|
24
52
|
minitest (5.11.3)
|
53
|
+
multi_json (1.13.1)
|
54
|
+
multipart-post (2.0.0)
|
55
|
+
os (1.0.0)
|
25
56
|
parallel (1.12.1)
|
26
57
|
parser (2.5.1.2)
|
27
58
|
ast (~> 2.4.0)
|
@@ -29,8 +60,14 @@ GEM
|
|
29
60
|
pry (0.11.3)
|
30
61
|
coderay (~> 1.1.0)
|
31
62
|
method_source (~> 0.9.0)
|
63
|
+
public_suffix (3.0.2)
|
32
64
|
rainbow (3.0.0)
|
33
65
|
rake (10.5.0)
|
66
|
+
representable (3.0.4)
|
67
|
+
declarative (< 0.1.0)
|
68
|
+
declarative-option (< 0.2.0)
|
69
|
+
uber (< 0.2.0)
|
70
|
+
retriable (3.1.2)
|
34
71
|
rspec (3.8.0)
|
35
72
|
rspec-core (~> 3.8.0)
|
36
73
|
rspec-expectations (~> 3.8.0)
|
@@ -53,10 +90,16 @@ GEM
|
|
53
90
|
ruby-progressbar (~> 1.7)
|
54
91
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
55
92
|
ruby-progressbar (1.10.0)
|
93
|
+
signet (0.8.1)
|
94
|
+
addressable (~> 2.3)
|
95
|
+
faraday (~> 0.9)
|
96
|
+
jwt (>= 1.5, < 3.0)
|
97
|
+
multi_json (~> 1.10)
|
56
98
|
thor (0.20.0)
|
57
99
|
thread_safe (0.3.6)
|
58
100
|
tzinfo (1.2.5)
|
59
101
|
thread_safe (~> 0.1)
|
102
|
+
uber (0.1.0)
|
60
103
|
unicode-display_width (1.4.0)
|
61
104
|
|
62
105
|
PLATFORMS
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/remocon.svg)](https://badge.fury.io/rb/remocon) [![Build Status](https://travis-ci.org/jmatsu/remocon.svg?branch=master)](https://travis-ci.org/jmatsu/remocon)
|
2
|
+
|
1
3
|
# Remocon
|
2
4
|
|
3
5
|
*remocon* is a CLI for Firebase Remote Config via its REST API.
|
@@ -7,7 +9,14 @@ Conditions and parameters are managed by YAML files.
|
|
7
9
|
|
8
10
|
## Usage
|
9
11
|
|
10
|
-
|
12
|
+
### Get your access token
|
13
|
+
|
14
|
+
Since v0.3.0, remocon is supporting to get an access token.
|
15
|
+
*If this doesn't work, then please try `bin/get_access_token <service-acount.json>`.*
|
16
|
+
|
17
|
+
```bash
|
18
|
+
token=$(bundle exec remocon --service-json=<path/to/service-account-json>)
|
19
|
+
```
|
11
20
|
|
12
21
|
### Get the current configs into your local
|
13
22
|
|
data/lib/remocon/cli.rb
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
module Remocon
|
4
4
|
class CLI < ::Thor
|
5
|
+
desc "token", "Get your access token"
|
6
|
+
option :"service-json", type: :string, desc: "a file path to service account json"
|
7
|
+
def token
|
8
|
+
execute(Remocon::Command::GetToken)
|
9
|
+
end
|
10
|
+
|
5
11
|
desc "create", "Create a json to be pushed"
|
6
12
|
option :parameters, type: :string, desc: "Specify the filepath if you want to use a custom parameters file"
|
7
13
|
option :conditions, type: :string, desc: "Specify the filepath if you want to use a custom conditions file"
|
@@ -15,11 +21,12 @@ module Remocon
|
|
15
21
|
desc "push", "Upload remote configs based on a source json file"
|
16
22
|
option :source, type: :string, desc: "the filepath of your config json file"
|
17
23
|
option :etag, type: :string, desc: "the file path of etag"
|
18
|
-
option :
|
24
|
+
option :"raw-etag", type: :string, desc: "the raw value of etag"
|
19
25
|
option :prefix, type: :string, desc: "the directory name which will contain project-related files"
|
20
26
|
option :force, type: :boolean, default: false, desc: "force to ignore some warnings"
|
21
27
|
option :token, type: :string, desc: "access token to your project"
|
22
28
|
option :id, type: :string, desc: "your project id"
|
29
|
+
option :raw_etag, type: :string, hide: true, desc: "[Deprecated] the raw value of etag"
|
23
30
|
option :dest, type: :string, hide: true, desc: "[Deprecated] the same with --prefix"
|
24
31
|
def push
|
25
32
|
execute(Remocon::Command::Push)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Remocon
|
4
|
+
module Command
|
5
|
+
class GetToken
|
6
|
+
attr_reader :config, :cmd_opts
|
7
|
+
|
8
|
+
def initialize(opts)
|
9
|
+
@config = Remocon::Config.new(opts)
|
10
|
+
@cmd_opts = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
validate_options
|
15
|
+
|
16
|
+
authorizer = Google::Auth::ServiceAccountCredentials.make_creds(
|
17
|
+
json_key_io: File.open(config.service_json_file_path),
|
18
|
+
scope: "https://www.googleapis.com/auth/firebase"
|
19
|
+
)
|
20
|
+
|
21
|
+
authorizer.fetch_access_token!
|
22
|
+
STDOUT.puts authorizer.access_token
|
23
|
+
|
24
|
+
authorizer.access_token
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def validate_options
|
30
|
+
raise ValidationError, "a service account json file is not found" if config.service_json_file_path.nil? || !File.exist?(config.service_json_file_path)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -22,6 +22,10 @@ module Remocon
|
|
22
22
|
@endpoint ||= "https://firebaseremoteconfig.googleapis.com/v1/projects/#{project_id}/remoteConfig"
|
23
23
|
end
|
24
24
|
|
25
|
+
def service_json_file_path
|
26
|
+
@service_json_file_path ||= opts[:"service-json"]
|
27
|
+
end
|
28
|
+
|
25
29
|
def project_id
|
26
30
|
# FIREBASE_PROJECT_ID is for backward compatibility
|
27
31
|
@project_id ||= (opts[:id] || ENV[REMOCON_PROJECT_ID_KEY] || ENV["FIREBASE_PROJECT_ID"] || raise("--id or #{REMOCON_PROJECT_ID_KEY} env var is required"))
|
@@ -71,11 +75,11 @@ module Remocon
|
|
71
75
|
|
72
76
|
def etag
|
73
77
|
@etag ||= begin
|
74
|
-
if opts[:force] && opts[:
|
78
|
+
if opts[:force] && opts[:"raw-etag"]
|
75
79
|
raise "--force and --raw_etag cannot be specified"
|
76
80
|
end
|
77
81
|
|
78
|
-
opts[:force] && "*" || opts[:
|
82
|
+
opts[:force] && "*" || opts[:"raw-etag"] || File.exist?(etag_file_path) && File.open(etag_file_path).read
|
79
83
|
end
|
80
84
|
end
|
81
85
|
end
|
data/lib/remocon/version.rb
CHANGED
data/lib/remocon.rb
CHANGED
@@ -9,6 +9,8 @@ require "singleton"
|
|
9
9
|
require "open-uri"
|
10
10
|
require "fileutils"
|
11
11
|
require "net/http"
|
12
|
+
require "googleauth"
|
13
|
+
require "google/apis/compute_v1"
|
12
14
|
|
13
15
|
require "remocon/util/array"
|
14
16
|
require "remocon/util/hash"
|
@@ -41,6 +43,7 @@ require "remocon/command/lib/config"
|
|
41
43
|
require "remocon/command/lib/interpreter_helper"
|
42
44
|
|
43
45
|
require "remocon/command/create_command"
|
46
|
+
require "remocon/command/get_token_command"
|
44
47
|
require "remocon/command/pull_command"
|
45
48
|
require "remocon/command/push_command"
|
46
49
|
require "remocon/command/validate_command"
|
data/remocon.gemspec
CHANGED
@@ -32,6 +32,8 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
34
|
spec.add_dependency "activesupport"
|
35
|
+
spec.add_dependency "google-api-client", "~> 0.11"
|
36
|
+
spec.add_dependency "googleauth"
|
35
37
|
spec.add_dependency "thor"
|
36
38
|
spec.add_development_dependency "bundler", "~> 1.16"
|
37
39
|
spec.add_development_dependency "pry"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remocon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jumpei Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: cmd
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: google-api-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.11'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.11'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: googleauth
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: thor
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +164,7 @@ files:
|
|
136
164
|
- lib/remocon.rb
|
137
165
|
- lib/remocon/cli.rb
|
138
166
|
- lib/remocon/command/create_command.rb
|
167
|
+
- lib/remocon/command/get_token_command.rb
|
139
168
|
- lib/remocon/command/lib/config.rb
|
140
169
|
- lib/remocon/command/lib/interpreter_helper.rb
|
141
170
|
- lib/remocon/command/pull_command.rb
|
@@ -161,7 +190,6 @@ files:
|
|
161
190
|
- lib/remocon/util/hash.rb
|
162
191
|
- lib/remocon/util/string.rb
|
163
192
|
- lib/remocon/version.rb
|
164
|
-
- prj/config.json
|
165
193
|
- remocon.gemspec
|
166
194
|
- sample/basketball-b8548/conditions.yml
|
167
195
|
- sample/basketball-b8548/config.json
|
data/prj/config.json
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"conditions": [
|
3
|
-
{
|
4
|
-
"expression": "device.os == 'ios'",
|
5
|
-
"name": "condition1",
|
6
|
-
"tagColor": "INDIGO"
|
7
|
-
},
|
8
|
-
{
|
9
|
-
"expression": "device.os == 'ios'",
|
10
|
-
"name": "zxczx",
|
11
|
-
"tagColor": "CYAN"
|
12
|
-
}
|
13
|
-
],
|
14
|
-
"parameters": {
|
15
|
-
"key1": {
|
16
|
-
"defaultValue": {
|
17
|
-
"value": "100"
|
18
|
-
},
|
19
|
-
"conditionalValues": {
|
20
|
-
"condition1": {
|
21
|
-
"value": "200"
|
22
|
-
},
|
23
|
-
"zxczx": {
|
24
|
-
"value": "100"
|
25
|
-
}
|
26
|
-
}
|
27
|
-
},
|
28
|
-
"key2": {
|
29
|
-
"defaultValue": {
|
30
|
-
"value": "123"
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|