do 0.2.0.a → 0.2.0.b

Sign up to get free protection for your applications and to get access to all the features.
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
- # --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
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 read(file)
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
@@ -1,3 +1,3 @@
1
1
  module DO
2
- VERSION = "0.2.0.a" unless defined?(DO::VERSION)
2
+ VERSION = "0.2.0.b" unless defined?(DO::VERSION)
3
3
  end
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: 58
4
+ hash: 59
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 0
10
- - a
11
- version: 0.2.0.a
10
+ - b
11
+ version: 0.2.0.b
12
12
  platform: ruby
13
13
  authors:
14
14
  - Davide D'Agostino