remocon 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.rubocop.yml +133 -25
- data/.ruby-version +1 -1
- data/.travis.yml +9 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +24 -22
- data/README.md +29 -7
- data/Rakefile +15 -2
- data/bin/console +3 -3
- data/bin/get_access_token +2 -0
- data/bin/get_access_token.py +2 -2
- data/cmd/remocon +1 -1
- data/lib/remocon.rb +46 -45
- data/lib/remocon/cli.rb +27 -15
- data/lib/remocon/command/create_command.rb +16 -16
- data/lib/remocon/command/lib/config.rb +82 -0
- data/lib/remocon/command/lib/interpreter_helper.rb +13 -3
- data/lib/remocon/command/pull_command.rb +34 -35
- data/lib/remocon/command/push_command.rb +27 -28
- data/lib/remocon/command/validate_command.rb +19 -9
- data/lib/remocon/interpreter/condition_file_interpreter.rb +10 -8
- data/lib/remocon/interpreter/parameter_file_interpreter.rb +12 -10
- data/lib/remocon/normalizer/json_normalizer.rb +2 -1
- data/lib/remocon/normalizer/normalizer.rb +1 -1
- data/lib/remocon/sorter/condition_sorter.rb +2 -2
- data/lib/remocon/sorter/parameter_sorter.rb +3 -3
- data/lib/remocon/util/array.rb +2 -2
- data/lib/remocon/util/hash.rb +2 -2
- data/lib/remocon/util/string.rb +1 -1
- data/lib/remocon/version.rb +1 -1
- data/prj/config.json +34 -0
- data/remocon.gemspec +20 -21
- metadata +20 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 58b35965e13809b6a9cb50faf6687db01d97a654
|
4
|
+
data.tar.gz: d08d352a433fb43423893bc481736508e23781c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a3bdf29de030d03e4e6f63a7a6a61f14695d29cd8e4b82d6f2bf2e4042a92860e663125d152a6bd7bbef8671b891b9a741fa6f5b9511a040d98b5bb417e3c5
|
7
|
+
data.tar.gz: 6438d1ccd13cd73c6fee406c411c8dbc0b2018f5f39b39fbf5af3d02abe1483ae6e86fcf6bdc73e113a5761508bc6f97e27e801830ba2e07f336243c70226a2a
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,70 +1,178 @@
|
|
1
|
+
# Defaults can be found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
|
+
|
3
|
+
# If you don't like these settings, just delete this file :)
|
4
|
+
|
1
5
|
AllCops:
|
2
6
|
Exclude:
|
3
|
-
- '*.gemspec'
|
4
7
|
- 'vendor/**/*'
|
5
|
-
- '
|
6
|
-
- '
|
8
|
+
- 'spec/fixtures/**/*'
|
9
|
+
- 'tmp/**/*'
|
10
|
+
TargetRubyVersion: 2.3.7
|
7
11
|
|
8
|
-
|
12
|
+
Metrics/ModuleLength:
|
9
13
|
Exclude:
|
10
14
|
- 'spec/**/*'
|
11
|
-
|
15
|
+
Enabled: true
|
12
16
|
|
13
|
-
|
14
|
-
|
17
|
+
Style/StringLiterals:
|
18
|
+
EnforcedStyle: double_quotes
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
# kind_of? is a good way to check a type
|
22
|
+
Style/ClassCheck:
|
23
|
+
EnforcedStyle: kind_of?
|
24
|
+
|
25
|
+
# It's better to be more explicit about the type
|
26
|
+
Style/BracesAroundHashParameters:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# specs sometimes have useless assignments, which is fine
|
30
|
+
Lint/UselessAssignment:
|
15
31
|
Exclude:
|
16
|
-
-
|
32
|
+
- '**/spec/**/*'
|
33
|
+
|
34
|
+
# We could potentially enable the 2 below:
|
35
|
+
Layout/IndentHash:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Layout/AlignHash:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
# HoundCI doesn't like this rule
|
42
|
+
Layout/DotPosition:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
# We allow !! as it's an easy way to convert ot boolean
|
46
|
+
Style/DoubleNegation:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
# Cop supports --auto-correct.
|
50
|
+
Lint/UnusedBlockArgument:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
# We want to allow class Fastlane::Class
|
54
|
+
Style/ClassAndModuleChildren:
|
55
|
+
Enabled: false
|
17
56
|
|
18
57
|
Metrics/AbcSize:
|
58
|
+
Max: 60
|
59
|
+
|
60
|
+
# The %w might be confusing for new users
|
61
|
+
Style/WordArray:
|
62
|
+
MinSize: 19
|
63
|
+
|
64
|
+
# raise and fail are both okay
|
65
|
+
Style/SignalException:
|
19
66
|
Enabled: false
|
20
67
|
|
21
|
-
|
68
|
+
# Better too much 'return' than one missing
|
69
|
+
Style/RedundantReturn:
|
22
70
|
Enabled: false
|
23
71
|
|
24
|
-
|
72
|
+
# Having if in the same line might not always be good
|
73
|
+
Style/IfUnlessModifier:
|
25
74
|
Enabled: false
|
26
75
|
|
27
|
-
|
76
|
+
# and and or is okay
|
77
|
+
Style/AndOr:
|
28
78
|
Enabled: false
|
29
79
|
|
30
|
-
|
80
|
+
# Configuration parameters: CountComments.
|
81
|
+
Metrics/ClassLength:
|
82
|
+
Max: 350
|
83
|
+
|
84
|
+
Metrics/CyclomaticComplexity:
|
85
|
+
Max: 17
|
86
|
+
|
87
|
+
# Configuration parameters: AllowURI, URISchemes.
|
88
|
+
Metrics/LineLength:
|
89
|
+
Max: 370
|
90
|
+
|
91
|
+
# Configuration parameters: CountKeywordArgs.
|
92
|
+
Metrics/ParameterLists:
|
93
|
+
Max: 10
|
94
|
+
|
95
|
+
Metrics/PerceivedComplexity:
|
96
|
+
Max: 18
|
97
|
+
|
98
|
+
# Sometimes it's easier to read without guards
|
99
|
+
Style/GuardClause:
|
31
100
|
Enabled: false
|
32
101
|
|
33
|
-
|
102
|
+
# something = if something_else
|
103
|
+
# that's confusing
|
104
|
+
Style/ConditionalAssignment:
|
34
105
|
Enabled: false
|
35
106
|
|
107
|
+
# Better to have too much self than missing a self
|
108
|
+
Style/RedundantSelf:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
Metrics/MethodLength:
|
112
|
+
Max: 60
|
113
|
+
|
114
|
+
# We're not there yet
|
36
115
|
Style/Documentation:
|
37
116
|
Enabled: false
|
38
117
|
|
39
|
-
|
118
|
+
# Adds complexity
|
119
|
+
Style/IfInsideElse:
|
40
120
|
Enabled: false
|
41
121
|
|
42
|
-
|
122
|
+
# danger specific
|
123
|
+
|
124
|
+
Style/BlockComments:
|
43
125
|
Enabled: false
|
44
126
|
|
45
|
-
|
127
|
+
Layout/MultilineMethodCallIndentation:
|
128
|
+
EnforcedStyle: indented
|
129
|
+
|
130
|
+
# FIXME: 25
|
131
|
+
Metrics/BlockLength:
|
132
|
+
Max: 345
|
133
|
+
Exclude:
|
134
|
+
- "**/*_spec.rb"
|
135
|
+
|
136
|
+
Style/MixinGrouping:
|
46
137
|
Enabled: false
|
47
138
|
|
48
|
-
Style/
|
139
|
+
Style/FileName:
|
49
140
|
Enabled: false
|
50
141
|
|
51
|
-
|
142
|
+
Layout/IndentHeredoc:
|
52
143
|
Enabled: false
|
53
144
|
|
54
|
-
Style/
|
145
|
+
Style/SpecialGlobalVars:
|
55
146
|
Enabled: false
|
56
147
|
|
57
|
-
|
58
|
-
|
148
|
+
PercentLiteralDelimiters:
|
149
|
+
PreferredDelimiters:
|
150
|
+
"%": ()
|
151
|
+
"%i": ()
|
152
|
+
"%q": ()
|
153
|
+
"%Q": ()
|
154
|
+
"%r": "{}"
|
155
|
+
"%s": ()
|
156
|
+
"%w": ()
|
157
|
+
"%W": ()
|
158
|
+
"%x": ()
|
59
159
|
|
60
|
-
|
160
|
+
Security/YAMLLoad:
|
61
161
|
Enabled: false
|
62
162
|
|
63
|
-
Style/
|
163
|
+
Style/TrailingCommaInArguments:
|
164
|
+
Enabled: true
|
165
|
+
|
166
|
+
Style/TrailingCommaInArrayLiteral:
|
64
167
|
Enabled: false
|
65
168
|
|
66
|
-
Style/
|
169
|
+
Style/TrailingCommaInHashLiteral:
|
67
170
|
Enabled: false
|
68
171
|
|
69
|
-
|
172
|
+
Naming/HeredocDelimiterNaming:
|
173
|
+
Exclude:
|
174
|
+
- 'vendor/**/*'
|
175
|
+
- 'spec/**/*'
|
176
|
+
|
177
|
+
Security/Open:
|
70
178
|
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.7
|
data/.travis.yml
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
|
+
|
4
|
+
cache:
|
5
|
+
directories: vendor/bundle
|
6
|
+
|
3
7
|
rvm:
|
4
|
-
- 2.
|
8
|
+
- 2.3.7
|
9
|
+
- 2.4.4
|
10
|
+
- 2.5.1
|
11
|
+
|
5
12
|
env:
|
6
13
|
global:
|
7
14
|
- FIREBASE_PROJECT_ID='project_id'
|
8
15
|
- REMOTE_CONFIG_ACCESS_TOKEN='token'
|
9
16
|
before_install: gem install bundler -v 1.16.1
|
10
|
-
install: bundle install --deployment --jobs=4 --retry=3
|
11
|
-
cache:
|
12
|
-
directories: vendor/bundle
|
17
|
+
install: bundle install --deployment --jobs=4 --retry=3 --path=vendor/bundle
|
13
18
|
script: bundle exec rake spec
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,61 +1,63 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
remocon (0.
|
4
|
+
remocon (0.2.0)
|
5
5
|
activesupport
|
6
6
|
thor
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (5.1
|
11
|
+
activesupport (5.2.1)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
-
i18n (
|
13
|
+
i18n (>= 0.7, < 2)
|
14
14
|
minitest (~> 5.1)
|
15
15
|
tzinfo (~> 1.1)
|
16
16
|
ast (2.4.0)
|
17
17
|
coderay (1.1.2)
|
18
18
|
concurrent-ruby (1.0.5)
|
19
19
|
diff-lcs (1.3)
|
20
|
-
i18n (
|
20
|
+
i18n (1.1.0)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
|
+
jaro_winkler (1.5.1)
|
22
23
|
method_source (0.9.0)
|
23
24
|
minitest (5.11.3)
|
24
25
|
parallel (1.12.1)
|
25
|
-
parser (2.5.
|
26
|
+
parser (2.5.1.2)
|
26
27
|
ast (~> 2.4.0)
|
27
|
-
powerpack (0.1.
|
28
|
+
powerpack (0.1.2)
|
28
29
|
pry (0.11.3)
|
29
30
|
coderay (~> 1.1.0)
|
30
31
|
method_source (~> 0.9.0)
|
31
32
|
rainbow (3.0.0)
|
32
33
|
rake (10.5.0)
|
33
|
-
rspec (3.
|
34
|
-
rspec-core (~> 3.
|
35
|
-
rspec-expectations (~> 3.
|
36
|
-
rspec-mocks (~> 3.
|
37
|
-
rspec-core (3.
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-expectations (3.
|
34
|
+
rspec (3.8.0)
|
35
|
+
rspec-core (~> 3.8.0)
|
36
|
+
rspec-expectations (~> 3.8.0)
|
37
|
+
rspec-mocks (~> 3.8.0)
|
38
|
+
rspec-core (3.8.0)
|
39
|
+
rspec-support (~> 3.8.0)
|
40
|
+
rspec-expectations (3.8.1)
|
40
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.
|
42
|
-
rspec-mocks (3.
|
42
|
+
rspec-support (~> 3.8.0)
|
43
|
+
rspec-mocks (3.8.0)
|
43
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.
|
45
|
-
rspec-support (3.
|
46
|
-
rubocop (0.
|
45
|
+
rspec-support (~> 3.8.0)
|
46
|
+
rspec-support (3.8.0)
|
47
|
+
rubocop (0.58.2)
|
48
|
+
jaro_winkler (~> 1.5.1)
|
47
49
|
parallel (~> 1.10)
|
48
|
-
parser (>= 2.5)
|
50
|
+
parser (>= 2.5, != 2.5.1.1)
|
49
51
|
powerpack (~> 0.1)
|
50
52
|
rainbow (>= 2.2.2, < 4.0)
|
51
53
|
ruby-progressbar (~> 1.7)
|
52
54
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
53
|
-
ruby-progressbar (1.
|
55
|
+
ruby-progressbar (1.10.0)
|
54
56
|
thor (0.20.0)
|
55
57
|
thread_safe (0.3.6)
|
56
58
|
tzinfo (1.2.5)
|
57
59
|
thread_safe (~> 0.1)
|
58
|
-
unicode-display_width (1.
|
60
|
+
unicode-display_width (1.4.0)
|
59
61
|
|
60
62
|
PLATFORMS
|
61
63
|
ruby
|
@@ -69,4 +71,4 @@ DEPENDENCIES
|
|
69
71
|
rubocop
|
70
72
|
|
71
73
|
BUNDLED WITH
|
72
|
-
1.16.
|
74
|
+
1.16.3
|
data/README.md
CHANGED
@@ -7,19 +7,27 @@ Conditions and parameters are managed by YAML files.
|
|
7
7
|
|
8
8
|
## Usage
|
9
9
|
|
10
|
-
|
10
|
+
To get an access token, `bin/get_access_token <firebase adminsdk json>` would help you.
|
11
|
+
|
12
|
+
### Get the current configs into your local
|
11
13
|
|
12
14
|
```bash
|
13
|
-
|
14
|
-
export REMOTE_CONFIG_ACCESS_TOKEN='your access token'
|
15
|
+
bundle exec remocon pull --prefix=projects --id=my_project_dev --token=xyz
|
15
16
|
```
|
16
17
|
|
17
|
-
|
18
|
+
Then, you can see `paremeters.yml, conditions.yml, config.json, etag` files in `projects/my_project_dev` directory.
|
19
|
+
If you don't specify `--prefix`, then the command create the files in the working directory
|
20
|
+
|
21
|
+
*Environment variables*
|
22
|
+
|
23
|
+
Some variables can be injected by environment variables.
|
18
24
|
|
19
25
|
```bash
|
20
|
-
|
26
|
+
export REMOCON_FIREBASE_PROJECT_ID=<--id>
|
27
|
+
export REMOCON_FIREBASE_ACCESS_TOKEN=<--token>
|
28
|
+
export REMOCON_PREFIX=<--prefix> # Optional
|
21
29
|
|
22
|
-
|
30
|
+
FIREBASE_PROJECT_ID and REMOTE_CONFIG_ACCESS_TOKEN are supported but they are deprecated now
|
23
31
|
```
|
24
32
|
|
25
33
|
### Edit configs on your local
|
@@ -52,7 +60,17 @@ key1: # key name
|
|
52
60
|
### Update configs on remote
|
53
61
|
|
54
62
|
```bash
|
55
|
-
|
63
|
+
# Create new configs as projects/my_project_dev/config.json
|
64
|
+
bundle exec remocon create --prefix=projects --id=my_project_dev
|
65
|
+
|
66
|
+
# Upload projects/my_project_dev/config.json by using projects/my_project_dev/etag
|
67
|
+
bundle exec remocon push --prefix=projects --id=my_project_dev --token=xyz
|
68
|
+
|
69
|
+
# You can use custom paths for config.json and etag
|
70
|
+
bundle exec remocon push --source=</path/to/config json> --etag=</path/to/etag>
|
71
|
+
|
72
|
+
# Use the fixed etag value
|
73
|
+
bundle exec remocon push --raw_etag=<raw etag value>
|
56
74
|
```
|
57
75
|
|
58
76
|
## Installation
|
@@ -82,6 +100,10 @@ key:
|
|
82
100
|
|
83
101
|
It seems only three fields are supported by Remote Config. They are name, expression and tagColor.
|
84
102
|
|
103
|
+
## Supported Ruby Version
|
104
|
+
|
105
|
+
Not EOL versions. ref https://www.ruby-lang.org/en/downloads/branches/
|
106
|
+
|
85
107
|
## Contributing
|
86
108
|
|
87
109
|
Bug reports and pull requests are welcome on GitHub at https://github.com/jmatsu/remocon .
|
data/Rakefile
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler/gem_tasks"
|
2
4
|
require "rspec/core/rake_task"
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:specs)
|
8
|
+
|
9
|
+
task default: :specs
|
3
10
|
|
4
|
-
|
11
|
+
task :spec do
|
12
|
+
Rake::Task["specs"].invoke
|
13
|
+
Rake::Task["rubocop"].invoke
|
14
|
+
end
|
5
15
|
|
6
|
-
|
16
|
+
desc "Run RuboCop on the lib/specs directory"
|
17
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
18
|
+
task.patterns = ["lib/**/*.rb", "spec/**/*.rb"]
|
19
|
+
end
|
data/bin/console
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "bundler/setup"
|
5
|
+
require "remocon"
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -11,5 +11,5 @@ require 'remocon'
|
|
11
11
|
# require "pry"
|
12
12
|
# Pry.start
|
13
13
|
|
14
|
-
require
|
14
|
+
require "irb"
|
15
15
|
IRB.start(__FILE__)
|