grope 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ -c
2
+ -fs
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'httparty'
4
+ gem 'mechanize', '= 2.0.1'
5
+
6
+ group :development do
7
+ gem 'rspec', '~> 2.3.0'
8
+ gem 'jeweler', '~> 1.6.4'
9
+ gem 'rdoc'
10
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,45 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ git (1.2.5)
6
+ httparty (0.8.1)
7
+ multi_json
8
+ multi_xml
9
+ jeweler (1.6.4)
10
+ bundler (~> 1.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ json (1.6.5)
14
+ mechanize (2.0.1)
15
+ net-http-digest_auth (~> 1.1, >= 1.1.1)
16
+ net-http-persistent (~> 1.8)
17
+ nokogiri (~> 1.4)
18
+ webrobots (~> 0.0, >= 0.0.9)
19
+ multi_json (1.0.4)
20
+ multi_xml (0.4.1)
21
+ net-http-digest_auth (1.2)
22
+ net-http-persistent (1.9)
23
+ nokogiri (1.5.0)
24
+ rake (0.9.2.2)
25
+ rdoc (3.12)
26
+ json (~> 1.4)
27
+ rspec (2.3.0)
28
+ rspec-core (~> 2.3.0)
29
+ rspec-expectations (~> 2.3.0)
30
+ rspec-mocks (~> 2.3.0)
31
+ rspec-core (2.3.1)
32
+ rspec-expectations (2.3.0)
33
+ diff-lcs (~> 1.1.2)
34
+ rspec-mocks (2.3.0)
35
+ webrobots (0.0.13)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ httparty
42
+ jeweler (~> 1.6.4)
43
+ mechanize (= 2.0.1)
44
+ rdoc
45
+ rspec (~> 2.3.0)
data/Rakefile CHANGED
@@ -1,46 +1,40 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ # encoding: utf-8
3
2
 
3
+ require 'rubygems'
4
+ require 'bundler'
4
5
  begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "grope"
8
- gem.summary = "A non-GUI library to represent browser environment"
9
- gem.description = "A non-GUI library to represent browser environment using WebKit Framework"
10
- gem.email = "youpy@buycheapviagraonlinenow.com"
11
- gem.homepage = "http://github.com/youpy/grope"
12
- gem.authors = ["youpy"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_dependency "mechanize", ">= 2.0.1"
15
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
- end
17
- Jeweler::GemcutterTasks.new
18
- rescue LoadError
19
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
20
11
  end
12
+ require 'rake'
21
13
 
22
- require 'spec/rake/spectask'
23
- Spec::Rake::SpecTask.new(:spec) do |spec|
24
- spec.libs << 'lib' << 'spec'
25
- spec.spec_files = FileList['spec/**/*_spec.rb']
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ gem.name = "grope"
17
+ gem.summary = "A non-GUI library to represent browser environment"
18
+ gem.description = "A non-GUI library to represent browser environment using WebKit Framework"
19
+ gem.email = "youpy@buycheapviagraonlinenow.com"
20
+ gem.homepage = "http://github.com/youpy/grope"
21
+ gem.authors = ["youpy"]
26
22
  end
27
23
 
28
- Spec::Rake::SpecTask.new(:rcov) do |spec|
29
- spec.libs << 'lib' << 'spec'
30
- spec.pattern = 'spec/**/*_spec.rb'
31
- spec.rcov = true
24
+ require 'rspec/core'
25
+ require 'rspec/core/rake_task'
26
+ RSpec::Core::RakeTask.new(:spec) do |spec|
27
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
28
  end
33
29
 
34
- task :spec => :check_dependencies
35
-
36
30
  task :default => :spec
37
31
 
38
- require 'rake/rdoctask'
32
+ require 'rdoc/task'
39
33
  Rake::RDocTask.new do |rdoc|
40
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
34
+ version = File.read('VERSION')
41
35
 
42
36
  rdoc.rdoc_dir = 'rdoc'
43
- rdoc.title = "grope #{version}"
37
+ rdoc.title = "lastfm #{version}"
44
38
  rdoc.rdoc_files.include('README*')
45
39
  rdoc.rdoc_files.include('lib/**/*.rb')
46
40
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.2.0
data/lib/grope/env.rb CHANGED
@@ -34,7 +34,7 @@ module Grope
34
34
  def load(url)
35
35
  run do
36
36
  @webview.setMainFrameURL(url)
37
- if !@webview.mainFrame.provisionalDataSource
37
+ if !@webview.mainFrame.provisionalDataSource && url !~ /^about:/
38
38
  raise " ... not a proper url?"
39
39
  end
40
40
  end
data/spec/env_spec.rb CHANGED
@@ -43,6 +43,24 @@ describe Grope::Env do
43
43
  @env.document.URL.should eql('http://httpstat.us/')
44
44
  end
45
45
 
46
+ it "should not load invalid URL" do
47
+ %w|
48
+ htp://example.com/
49
+ example.com
50
+ example
51
+ |.each do |invalid_url|
52
+ lambda {
53
+ Grope::Env.new.load(invalid_url)
54
+ }.should raise_error
55
+ end
56
+ end
57
+
58
+ it "should load about: URL" do
59
+ lambda {
60
+ Grope::Env.new.load('about:blank')
61
+ }.should_not raise_error
62
+ end
63
+
46
64
  it "should redirect by click" do
47
65
  anchor = @env.document.links[0]
48
66
  js = @env.eval('return Grope;')
@@ -70,7 +88,7 @@ describe Grope::Env do
70
88
 
71
89
  @env.wait(3)
72
90
 
73
- (Time.now.to_i - now).should be_close(3, 1)
91
+ (Time.now.to_i - now).should be_within(1).of(3)
74
92
  end
75
93
 
76
94
  it "should wait until given block returns true" do
@@ -82,7 +100,7 @@ describe Grope::Env do
82
100
  end
83
101
  }.should raise_error(Timeout::Error)
84
102
 
85
- (Time.now.to_i - now).should be_close(1, 1)
103
+ (Time.now.to_i - now).should be_within(1).of(1)
86
104
 
87
105
  @env.document.querySelector('title').innerHTML = 'xxx'
88
106
 
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,4 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
1
  require 'grope'
4
- require 'spec'
5
- require 'spec/autorun'
6
2
 
7
- Spec::Runner.configure do |config|
8
-
3
+ RSpec.configure do |config|
9
4
  end
metadata CHANGED
@@ -4,9 +4,10 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 4
9
- version: 0.1.4
7
+ - 2
8
+ - 0
9
+ segments_generated: true
10
+ version: 0.2.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - youpy
@@ -14,37 +15,80 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-10-03 00:00:00 +09:00
18
+ date: 2012-02-07 00:00:00 +09:00
18
19
  default_executable: grope
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - ">="
26
25
  - !ruby/object:Gem::Version
27
26
  segments:
27
+ - 0
28
+ segments_generated: true
29
+ version: "0"
30
+ requirement: *id001
31
+ name: httparty
32
+ prerelease: false
33
+ type: :runtime
34
+ - !ruby/object:Gem::Dependency
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 2
41
+ - 0
28
42
  - 1
43
+ segments_generated: true
44
+ version: 2.0.1
45
+ requirement: *id002
46
+ name: mechanize
47
+ prerelease: false
48
+ type: :runtime
49
+ - !ruby/object:Gem::Dependency
50
+ version_requirements: &id003 !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ segments:
29
55
  - 2
30
- - 9
31
- version: 1.2.9
56
+ - 3
57
+ - 0
58
+ segments_generated: true
59
+ version: 2.3.0
60
+ requirement: *id003
61
+ name: rspec
62
+ prerelease: false
32
63
  type: :development
33
- version_requirements: *id001
34
64
  - !ruby/object:Gem::Dependency
35
- name: mechanize
65
+ version_requirements: &id004 !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ segments:
70
+ - 1
71
+ - 6
72
+ - 4
73
+ segments_generated: true
74
+ version: 1.6.4
75
+ requirement: *id004
76
+ name: jeweler
36
77
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
78
+ type: :development
79
+ - !ruby/object:Gem::Dependency
80
+ version_requirements: &id005 !ruby/object:Gem::Requirement
38
81
  requirements:
39
82
  - - ">="
40
83
  - !ruby/object:Gem::Version
41
84
  segments:
42
- - 2
43
85
  - 0
44
- - 1
45
- version: 2.0.1
46
- type: :runtime
47
- version_requirements: *id002
86
+ segments_generated: true
87
+ version: "0"
88
+ requirement: *id005
89
+ name: rdoc
90
+ prerelease: false
91
+ type: :development
48
92
  description: A non-GUI library to represent browser environment using WebKit Framework
49
93
  email: youpy@buycheapviagraonlinenow.com
50
94
  executables:
@@ -56,6 +100,9 @@ extra_rdoc_files:
56
100
  - README.rdoc
57
101
  files:
58
102
  - .document
103
+ - .rspec
104
+ - Gemfile
105
+ - Gemfile.lock
59
106
  - LICENSE
60
107
  - README.rdoc
61
108
  - Rakefile
@@ -75,7 +122,6 @@ files:
75
122
  - lib/grope/web_resource_load_delegate.rb
76
123
  - lib/grope/wso_wrapper.rb
77
124
  - spec/env_spec.rb
78
- - spec/spec.opts
79
125
  - spec/spec_helper.rb
80
126
  - spec/wso_wrapper_spec.rb
81
127
  has_rdoc: true
@@ -93,6 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
139
  - !ruby/object:Gem::Version
94
140
  segments:
95
141
  - 0
142
+ segments_generated: true
96
143
  version: "0"
97
144
  required_rubygems_version: !ruby/object:Gem::Requirement
98
145
  requirements:
@@ -100,6 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
147
  - !ruby/object:Gem::Version
101
148
  segments:
102
149
  - 0
150
+ segments_generated: true
103
151
  version: "0"
104
152
  requirements: []
105
153
 
data/spec/spec.opts DELETED
@@ -1 +0,0 @@
1
- --color