websnapshot 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Takashi Oguma
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -1,63 +1,19 @@
1
1
  = websnapshot
2
2
 
3
- * http://github.com/bearmini/websnapshot
3
+ Description goes here.
4
4
 
5
- == DESCRIPTION:
5
+ == Contributing to websnapshot
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
6
14
 
7
- This is an application and a library to capture images of web pages.
15
+ == Copyright
8
16
 
9
- == FEATURES/PROBLEMS:
17
+ Copyright (c) 2011 Takashi Oguma. See LICENSE.txt for
18
+ further details.
10
19
 
11
- * You can take a snapshot image of an web page.
12
- * You can specify dimensions of an artifact image.
13
- * You can specify delay before taking a snapshot. (not implemented yet. planed)
14
-
15
- == SYNOPSIS:
16
-
17
- $ websnapshot http://google.com
18
-
19
- == REQUIREMENTS:
20
-
21
- * For Ubuntu
22
- $ sudo apt-get install ruby-gnome2-dev webkit-1.0 libgtk2.0-dev
23
-
24
- install https://github.com/danlucraft/rbwebkitgtk
25
-
26
-
27
- * For Mac OS X
28
-
29
- $ sudo port install rb-gnome webkit-gtk
30
-
31
- (You may need Xcode installed)
32
-
33
- install https://github.com/danlucraft/rbwebkitgtk
34
-
35
-
36
- == INSTALL:
37
-
38
- * sudo gem install websnapshot
39
-
40
- == LICENSE:
41
-
42
- (The MIT License)
43
-
44
- Copyright (c) 2011 FIXME full name
45
-
46
- Permission is hereby granted, free of charge, to any person obtaining
47
- a copy of this software and associated documentation files (the
48
- 'Software'), to deal in the Software without restriction, including
49
- without limitation the rights to use, copy, modify, merge, publish,
50
- distribute, sublicense, and/or sell copies of the Software, and to
51
- permit persons to whom the Software is furnished to do so, subject to
52
- the following conditions:
53
-
54
- The above copyright notice and this permission notice shall be
55
- included in all copies or substantial portions of the Software.
56
-
57
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
58
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
59
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
60
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
61
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
62
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
63
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/websnapshot CHANGED
File without changes
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websnapshot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 3
10
- version: 0.0.3
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Takashi Oguma
@@ -15,12 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-04 00:00:00 Z
18
+ date: 2011-05-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: gtk2
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
22
  none: false
25
23
  requirements:
26
24
  - - ">="
@@ -31,63 +29,107 @@ dependencies:
31
29
  - 90
32
30
  - 8
33
31
  version: 0.90.8
32
+ name: gtk2
33
+ prerelease: false
34
34
  type: :runtime
35
- version_requirements: *id001
35
+ requirement: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: hoe
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 2
45
+ - 3
46
+ - 0
47
+ version: 2.3.0
48
+ name: rspec
38
49
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
50
+ type: :development
51
+ requirement: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
40
54
  none: false
41
55
  requirements:
42
56
  - - ">="
43
57
  - !ruby/object:Gem::Version
44
- hash: 35
58
+ hash: 3
45
59
  segments:
46
- - 2
47
- - 9
48
- - 4
49
- version: 2.9.4
60
+ - 0
61
+ version: "0"
62
+ name: cucumber
63
+ prerelease: false
64
+ type: :development
65
+ requirement: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ hash: 23
73
+ segments:
74
+ - 1
75
+ - 0
76
+ - 0
77
+ version: 1.0.0
78
+ name: bundler
79
+ prerelease: false
50
80
  type: :development
51
- version_requirements: *id002
52
- description: This is an application and a library to capture images of web pages.
53
- email:
54
- - bear.mini@gmail.com
81
+ requirement: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ version_requirements: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ hash: 15
89
+ segments:
90
+ - 1
91
+ - 6
92
+ - 0
93
+ version: 1.6.0
94
+ name: jeweler
95
+ prerelease: false
96
+ type: :development
97
+ requirement: *id005
98
+ - !ruby/object:Gem::Dependency
99
+ version_requirements: &id006 !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ name: rcov
109
+ prerelease: false
110
+ type: :development
111
+ requirement: *id006
112
+ description: "This gem provide you with the following features: blah blah blah"
113
+ email: bear.mini@gmail.com
55
114
  executables:
56
115
  - websnapshot
57
116
  extensions: []
58
117
 
59
118
  extra_rdoc_files:
