wmls 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/bin/wmls +11 -3
- metadata +2 -2
data/README
CHANGED
@@ -4,6 +4,7 @@ Use this script to call GetFromStore, AddToStore, UpdateInStore, or DeleteFromSt
|
|
4
4
|
a WITSML server.
|
5
5
|
|
6
6
|
Usage: wmls.rb [options]
|
7
|
+
-Dvariable=value Replace occurrences of %variable% with value, in the query template
|
7
8
|
-v, --verbose Run verbosely
|
8
9
|
-r, --url url URL of the WITSML service
|
9
10
|
-u, --username USER HTTP user name
|
data/bin/wmls
CHANGED
@@ -16,13 +16,18 @@
|
|
16
16
|
require 'rubygems'
|
17
17
|
require 'optparse'
|
18
18
|
require 'wmls'
|
19
|
-
options = {}
|
19
|
+
options = {:defs => {}}
|
20
20
|
|
21
21
|
opts =OptionParser.new do |o|
|
22
22
|
o.banner = "Usage: wmls [options]"
|
23
23
|
# o.on("-v", "--verbose", "Run verbosely") do |v|
|
24
24
|
# options[:verbose] = v
|
25
25
|
# end
|
26
|
+
o.on("-DVARIABLE=VALUE", "Define a substitution variable. Use this multiple times to replace %variable% with value in the template.") do |v|
|
27
|
+
m = /([a-zA-Z0-9_]*)=(.*)/.match(v.to_s)
|
28
|
+
#puts " -D #{m[1]} = #{m[2]}"
|
29
|
+
options[:defs][m[1]] = m[2]
|
30
|
+
end
|
26
31
|
o.on("-r", "--url url", "URL of the WITSML service") do |v|
|
27
32
|
options[:url] = v
|
28
33
|
end
|
@@ -46,7 +51,7 @@ end
|
|
46
51
|
|
47
52
|
|
48
53
|
# Load the named file and return its contents as a string
|
49
|
-
def get_file_as_string(filename)
|
54
|
+
def get_file_as_string(filename, defs)
|
50
55
|
data = ''
|
51
56
|
if(filename)
|
52
57
|
f = File.open(filename, "r")
|
@@ -55,6 +60,9 @@ def get_file_as_string(filename)
|
|
55
60
|
end
|
56
61
|
|
57
62
|
f.each_line do |line|
|
63
|
+
defs.each_key do |key|
|
64
|
+
line.gsub! "%#{key}%", defs[key]
|
65
|
+
end
|
58
66
|
data += line
|
59
67
|
end
|
60
68
|
return data
|
@@ -68,7 +76,7 @@ if ( !options[:url] )
|
|
68
76
|
end
|
69
77
|
|
70
78
|
|
71
|
-
template= get_file_as_string(options[:query] )
|
79
|
+
template= get_file_as_string(options[:query], options[:defs] )
|
72
80
|
|
73
81
|
wmls = Wmls.new options[:url], options[:user_name], options[:password]
|
74
82
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: wmls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Hugh Winkler
|
@@ -26,7 +26,7 @@ files:
|
|
26
26
|
- LICENSE
|
27
27
|
- lib/wmls.rb
|
28
28
|
- bin/wmls
|
29
|
-
homepage: https://github.com/wellstorm/wmls
|
29
|
+
homepage: https://github.com/wellstorm/wmls/
|
30
30
|
licenses: []
|
31
31
|
|
32
32
|
post_install_message:
|