do 0.2.0.a → 0.2.0.b
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.
- data/lib/do/parser.rb +16 -14
- data/lib/do/server.rb +6 -1
- data/lib/do/version.rb +1 -1
- metadata +3 -3
data/lib/do/parser.rb
CHANGED
@@ -5,20 +5,22 @@ module DO
|
|
5
5
|
options = {}
|
6
6
|
args.each_with_index do |arg, i|
|
7
7
|
case arg
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
8
|
+
# --foo=bar
|
9
|
+
when /=/
|
10
|
+
key, value = *arg.split("=")
|
11
|
+
options[key.sub(/^-{1,2}/,'').to_sym] = value
|
12
|
+
# --no-foo
|
13
|
+
when /^-{1,2}no-(.+)/
|
14
|
+
options[$1.to_sym] = false
|
15
|
+
# --foo bar
|
16
|
+
# --foo
|
17
|
+
# -foo
|
18
|
+
when /^-{1,2}(.+)/
|
19
|
+
key = $1.to_sym
|
20
|
+
value = args[i+1] && args[i+1] !~ /^-{1,2}/ ? args.delete_at(i+1) : true
|
21
|
+
options[key] = value
|
22
|
+
when Hash
|
23
|
+
options.merge!(arg)
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
data/lib/do/server.rb
CHANGED
@@ -111,7 +111,7 @@ module DO
|
|
111
111
|
##
|
112
112
|
# Return the content of a given file
|
113
113
|
#
|
114
|
-
def
|
114
|
+
def cat(file)
|
115
115
|
run("cat #{file}", :silent => true)
|
116
116
|
end
|
117
117
|
|
@@ -202,6 +202,11 @@ module DO
|
|
202
202
|
end
|
203
203
|
alias :gsub :replace
|
204
204
|
|
205
|
+
def create_file(text, file)
|
206
|
+
sftp.file.open(file, 'w') { |f| f.write text }
|
207
|
+
log 'written %s' % file
|
208
|
+
end
|
209
|
+
|
205
210
|
##
|
206
211
|
# Append text into a given file in a specified location
|
207
212
|
#
|
data/lib/do/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: do
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.2.0.
|
10
|
+
- b
|
11
|
+
version: 0.2.0.b
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Davide D'Agostino
|