60
- - History.txt
61
- - Manifest.txt
62
- - PostInstall.txt
63
- files:
64
- - History.txt
65
- - Manifest.txt
66
- - PostInstall.txt
119
+ - LICENSE.txt
67
120
  - README.rdoc
68
- - Rakefile
69
- - bin/websnapshot
70
- - dependencies.memo.text
121
+ files:
71
122
  - lib/websnapshot.rb
72
123
  - lib/websnapshot/cli.rb
73
- - script/console
74
- - script/destroy
75
- - script/generate
76
- - spec/spec.opts
77
- - spec/spec_helper.rb
78
- - spec/websnapshot_spec.rb
79
- - tasks/rspec.rake
80
- - test/test_helper.rb
81
- - test/test_websnapshot.rb
82
- - test/test_websnapshot_cli.rb
83
- - .gemtest
124
+ - LICENSE.txt
125
+ - README.rdoc
126
+ - bin/websnapshot
84
127
  homepage: http://github.com/bearmini/websnapshot
85
- licenses: []
128
+ licenses:
129
+ - MIT
130
+ post_install_message:
131
+ rdoc_options: []
86
132
 
87
- post_install_message: PostInstall.txt
88
- rdoc_options:
89
- - --main
90
- - README.rdoc
91
133
  require_paths:
92
134
  - lib
93
135
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -110,12 +152,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
152
  version: "0"
111
153
  requirements: []
112
154
 
113
- rubyforge_project: websnapshot
155
+ rubyforge_project:
114
156
  rubygems_version: 1.7.2
115
157
  signing_key:
116
158
  specification_version: 3
