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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb38bbb5168551aa34c9d8b19a7365257c5eafc0
4
- data.tar.gz: 797eab469029bd4e9f82489b8f51513e24574104
3
+ metadata.gz: a70157bd60ff7dd8f091486112e2ab2f9b9cfe09
4
+ data.tar.gz: 3a170b20e50a49b088e385ec5744c6fd4e1d0e9d
5
5
  SHA512:
6
- metadata.gz: c05f284cbae5b8cb5749b1aea82de9af83ba3267daa26bbe6d7a53b32f1c2fe0dd86827929a56eb66a3585cee2432ba0b4f6be62ca903471de884ed8f1e1e2ee
7
- data.tar.gz: 0a5127285700d4401575ca46cc3ee4ccfd207c69f31db3abda15f7d0505b9fc635133a31eeec92af6fe74cc2a30a0059684a45693b17d420c23df7b73a280d0e
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.map do |result|
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
@@ -10,6 +10,10 @@ module Rbdash
10
10
  def find_local_file(id)
11
11
  Dir.glob("queries/query-#{id}.json").first
12
12
  end
13
+
14
+ def config_exist?
15
+ !Dir.glob('.rbdash.yml').empty?
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,3 +1,3 @@
1
1
  module Rbdash
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.4.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbdash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - shotat