rbdash 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/README.md +27 -5
- data/lib/rbdash/cli.rb +10 -4
- data/lib/rbdash/cli/push.rb +28 -2
- data/lib/rbdash/request.rb +2 -1
- data/lib/rbdash/version.rb +1 -1
- data/local_install.sh +5 -0
- metadata +3 -3
- data/config.sample.yml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bd45279cad296b0dc993904fa6bfc2ee3cf5089
|
4
|
+
data.tar.gz: 2db662d897905f8bc1949191c3e759b937905706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aa862983c38f4af37dda8abab348bcca917b3dd2ea4a7caf8991ee6242d196310a16b582bd5de296bd94f83e4f5cef19434f5cfff1ac84185ecdfd552af6649
|
7
|
+
data.tar.gz: 9c140bb5f4c5cce93e7b57c82662c7b0106be23b5736ae16e9f7ad819993ddfa83bdbdea5684dfd6f9d27566efe8c25f67d5320fa04da7c44c86f02340110962
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
NOTE: work in progress. :construction_worker:
|
2
1
|
|
3
2
|
# Rbdash
|
4
3
|
|
5
|
-
|
4
|
+
Rbdash is a configuration management CLI tool for [Redash](https://redash.io/).
|
6
5
|
|
7
|
-
|
6
|
+
NOTE: work in progress. :construction_worker:
|
8
7
|
|
9
8
|
## Installation
|
10
9
|
|
@@ -24,7 +23,30 @@ Or install it yourself as:
|
|
24
23
|
|
25
24
|
## Usage
|
26
25
|
|
27
|
-
|
26
|
+
|
27
|
+
#### setup
|
28
|
+
|
29
|
+
```sh
|
30
|
+
$ rbdash init
|
31
|
+
create config_test.yml
|
32
|
+
Type your redash server uri: https://example.redash.com
|
33
|
+
Type your redash API token: xxxxxxxxxxxxxxxx
|
34
|
+
```
|
35
|
+
|
36
|
+
#### fetch remote configurations
|
37
|
+
|
38
|
+
```sh
|
39
|
+
$ rbdash pull
|
40
|
+
# create queries/query-1.json
|
41
|
+
# create queries/query-2.json
|
42
|
+
# ...
|
43
|
+
```
|
44
|
+
|
45
|
+
#### push configs to remote
|
46
|
+
|
47
|
+
```
|
48
|
+
$ rbdash push <id>
|
49
|
+
```
|
28
50
|
|
29
51
|
## Development
|
30
52
|
|
@@ -34,4 +56,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
34
56
|
|
35
57
|
## Contributing
|
36
58
|
|
37
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
59
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/shotat/rbdash.
|
data/lib/rbdash/cli.rb
CHANGED
@@ -6,7 +6,7 @@ module Rbdash
|
|
6
6
|
|
7
7
|
desc 'init', 'create a configuration file.'
|
8
8
|
def init
|
9
|
-
create_file '
|
9
|
+
create_file '.rbdash.yml' do
|
10
10
|
base_uri = ask('Type your redash server uri:')
|
11
11
|
token = ask('Type your redash API token:')
|
12
12
|
"base_uri: #{base_uri}\ntoken: #{token}"
|
@@ -14,17 +14,23 @@ module Rbdash
|
|
14
14
|
end
|
15
15
|
|
16
16
|
desc 'pull', 'pulls existing configurations.'
|
17
|
+
method_option 'dry-run'
|
17
18
|
def pull
|
18
19
|
CLI::Pull.new.run
|
19
20
|
end
|
20
21
|
|
22
|
+
desc 'push <id1> <id2> ...', 'push configurations'
|
21
23
|
method_option 'dry-run'
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
def push(*ids)
|
25
|
+
if options['dry-run']
|
26
|
+
CLI::Push.new.dry_run(*ids)
|
27
|
+
return
|
28
|
+
end
|
29
|
+
CLI::Push.new.run(*ids)
|
25
30
|
end
|
26
31
|
|
27
32
|
desc 'push_all', 'push all configurations'
|
33
|
+
method_option 'dry-run'
|
28
34
|
def push_all
|
29
35
|
CLI::PushAll.new.run
|
30
36
|
end
|
data/lib/rbdash/cli/push.rb
CHANGED
@@ -1,8 +1,34 @@
|
|
1
|
+
require 'diffy'
|
1
2
|
module Rbdash
|
2
3
|
class CLI::Push
|
3
|
-
|
4
|
+
|
5
|
+
def run(*ids)
|
6
|
+
ids.each do |id|
|
7
|
+
show_diff(id)
|
8
|
+
update(id)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def dry_run(*ids)
|
13
|
+
ids.each do |id|
|
14
|
+
show_diff(id)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def update(id)
|
4
21
|
Rbdash::Models::Query.update(id)
|
5
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
def show_diff(id)
|
25
|
+
remote_state = Rbdash::Models::Query.find(id)
|
26
|
+
local_state = Rbdash::Models::Query.load(id)
|
27
|
+
puts Diffy::Diff.new(remote_state.to_json, local_state.to_json, diff_opt).to_s(:color)
|
28
|
+
end
|
29
|
+
|
30
|
+
def diff_opt
|
31
|
+
{ include_diff_info: true, context: 2 }
|
6
32
|
end
|
7
33
|
end
|
8
34
|
end
|
data/lib/rbdash/request.rb
CHANGED
data/lib/rbdash/version.rb
CHANGED
data/local_install.sh
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbdash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shotat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|
@@ -124,7 +124,6 @@ files:
|
|
124
124
|
- Rakefile
|
125
125
|
- bin/console
|
126
126
|
- bin/setup
|
127
|
-
- config.sample.yml
|
128
127
|
- exe/rbdash
|
129
128
|
- lib/rbdash.rb
|
130
129
|
- lib/rbdash/cli.rb
|
@@ -135,6 +134,7 @@ files:
|
|
135
134
|
- lib/rbdash/models/query.rb
|
136
135
|
- lib/rbdash/request.rb
|
137
136
|
- lib/rbdash/version.rb
|
137
|
+
- local_install.sh
|
138
138
|
- rbdash.gemspec
|
139
139
|
homepage: https://github.com/shotat/rbdash
|
140
140
|
licenses: []
|
data/config.sample.yml
DELETED