117
- summary: This is an application and a library to capture images of web pages.
118
- test_files:
119
- - test/test_helper.rb
120
- - test/test_websnapshot.rb
121
- - test/test_websnapshot_cli.rb
159
+ summary: This application takes snapshot images of web pages.
160
+ test_files: []
161
+
data/.gemtest DELETED
File without changes
data/History.txt DELETED
@@ -1,4 +0,0 @@
1
- === 0.0.1 2011-04-12
2
-
3
- * 1 major enhancement:
4
- * Initial release
data/Manifest.txt DELETED
@@ -1,19 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- PostInstall.txt
4
- README.rdoc
5
- Rakefile
6
- bin/websnapshot
7
- dependencies.memo.text
8
- lib/websnapshot.rb
9
- lib/websnapshot/cli.rb
10
- script/console
11
- script/destroy
12
- script/generate
13
- spec/spec.opts
14
- spec/spec_helper.rb
15
- spec/websnapshot_spec.rb
16
- tasks/rspec.rake
17
- test/test_helper.rb
18
- test/test_websnapshot.rb
19
- test/test_websnapshot_cli.rb
data/PostInstall.txt DELETED
@@ -1,3 +0,0 @@
1
-
2
- For more information on websnapshot, see http://websnapshot.rubyforge.org
3
-
data/Rakefile DELETED
@@ -1,26 +0,0 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/websnapshot'
6
-
7
- Hoe.plugin :newgem
8
- # Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
10
-
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- $hoe = Hoe.spec 'websnapshot' do
14
- self.developer 'Takashi Oguma', 'bear.mini@gmail.com'
15
- self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
- self.rubyforge_name = self.name # TODO this is default value
17
- self.extra_deps = [['gtk2','>= 0.90.8']]
18
-
19
- end
20
-
21
- require 'newgem/tasks'
22
- Dir['tasks/**/*.rake'].each { |t| load t }
23
-
24
- # TODO - want other tests/tasks run by default? Add them to the list
25
- # remove_task :default
26
- # task :default => [:spec, :features]
@@ -1,10 +0,0 @@
1
-
2
- = Install Prerequisite Packages
3
-
4
- Ubuntu:
5
- $ sudo apt-get install ruby-gnome2-dev webkit-1.0 libgtk2.0-dev
6
- # atk1.0 libcairo2-dev
7
-
8
- Mac OS X:
9
- $ sudo port install rb-gnome webkit-gtk
10
-
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/websnapshot.rb'}"
9
- puts "Loading websnapshot gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
data/spec/spec.opts DELETED
@@ -1 +0,0 @@
1
- --colour
data/spec/spec_helper.rb DELETED
@@ -1,10 +0,0 @@
1
- begin
2
- require 'rspec'
3
- rescue LoadError
4
- require 'rubygems' unless ENV['NO_RUBYGEMS']
5
- gem 'rspec'
6
- require 'rspec'
7
- end
8
-
9
- $:.unshift(File.dirname(__FILE__) + '/../lib')
10
- require 'websnapshot'
@@ -1,45 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- def tidy(fname)
4
- File.unlink(fname)
5
- end
6
-
7
- def image_size(fname)
8
- %x{file #{fname}} =~ /([0-9]+ x [0-9]+)/
9
- return $1
10
- end
11
-
12
-
13
- describe Websnapshot do
14
- describe 'take' do
15
- it 'returns a saved file name in relative form' do
16
- fname = Websnapshot.take('spec/testpage_960x640.html')
17
- fname.should == 'snapshot.png'
18
- tidy fname
19
- end
20
-
21
- context 'only a URL is specified' do
22
- context 'the URL is point to a local file' do
23
- it "saves 960x640 snapshot.png for 960x640 page without any options" do
24
- fname = Websnapshot.take('spec/testpage_960x640.html')
25
- fname.should == 'snapshot.png'
26
- image_size(fname).should == '960 x 640'
27
- tidy fname
28
- end
29
- end
30
-
31
- context 'the URL is point to a remote file (http)' do
32
- end
33
-
34
- context 'the URL is point to a remote file (https)' do
35
- end
36
- end
37
-
38
- context 'a URL and size options are specified' do
39
- end
40
-
41
- context 'a specified URL cannot be loaded' do
42
- end
43
- end
44
-
45
- end
data/tasks/rspec.rake DELETED
@@ -1,20 +0,0 @@
1
- begin
2
- require 'rspec'
3
- rescue LoadError
4
- require 'rubygems' unless ENV['NO_RUBYGEMS']
5
- require 'rspec'
6
- end
7
- begin
8
- require 'rspec/core/rake_task'
9
- rescue LoadError
10
- puts <<-EOS
11
- To use rspec for testing you must install rspec gem:
12
- gem install rspec
13
- EOS
14
- exit(0)
15
- end
16
-
17
- desc "Run the specs under spec/models"
18
- RSpec::Core::RakeTask.new(:spec) do |t|
19
- t.rspec_opts = ['--options', "spec/spec.opts"]
20
- end
data/test/test_helper.rb DELETED
@@ -1,3 +0,0 @@
1
- require 'stringio'
2
- require 'test/unit'
3
- require File.dirname(__FILE__) + '/../lib/websnapshot'
@@ -1,49 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestWebsnapshot < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def test_take
9
- # without options
10
- Websnapshot.take('http://google.co.jp')
11
- assert_image('screenshot.png', 960, 640, 'png')
12
-
13
- Websnapshot.take('testpage_128x128.html')
14
- assert_image('screenshot.png', 128, 128, 'png')
15
-
16
- Websnapshot.take('testpage_1280x720.html')
17
- assert_image('screenshot.png', 960, 640, 'png')
18
-
19
- # with max_width option
20
- Websnapshot.take('testpage_960x640.html', :max_width => 320)
21
- assert_image('screenshot.png', 320, 640, 'png')
22
-
23
- Websnapshot.take('testpage_128x128.html', :max_width => 320)
24
- assert_image('screenshot.png', 128, 128, 'png')
25
-
26
- Websnapshot.take('testpage_1280x720.html', :max_width => 320)
27
- assert_image('screenshot.png', 320, 640, 'png')
28
-
29
- # with max_height option
30
- Websnapshot.take('testpage_960x640.html', :max_height => 240)
31
- assert_image('screenshot.png', 960, 240, 'png')
32
-
33
- Websnapshot.take('testpage_128x128.html', :max_height => 240)
34
- assert_image('screenshot.png', 128, 128, 'png')
35
-
36
- Websnapshot.take('testpage_1280x720.html', :max_height => 240)
37
- assert_image('screenshot.png', 960, 240, 'png')
38
-
39
- # with max_width and max_height options
40
-
41
- # with output_filename option
42
-
43
- # with output_format option
44
- end
45
-
46
- def assert_image(filename, expected_width, expected_height, expected_image_format)
47
- end
48
-
49
- end
@@ -1,14 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "test_helper.rb")
2
- require 'websnapshot/cli'
3
-
4
- class TestWebsnapshotCli < Test::Unit::TestCase
5
- def setup
6
- Websnapshot::CLI.execute(@stdout_io = StringIO.new, [])
7
- @stdout_io.rewind
8
- @stdout = @stdout_io.read
9
- end
10
-
11
- def test_print_default_output
12
- assert_match(/To update this executable/, @stdout)
13
- end
14
- end