drep 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.3.4 2009-10-20
2
+
3
+ * Proxy support for the example provider. Pass a Proxy URL as a first parameter to the provider
4
+ * Parameters now can be passed to the provider
5
+
1
6
  === 0.3.3 2009-07-20
2
7
 
3
8
  * 1 major enhancement:
@@ -7,6 +7,10 @@ module DRep
7
7
  NAME = 'DRep .*ML Parser'
8
8
  DESCRIPTION = 'Simple HTML/XML values extractor based on Nokogiri and Open-URI libs.'
9
9
 
10
+ VERSION = '0.0.2'
11
+
12
+ PARAMETERS = '1> Proxy URL'
13
+
10
14
  attr_reader :env
11
15
 
12
16
  def initialize(environment)
@@ -20,13 +24,13 @@ module DRep
20
24
  def run(specs)
21
25
  result = {}
22
26
 
23
- sources, rules_list = specs[:sources], specs[:rules]
27
+ sources, rules_list, options = specs[:sources], specs[:rules], specs[:options]
24
28
 
25
29
  raise "Invalid sources list" unless sources.is_a?(Enumerable)
26
30
  raise "Invalid rules list" unless rules_list.is_a?(Enumerable)
27
31
 
28
32
  sources.each do |source|
29
- doc = load_doc(source)
33
+ doc = load_doc(source, options.first)
30
34
  valid doc do
31
35
  rules_list.each do |rules|
32
36
  temp_res = process_rules_sources(doc, rules)
@@ -39,12 +43,12 @@ module DRep
39
43
  end
40
44
 
41
45
  private
42
- def load_doc(source)
46
+ def load_doc(source, proxy_url)
43
47
  result = nil
44
48
 
45
49
  begin
46
50
  msg("Processing source: #{source}")
47
- open(source) do |html|
51
+ open(source, :proxy => proxy_url) do |html|
48
52
  result = Nokogiri::HTML(html.read, nil, html.charset)
49
53
  end
50
54
  rescue Exception => e
data/lib/drep.rb CHANGED
@@ -29,7 +29,7 @@ module DRep
29
29
  UNIX_NAME = 'drep'
30
30
 
31
31
  # System version (rational version policy)
32
- VERSION = '0.3.3'
32
+ VERSION = '0.3.4'
33
33
 
34
34
  # Full name of the author
35
35
  AUTHOR = 'Toksaitov Dmitrii Alexandrovich'
@@ -218,4 +218,12 @@ class String
218
218
 
219
219
  return result
220
220
  end
221
+
222
+ def quotate()
223
+ "'#{self}'"
224
+ end
225
+
226
+ def double_quotate()
227
+ "\"#{self}\""
228
+ end
221
229
  end
data/lib/drep/drep_cli.rb CHANGED
@@ -37,7 +37,7 @@ module DRep
37
37
 
38
38
  DREP_EXEC_OPTIONS =
39
39
  {:provider_flag =>
40
- ['-p', '--provider PROVIDER[;SOURCE_1[,SOURCE_2]][;RULE_1[,RULE_2]]',
40
+ ['-p', '--provider PROVIDER[;SOURCE_1[,SOURCE_2]][;RULE_1[,RULE_2]][;OPTIONS]',
41
41
  'Provider path with sources and rules specifications.'],
42
42
  :template_flag =>
43
43
  ['-t', '--template PATH[>OUTPUT_PATH]',
@@ -202,6 +202,7 @@ module DRep
202
202
  provider_path = parts[0]
203
203
  sources_list = parts[1]
204
204
  rules_list = parts[2]
205
+ options = parts[3]
205
206
 
206
207
  unless provider_path.nil?
207
208
  provider_specs[:path] = provider_path
@@ -209,8 +210,9 @@ module DRep
209
210
  raise("Provider path is not specified")
210
211
  end
211
212
 
212
- provider_specs[:sources] = [] + parse_args(sources_list)
213
- provider_specs[:rules] = [] + parse_args(rules_list)
213
+ provider_specs[:sources] = parse_args(sources_list)
214
+ provider_specs[:rules] = parse_args(rules_list)
215
+ provider_specs[:options] = parse_args(options)
214
216
  end
215
217
 
216
218
  unless provider_specs.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toksaitov Dmitrii Alexandrovich
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-28 00:00:00 +06:00
12
+ date: 2009-07-15 00:00:00 +06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency