wmls 0.1.18 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +63 -0
  3. data/lib/wmls.rb +11 -9
  4. metadata +8 -8
  5. data/README +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 442f54ea46bc1651edef06f5b4c3fabae504fd4c
4
- data.tar.gz: dd6b888becb63884c18b0dcddc2343cadd7088fd
3
+ metadata.gz: 17b61e58f1cb6cd7348ca44488b3131ca2a09306
4
+ data.tar.gz: caa970c7834d81229b205e41cc19b8d2b1fcb938
5
5
  SHA512:
6
- metadata.gz: 723876ef4d3e1889ea31bdab567439034011ca570f41f0bdff30782379811d0cb040a0195712ea1b0dc1aa4485168af49998281eaa326d30c2275e461640886e
7
- data.tar.gz: e8ddbbc6b54d8df8aef6b12bc1b51a7c723524d5c2fb752e4003c348dbe45cccdaf141c7a2dfe9902edaf61ebb5e823e7c21584a3c46dfe9c4ad4ced12275f92
6
+ metadata.gz: 551c7d5a9221db13bf1fda35f2ae2f7817221e869e3980efe2fa77870cc23d74c65510a7af6837cd66c32acbc275e227f3e2a0efa0382ae7181bdc9148a3bcb5
7
+ data.tar.gz: 7c030bfc5c2ad6693bdc6bb9d32f917f98210499088a2a69a1b427228556816b8f550318b1cf354844dd358c48a963716772aa8e799c5e320e750004db1de89b
@@ -0,0 +1,63 @@
1
+ #wmls WITSML command line tool in Ruby
2
+
3
+ Use this script to call GetCap, GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore on
4
+ a WITSML server.
5
+
6
+ ##Install
7
+ Make sure you've [installed Ruby](https://www.ruby-lang.org/en/downloads/). Then
8
+
9
+ ```
10
+ gem install wmls
11
+ ```
12
+ After install, the wmls command should be on your path. It uses lib/wmls.rb, a library you can use to write your own WITSML programs, which is installed as part of this gem.
13
+
14
+
15
+
16
+ ##Usage
17
+
18
+ wmls [options]
19
+ -Dvariable=value Replace occurrences of %variable% with value, in the query template
20
+ -v, --verbose Run verbosely
21
+ -r, --url url URL of the WITSML service
22
+ -t, --timeout seconds timeout in seconds (optional, default 60)
23
+ -u, --username USER HTTP user name
24
+ -p, --password PASS HTTP password
25
+ -q, --query QUERYFILE Path to file containing query, delete, add or update template
26
+ -a, --action cap|get|add|update|delete WITSML action; default is 'get'
27
+ -o, --optionsin OPTIONSIN optionsIn string (optional)
28
+ -h, --help Show this message
29
+
30
+
31
+ ##Example
32
+
33
+ ```
34
+ wmls -q query_v1311/get_all_wells.xml -r https://yourserver.com/witsml -u username -p mypassword -a get
35
+ ```
36
+
37
+ I've included a bunch of sample query templates originally created by Gary Masters of Energistics.
38
+ You can obtain them by downloading the source zip at
39
+ https://github.com/wellstorm/wmls/archive/master.zip
40
+ The templates contain variables delimited by % characters, e.g. "%uidWellbore%".
41
+ Inspect the templates you want to use to determine the variables you need to replace.
42
+ Pass substitution values for these values on the wmls command line, e.g:
43
+
44
+ ```
45
+ wmls -DuidWell=ABC -DuidWellbore=1234 ...
46
+ ```
47
+
48
+ ##License
49
+ Apache 2.0
50
+
51
+ ##History
52
+ 10 Mar 2011 -- initial commit.
53
+ 16 Oct 2011 -- added -D option to wmls command line tool (0.1.7)
54
+ 01 May 2012 -- added GetCap support (0.1.8)
55
+ 01 May 2012 -- added support for capabilitiesIn parameter to all calls (0.1.9)
56
+ 04 May 2012 -- added support for a headers parameter to all calls (0.1.11)
57
+ 07 May 2012 -- fix headers param to get_cap (default should be {}) (0.1.13)
58
+ 14 Jun 2012 -- return values to shell from wmls script (0.1.14)
59
+ 14 Aug 2012 -- add timeout option to wmls script (0.1.15)
60
+ 18 Jul 2015 -- replace REXML with nokogiri, and fix missing endDateTimeIndex (0.1.16) (thanks emre.demirors and alex.bednarczyk)
61
+ 21 Jul 2015 -- revert back to REXML. (nokogiri install too fragile) (0.1.18) (do not install this version)
62
+ 19 Apr 2016 -- revert back to 0.1.15 plus endDateTimeIndex fix (1.0.0)
63
+
@@ -18,7 +18,7 @@ require 'net/http'
18
18
  require 'net/https'
19
19
  require 'uri'
20
20
  require 'stringio'
21
- require 'nokogiri'
21
+ require 'rexml/document'
22
22
 
23
23
  # A WITSML client library.
