commitshots 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/commitshots.rb +47 -0
  2. metadata +45 -0
@@ -0,0 +1,47 @@
1
+ require 'optparse'
2
+ require 'commits'
3
+
4
+ options = {}
5
+
6
+ optparse = OptionParser.new do|opts|
7
+ # Set a banner, displayed at the top
8
+ # of the help screen.
9
+ opts.banner = "Usage: commitshots [OPTIONS] url"
10
+
11
+
12
+ options[:width] = 800
13
+ opts.on( '--width WIDTH', 'Width of the browser window' ) do |width|
14
+ options[:width] = width
15
+ end
16
+
17
+ options[:height] = 600
18
+ opts.on( '--height HEIGHT', 'Height of the browser window' ) do |height|
19
+ options[:height] = height
20
+ end
21
+
22
+ # This displays the help screen, all programs are
23
+ # assumed to have this option.
24
+ opts.on( '-h', '--help', 'Display this screen' ) do
25
+ puts opts
26
+ exit
27
+ end
28
+ end
29
+
30
+ optparse.parse!
31
+
32
+ phantomScript = File.join(File.dirname(__FILE__), 'lib/screenshot.js')
33
+ url = ARGV[0]
34
+ width = options[:width]
35
+ height = options[:height]
36
+
37
+ num = 0
38
+ baseFileName = 'screenshots/image-'
39
+ fileType = 'png'
40
+ waitTime = 0.5
41
+
42
+ Commitshots::Commits.new.each do |id, msg|
43
+ sleep(waitTime)
44
+ fileName = "#{baseFileName}#{"%08d" % num}.#{fileType}"
45
+ `phantomjs #{phantomScript} "#{url}" "#{fileName}" #{width} #{height}`
46
+ num = num + 1
47
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: commitshots
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Claus Witt
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: a little utility to create a screenshot from each commit of a project
15
+ email: wittnezz@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/commitshots.rb
21
+ homepage: http://rubygems.org/gems/commitshots
22
+ licenses: []
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 1.8.24
42
+ signing_key:
43
+ specification_version: 3
44
+ summary: commitshots
45
+ test_files: []