rbdash 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/lib/rbdash/cli.rb +10 -0
- data/lib/rbdash/models/base_model.rb +3 -2
- data/lib/rbdash/utils.rb +4 -0
- data/lib/rbdash/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a70157bd60ff7dd8f091486112e2ab2f9b9cfe09
|
4
|
+
data.tar.gz: 3a170b20e50a49b088e385ec5744c6fd4e1d0e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1892e5efbd305b25cec00fbf714f6852001571476bb48c2f1787fe55068e0daaa6671f1b2402e22c8d373dad08ac3933383914e4cf474f8de9af806a90167cac
|
7
|
+
data.tar.gz: 117d08dc1f1be3303c09e80ec16ed5642b624f58f74fa2ed38fb8d5cd5dcf792cb49e26d6d706fdbe904ab87f50984b194e843c6b5591b4ef313a3386d9df260
|
data/README.md
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
|
4
4
|
Rbdash is a configuration management CLI tool for [Redash](https://redash.io/).
|
5
5
|
|
6
|
-
NOTE: work in progress. :construction_worker:
|
7
|
-
|
8
6
|
## Installation
|
9
7
|
|
10
8
|
Add this line to your application's Gemfile:
|
@@ -36,7 +34,7 @@ Type your redash API token: xxxxxxxxxxxxxxxx
|
|
36
34
|
#### fetch remote configurations
|
37
35
|
|
38
36
|
```sh
|
39
|
-
$ rbdash pull
|
37
|
+
$ rbdash pull <id> <id> ... [--dry-run] [--all]
|
40
38
|
# create queries/query-1.json
|
41
39
|
# create queries/query-2.json
|
42
40
|
# ...
|
@@ -45,7 +43,7 @@ $ rbdash pull
|
|
45
43
|
#### push configs to remote
|
46
44
|
|
47
45
|
```
|
48
|
-
$ rbdash push <id>
|
46
|
+
$ rbdash push <id> <id> ... [--dry-run] [--all]
|
49
47
|
```
|
50
48
|
|
51
49
|
## Development
|
data/lib/rbdash/cli.rb
CHANGED
@@ -19,6 +19,11 @@ module Rbdash
|
|
19
19
|
method_option OPT_DRY_RUN
|
20
20
|
method_option OPT_ALL
|
21
21
|
def pull(*ids)
|
22
|
+
unless Utils.config_exist?
|
23
|
+
puts 'Cannot locate .rbdash.yml in the current directory.'
|
24
|
+
return
|
25
|
+
end
|
26
|
+
|
22
27
|
if all? && !ids.empty?
|
23
28
|
puts "'CONFLICT: Cannot assign ids with --#{OPT_ALL} option.'"
|
24
29
|
return
|
@@ -35,6 +40,11 @@ module Rbdash
|
|
35
40
|
method_option OPT_DRY_RUN
|
36
41
|
method_option OPT_ALL
|
37
42
|
def push(*ids)
|
43
|
+
unless Utils.config_exist?
|
44
|
+
puts 'Cannot locate .rbdash.yml in the current directory.'
|
45
|
+
return
|
46
|
+
end
|
47
|
+
|
38
48
|
if all? && !ids.empty?
|
39
49
|
puts "'CONFLICT: Cannot assign ids with --#{OPT_ALL} option.'"
|
40
50
|
return
|
@@ -50,10 +50,11 @@ module Rbdash
|
|
50
50
|
end
|
51
51
|
h = JSON.parse(response.body)
|
52
52
|
results = h['results']
|
53
|
-
all_results += results.
|
53
|
+
all_results += results.reduce([]) do |acc, result|
|
54
|
+
next acc if result['is_archived'] || result['is_draft']
|
54
55
|
body = result.select { |k, _| attributes.map(&:to_s).include?(k) }
|
55
56
|
id = result['id']
|
56
|
-
new(body, id)
|
57
|
+
acc << new(body, id)
|
57
58
|
end
|
58
59
|
|
59
60
|
count = h['count']
|
data/lib/rbdash/utils.rb
CHANGED
data/lib/rbdash/version.rb
CHANGED