dashdog 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +6 -1
- data/README.md +1 -0
- data/lib/dashdog/actions.rb +34 -3
- data/lib/dashdog/cli.rb +1 -0
- data/lib/dashdog/converter.rb +15 -2
- data/lib/dashdog/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5a209f39a8e469b2ff1a4ae3c37c9ef0f29a9fe
|
4
|
+
data.tar.gz: 75e706697dfad0acaf3bd8e2cf0a34820d5d2a19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 382cca04591f69297f3bbc7b41ec2c736bf03f52ee9be2486f4f09b552bb3d0c66a13e2c00358e95f8c4ba01180b9172a76ae3c16d7e5021225a52c56d548bc0
|
7
|
+
data.tar.gz: 11c397cdfedf957a1f9fd38b2aa83ccf80a62b0a8656a4ab07139f82dfa07d6a8c40c5da1ccab1fe1f937815fadd75ad88dd66927085714e20f9c86d6e6c893b
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
## 0.2.0
|
2
|
+
|
3
|
+
- Add `split` opton [#4][] ([@winebarrel][])
|
4
|
+
|
1
5
|
## 0.1.1
|
2
6
|
|
3
7
|
- Add color option / check stdout tty [#3][] ([@winebarrel][])
|
4
8
|
- Use parallel for speeding up [#2][] ([@winebarrel][])
|
5
9
|
- Bugfix: Error occurs when widgets is nil. [#1][] ([@winebarrel][])
|
6
|
-
- Fix strange diff colorize
|
10
|
+
- Fix a strange diff colorize
|
7
11
|
|
8
12
|
## 0.1.0
|
9
13
|
|
@@ -13,4 +17,5 @@
|
|
13
17
|
[#1]: https://github.com/serverworks/dashdog/issues/1
|
14
18
|
[#2]: https://github.com/serverworks/dashdog/issues/2
|
15
19
|
[#3]: https://github.com/serverworks/dashdog/issues/3
|
20
|
+
[#4]: https://github.com/serverworks/dashdog/issues/4
|
16
21
|
[@winebarrel]: https://github.com/winebarrel
|
data/README.md
CHANGED
data/lib/dashdog/actions.rb
CHANGED
@@ -13,18 +13,23 @@ module Dashdog
|
|
13
13
|
def export(options)
|
14
14
|
dsl = @converter.timeboards_to_dsl(@client.get_timeboards)
|
15
15
|
dsl << @converter.screenboards_to_dsl(@client.get_screenboards)
|
16
|
-
|
17
|
-
|
16
|
+
if options['write']
|
17
|
+
_export_to_file(dsl, options)
|
18
|
+
else
|
19
|
+
Dashdog::Utils.print_ruby(dsl, color: options[:color])
|
20
|
+
end
|
18
21
|
end
|
19
22
|
|
20
23
|
def apply(options)
|
21
24
|
dry_run = options['dry_run'] ? '[Dry run] ' : ''
|
22
|
-
conf = @converter.to_h(
|
25
|
+
conf = @converter.to_h(options['file'])
|
23
26
|
|
24
27
|
_apply_timeboards(conf['timeboards'], @client.get_timeboards, dry_run)
|
25
28
|
_apply_screenboards(conf['screenboards'], @client.get_screenboards, dry_run)
|
26
29
|
end
|
27
30
|
|
31
|
+
private
|
32
|
+
|
28
33
|
def _apply_timeboards(local, remote, dry_run)
|
29
34
|
local.each do |l|
|
30
35
|
r = _choice_by_title(remote, l['title'])
|
@@ -95,5 +100,31 @@ module Dashdog
|
|
95
100
|
nil
|
96
101
|
end
|
97
102
|
|
103
|
+
def _export_to_file(dsl, options)
|
104
|
+
file = options['file']
|
105
|
+
|
106
|
+
if options['split']
|
107
|
+
dsls = dsl.strip.split(/^(timeboard|screenboard)\b/).slice(1..-1).each_slice(2).map(&:join)
|
108
|
+
requires = []
|
109
|
+
|
110
|
+
dsls.each do |splitted|
|
111
|
+
splitted.strip!
|
112
|
+
title = splitted.each_line.first.strip.gsub(/\A(?:timeboard|screenboard)\s+"([^"]+)"\s+do/, '\\1')
|
113
|
+
title.gsub!(/\W+/, '_')
|
114
|
+
requires << title
|
115
|
+
File.write("#{title}.rb", splitted + "\n")
|
116
|
+
info("Write '#{title}.rb'")
|
117
|
+
end
|
118
|
+
|
119
|
+
open(file, 'w') do |f|
|
120
|
+
requires.each {|r| f.puts "require #{r.inspect}" }
|
121
|
+
end
|
122
|
+
|
123
|
+
info("Write '#{file}'")
|
124
|
+
else
|
125
|
+
File.write(file, dsl)
|
126
|
+
info("Write '#{file}'")
|
127
|
+
end
|
128
|
+
end
|
98
129
|
end
|
99
130
|
end
|
data/lib/dashdog/cli.rb
CHANGED
@@ -12,6 +12,7 @@ module Dashdog
|
|
12
12
|
|
13
13
|
desc "export", "Export the dashboard configurations"
|
14
14
|
option :write, aliases: '-w', desc: 'Write the configuration to the file', type: :boolean, default: false
|
15
|
+
option :split, desc: 'Split configuration file', type: :boolean, default: false
|
15
16
|
def export
|
16
17
|
@actions.export(options)
|
17
18
|
end
|
data/lib/dashdog/converter.rb
CHANGED
@@ -60,13 +60,26 @@ EOS
|
|
60
60
|
ret
|
61
61
|
end
|
62
62
|
|
63
|
-
def to_h(
|
64
|
-
|
63
|
+
def to_h(dsl_file)
|
64
|
+
@_dsl_file = dsl_file
|
65
|
+
instance_eval(File.read(dsl_file), dsl_file)
|
65
66
|
@boards
|
66
67
|
end
|
67
68
|
|
68
69
|
private
|
69
70
|
|
71
|
+
def require(file)
|
72
|
+
boardfile = (file =~ %r|\A/|) ? file : File.expand_path(File.join(File.dirname(@_dsl_file), file))
|
73
|
+
|
74
|
+
if File.exist?(boardfile)
|
75
|
+
instance_eval(File.read(boardfile), boardfile)
|
76
|
+
elsif File.exist?(boardfile + '.rb')
|
77
|
+
instance_eval(File.read(boardfile + '.rb'), boardfile + '.rb')
|
78
|
+
else
|
79
|
+
Kernel.require(file)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
70
83
|
def timeboard(value = nil, &block)
|
71
84
|
hash = Dslh.eval(
|
72
85
|
allow_empty_args: true,
|
data/lib/dashdog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dashdog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serverworks Co.,Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dogapi
|