24
24
  #
@@ -149,27 +149,29 @@ END
149
149
  end
150
150
 
151
151
  def pretty_xml(xml_data)
152
- doc = Nokogiri::XML(xml_data)
153
- return doc.to_xml
152
+ s = ''
153
+ doc = REXML::Document.new(xml_data)
154
+ doc.write(s, 2)
155
+ return s
154
156
  end
155
157
 
156
158
  # parse the xml and return the singular of the root element name.
157
159
  def extract_type(xml_data)
158
- doc = Nokogiri::XML(xml_data)
160
+ doc = REXML::Document.new(xml_data)
159
161
  plural = doc.root.name
160
162
  return plural[0..plural.length-2]
161
163
  end
162
164
 
163
165
  #extract the witsml response: status_code and xml_out
164
166
  def extract_response(xml_data)
165
- doc = Nokogiri::XML(xml_data)
167
+ doc = REXML::Document.new(xml_data)
166
168
  r = 0
167
169
  x = ''
168
170
  s = ''
169
- doc.xpath('//Result').each() { |elt| r = elt.text }
170
- doc.xpath('//XMLout').each() { |elt| x = pretty_xml(elt.text) }
171
- doc.xpath('//CapabilitiesOut').each() { |elt| x = pretty_xml(elt.text) }
172
- doc.xpath('//SuppMsgOut').each() { |elt| s = elt.text }
171
+ doc.root.each_element('//Result') { |elt| r = elt.text}
172
+ doc.root.each_element('//XMLout') { |elt| x = pretty_xml(elt.text)}
173
+ doc.root.each_element('//CapabilitiesOut') { |elt| x = pretty_xml(elt.text)}
174
+ doc.root.each_element('//SuppMsgOut') { |elt| s = elt.text }
173
175
  return [r.to_i,s,x];
174
176
  end
175
177
 
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wmls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hugh Winkler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2016-04-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Wmls calls GetCap, GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore
14
14
  on a WITSML server.
15
- email: hugh.winkler@wellstorm.com
15
+ email: hughw@hughw.net
16
16
  executables:
17
17
  - wmls
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - README.md
21
22
  - LICENSE
22
- - README
23
- - bin/wmls
24
23
  - lib/wmls.rb
24
+ - bin/wmls
25
25
  homepage: https://github.com/wellstorm/wmls/
26
26
  licenses:
27
27
  - Apache-2.0
@@ -32,17 +32,17 @@ require_paths:
32
32
  - lib
33
33
  required_ruby_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - ">="
35
+ - - '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ">="
40
+ - - '>='
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 2.4.5
45
+ rubygems_version: 2.0.0
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: Calls GetCap, GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore
data/README DELETED
@@ -1,43 +0,0 @@
1
- wmls -- WITSML command line tool in Ruby.
2
-
3
- wmls is a script in the bin folder. It uses lib/wmls.rb, a library you can use to
4
- write your own WiTSML programs.
5
-
6
- Use this script to call GetCap, GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore on
7
- a WITSML server.
8
-
9
- Usage: wmls [options]
10
- -Dvariable=value Replace occurrences of %variable% with value, in the query template
11
- -v, --verbose Run verbosely
12
- -r, --url url URL of the WITSML service
13
- -t, --timeout seconds timeout in seconds (optional, default 60)
14
- -u, --username USER HTTP user name
15
- -p, --password PASS HTTP password
16
- -q, --query QUERYFILE Path to file containing query, delete, add or update template
17
- -a cap|get|add|update|delete WITSML action; default is 'get'
18
- --action
19
- -o, --optionsin OPTIONSIN optionsIn string (optional)
20
- -h, --help Show this message
21
-
22
- Example:
23
- wmls -q query_v1311/get_all_wells.xml -r https://witsml.wellstorm.com/witsml/services/store -u username -p mypassword -a get
24
-
25
- I've included a bunch of sample query templates originally created by Gary Masters of Energistics.
26
-
27
- wmls files: Copyright 2012 Welstorm Development
28
- License: Apache 2.0
29
-
30
- History:
31
-
32
- 10 Mar 2011 -- initial commit.
33
- 16 Oct 2011 -- added -D option to wmls command line tool (0.1.7)
34
- 01 May 2012 -- added GetCap support (0.1.8)
35
- 01 May 2012 -- added support for capabilitiesIn parameter to all calls (0.1.9)
36
- 04 May 2012 -- added support for a headers parameter to all calls (0.1.11)
37
- 07 May 2012 -- fix headers param to get_cap (default should be {}) (0.1.13)
38
- 14 Jun 2012 -- return values to shell from wmls script (0.1.14)
39
- 14 Aug 2012 -- add timeout option to wmls script
40
- 18 Jul 2015 -- replace REXML with nokogiri, and fix missing endDateTimeIndex (0.1.16)
41
- (thanks emre.demirors and alex.bednarczyk)
42
- 21 Jul 2015 -- revert back to REXML. (nokogiri gem install too fragile) (0.1.18)
43
-