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 +5 -0
- data/assets/providers/drep_ml_provider.rb +8 -4
- data/lib/drep.rb +1 -1
- data/lib/drep/alterers/drep_helpers.rb +8 -0
- data/lib/drep/drep_cli.rb +5 -3
- metadata +2 -2
data/History.txt
CHANGED
@@ -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
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] =
|
213
|
-
provider_specs[:rules] =
|
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.
|
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-
|
12
|
+
date: 2009-07-15 00:00:00 +06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|