central 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/central +10 -1
- data/lib/central.rb +19 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1df8c743134a9baddb4d6bd454b6bd00e417dde4812533c3d2f4c218debe64a
|
4
|
+
data.tar.gz: 702aa1bdf779cad2ef1fc32ce4ef3a9354d8f0a81f059f94029a33bdb0a31f7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f6c2e18e8f0428bbc390c29472892c5878a47ee8fc271ff2d2da50d3665da28c7cfb61944b12558021a22947892e008388111c59409988ef3e27a4450d865db
|
7
|
+
data.tar.gz: '08ade7d82161a2fe545b30e21428e3c627f3d052cfd35fc40d1718004e4881d16034eb1cfde2ed0ae5c603f5b70eae56a4ce840c199ffe74705405eac1313e82'
|
data/bin/central
CHANGED
@@ -9,8 +9,17 @@
|
|
9
9
|
require 'central'
|
10
10
|
require 'optparse'
|
11
11
|
|
12
|
-
VERSION = 'v0.3.
|
12
|
+
VERSION = 'v0.3.1'
|
13
13
|
|
14
|
+
# parse extra options
|
15
|
+
ARGV.each do |option|
|
16
|
+
if not option.empty? and option.index('-') == 0 and not ['-h', '--help', '-i', '--irb', '-n', '--no-color', '-v', '--version', '-m', '--monitor'].include?(option)
|
17
|
+
$options.append(option)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
ARGV.delete_if { |option| $options.include?(option) }
|
21
|
+
|
22
|
+
# parse central options
|
14
23
|
options = {:color => true}
|
15
24
|
OptionParser.new do |opts|
|
16
25
|
opts.banner = %{central #{VERSION} - created by Dmitry Geurkov (d.geurkov@gmail.com) and licensed under LGPLv3
|
data/lib/central.rb
CHANGED
@@ -11,6 +11,21 @@ require 'open3'
|
|
11
11
|
require 'fileutils'
|
12
12
|
require 'digest'
|
13
13
|
|
14
|
+
# options
|
15
|
+
$options = []
|
16
|
+
|
17
|
+
# get option, returns Array if multiple or nil if none
|
18
|
+
def option(opt)
|
19
|
+
options = $options.filter { |option| option.index(opt) == 0 }
|
20
|
+
if options.size == 0
|
21
|
+
return nil
|
22
|
+
elsif options.size == 1
|
23
|
+
return options[0]
|
24
|
+
else
|
25
|
+
return options
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
14
29
|
# cli colors
|
15
30
|
$colored = true
|
16
31
|
COLOR_RED = 31
|
@@ -100,9 +115,9 @@ def shell(command, verbose: false, silent: true)
|
|
100
115
|
if stdout_open
|
101
116
|
begin
|
102
117
|
ch = o.read_nonblock(1)
|
103
|
-
stdout
|
118
|
+
stdout += ch
|
104
119
|
unless silent
|
105
|
-
stdout_line
|
120
|
+
stdout_line += ch
|
106
121
|
if ch == "\n"
|
107
122
|
STDOUT.puts stdout_line
|
108
123
|
stdout_line = ''
|
@@ -118,9 +133,9 @@ def shell(command, verbose: false, silent: true)
|
|
118
133
|
|
119
134
|
begin
|
120
135
|
ch = e.read_nonblock(1)
|
121
|
-
stderr
|
136
|
+
stderr += ch
|
122
137
|
unless silent
|
123
|
-
stderr_line
|
138
|
+
stderr_line += ch
|
124
139
|
if ch == "\n"
|
125
140
|
STDERR.puts stderr_line
|
126
141
|
stderr_line = ''
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: central
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Geurkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: central dotfile management system
|
14
14
|
email: d.geurkov@gmail.com
|