lolcommits 0.3.1 → 0.3.2.pre1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -4,12 +4,19 @@ rvm:
4
4
  - 1.9.2
5
5
  - 1.9.3
6
6
  - ruby-head
7
+ - jruby
7
8
 
8
9
  before_install:
9
- - sudo apt-get -qq update
10
- - sudo apt-get -qq -y install mplayer libmagick9-dev
10
+ # - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192
11
+ - sudo apt-get update -qq
12
+ - sudo apt-get install -qq -y mplayer imagemagick libmagickwand-dev
11
13
 
12
14
  #test against ruby-head as well so we know what's coming down the pipe
13
15
  matrix:
14
16
  allow_failures:
15
17
  - rvm: ruby-head
18
+ - rvm: jruby
19
+
20
+ branches:
21
+ except:
22
+ - gh-pages
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 0.3.2 (in development)
2
+ * Twitter posting support via the `twitter` plugin! (thx @coyboyrushforth!)
3
+
1
4
  0.3.1 (5 August 2012)
2
5
  * fix regression with linux capture introduced in previous version
3
6
 
data/CONTRIBUTING ADDED
@@ -0,0 +1,11 @@
1
+ GUIDELINES FOR CONTRIBUTING
2
+
3
+ 1. Fork it
4
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
5
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
6
+ 4. Push to the branch (`git push origin my-new-feature`)
7
+ 5. Create new Pull Request
8
+
9
+ You can run the existing test-suite via `rake`. Ensure nothing is broken, but since the test since is far from complete, it'd be awesome if you manually tested for regressions as well.
10
+
11
+ Please, if at all possible, write a passing test for the functionality you added.
data/README.md CHANGED
@@ -31,31 +31,29 @@ Install dependencies using your package manager of choice, for example in Ubuntu
31
31
 
32
32
  sudo apt-get install mplayer imagemagick libmagickwand-dev
33
33
 
34
- On Fedora, enable the rpmfusion repository (for mplayer) and run:
35
-
36
- sudo yum install ImageMagick ImageMagick-devel mplayer
37
-
38
34
  Then install the lolcommits gem:
39
35
 
40
36
  gem install lolcommits
41
37
 
42
38
  Then you can `lolcommits --enable` in any git repo as above.
43
39
 
40
+ For more details, see [Installing on Linux](https://github.com/mroth/lolcommits/wiki/Installing-on-Linux).
41
+
44
42
  ## Installation (Windows)
45
43
  See the wiki page for [Installing on Windows](https://github.com/mroth/lolcommits/wiki/Installing-on-Windows).
46
44
 
47
45
  ## Sample images
48
- <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample2.jpg" />
46
+ <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/assets/img/sample_old/sample2.jpg" />
49
47
  &nbsp;
50
- <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample5.jpg" />
48
+ <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/assets/img/sample_old/sample5.jpg" />
51
49
  <br/>
52
- <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample4.jpg" />
50
+ <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/assets/img/sample_old/sample4.jpg" />
53
51
  &nbsp;
54
- <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample6.jpg" />
52
+ <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/assets/img/sample_old/sample6.jpg" />
55
53
  <br/>
56
- <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample7.jpg" />
54
+ <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/assets/img/sample_old/sample7.jpg" />
57
55
  &nbsp;
58
- <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample8.jpg" />
56
+ <img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/assets/img/sample_old/sample8.jpg" />
59
57
  <br/>
60
58
  <a href="http://github.com/sfsekaran/"><img width='320' height='240' src="http://cl.ly/252S0o1J3x3n1b1k251N/d5f80e4f88a.jpg" /></a>
61
59
  &nbsp;
@@ -80,15 +78,5 @@ environment variables.
80
78
  * TRANZLATE YOAR COMMIT_MSG TO LOLSPEKK - do
81
79
  `lolcommits --config -p tranzlate` and set enabled to `true`.
82
80
 
83
- ## Contributing
84
-
85
- 1. Fork it
86
- 2. Create your feature branch (`git checkout -b my-new-feature`)
87
- 3. Commit your changes (`git commit -am 'Added some feature'`)
88
- 4. Push to the branch (`git push origin my-new-feature`)
89
- 5. Create new Pull Request
90
-
91
- Please, if at all possible, write a passing test for the functionality you added.
92
-
93
81
  ## Troubles?
94
82
  Started a [FAQ](https://github.com/mroth/lolcommits/wiki/FAQ).
data/bin/lolcommits CHANGED
@@ -22,7 +22,7 @@ def command?(name)
22
22
  end
23
23
 
24
24
  if Configuration.is_mac?
25
- unless File.executable? File.join(Configuration::LOLCOMMITS_ROOT, "ext", "imagesnap", "imagesnap")
25
+ unless File.executable? File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "ext", "imagesnap", "imagesnap")
26
26
  puts "Couldn't properly execute imagesnap for some reason, please file a bug?!"
27
27
  exit 1
28
28
  end
@@ -32,7 +32,7 @@ elsif Configuration.is_linux?
32
32
  exit 1
33
33
  end
34
34
  end
35
- unless File.readable? File.join(Configuration::LOLCOMMITS_ROOT, "fonts", "Impact.ttf")
35
+ unless File.readable? File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "fonts", "Impact.ttf")
36
36
  puts "Couldn't properly read Impact font from gem package, please file a bug?!"
37
37
  exit 1
38
38
  end
@@ -7,24 +7,45 @@ Feature: Bug regression testing
7
7
  # issue #58, https://github.com/mroth/lolcommits/issues/58
8
8
  #
9
9
  Scenario: handle git repos with spaces in directory name
10
- Given a git repository named "test lolol"
11
- And an empty file named "test lolol/FOOBAR"
12
-
13
- When I cd to "test lolol"
14
- And I successfully run `lolcommits --enable`
15
- And I successfully run `git add .`
16
- And I successfully run `git commit -m 'can haz commit'`
10
+ Given I am in a git repository named "test lolol" with lolcommits enabled
11
+ And I successfully run `git commit --allow-empty -m 'can haz commit'`
17
12
  Then the output should contain "*** Preserving this moment in history."
18
13
  And a directory named "../.lolcommits/test-lolol" should exist
19
14
 
20
-
21
15
  #
22
- # issue #53, https://github.com/mroth/lolcommits/issues/53
16
+ # issue #68, https://github.com/mroth/lolcommits/issues/68
23
17
  #
24
- #@fake-root @simulate-env
25
- #Scenario: error if can't read font file
26
- # Given "fonts/Impact.ttf" packaged file is not readable
27
- # When I run `lolcommits --test --capture`
28
- # Then the output should contain "Couldn't properly read Impact font from gem package"
29
- # And the exit status should be 1
18
+ #@focus
19
+ #Scenario: Don't trigger capture during a git rebase
20
+ # Given I am in a git repository named "yuh8history" with lolcommits enabled
21
+ # And I do a git commit
22
+ # And I successfully run `git tag 'vA'`
23
+ # And I do a git commit
24
+ # And I successfully run `git tag 'vB'`
25
+ # And I do a git commit
26
+ # And I successfully run `git tag 'vC'`
27
+ # And I do a git commit
28
+ # And I successfully run `git tag 'vD'`
29
+ # And I do a git commit
30
+ # And I successfully run `git tag 'vE'`
31
+ # And I do a git commit
32
+ # And I successfully run `git tag 'vF'`
33
+ # And I successfully run `git checkout vB`
34
+ # And I successfully run `git reset --soft master`
35
+ # And I successfully run `git merge --squash vD`
36
+ # When I successfully run `git rebase --onto $(cat .git/HEAD) vE vF`
37
+ # # When I successfully run `git rebase placeholder`
38
+ # Then there should be 4 commit entries in the git log
39
+ # # But there should be exactly 5 jpgs in "../.lolcommits/yuh8history"
40
+
41
+ # Given I am in a git repository named "yuh8history" with lolcommits enabled
42
+ # And I do 2 git commits
43
+ # And I successfully run `git branch middle`
44
+ # And I do 2 git commits
45
+ # And I successfully run `git branch placeholder`
46
+ # And I successfully run `git checkout middle`
47
+ # And I do 2 git commits
48
+ # When I successfully run `git rebase placeholder`
49
+ # Then there should be 6 commit entries in the git log
50
+ # But there should be exactly 6 jpgs in "../.lolcommits/yuh8history"
30
51
 
@@ -10,50 +10,41 @@ Feature: Basic UI functionality
10
10
  When I cd to "loltest"
11
11
  And I successfully run `lolcommits --enable`
12
12
  Then the output should contain "installed lolcommmit hook as:"
13
- And the output should contain "(to remove later, you can use: lolcommits --disable)"
14
- And a file named ".git/hooks/post-commit" should exist
15
- And the exit status should be 0
13
+ And the output should contain "(to remove later, you can use: lolcommits --disable)"
14
+ And a file named ".git/hooks/post-commit" should exist
15
+ And the exit status should be 0
16
16
 
17
17
  Scenario: Disable in a enabled git repository
18
- Given a git repository named "lolenabled" with a "post-commit" hook
19
- When I cd to "lolenabled"
20
- And I successfully run `lolcommits --disable`
18
+ Given I am in a git repository named "lolenabled" with lolcommits enabled
19
+ When I successfully run `lolcommits --disable`
21
20
  Then the output should contain "removed"
22
- And a file named ".git/hooks/post-commit" should not exist
23
- And the exit status should be 0
21
+ And a file named ".git/hooks/post-commit" should not exist
22
+ And the exit status should be 0
24
23
 
25
24
  Scenario: Trying to enable while not in a git repo fails
26
- Given a directory named "svnrulez"
27
- When I cd to "svnrulez"
28
- And I run `lolcommits --enable`
25
+ Given I am in a directory named "svnrulez"
26
+ When I run `lolcommits --enable`
29
27
  Then the output should contain "You don't appear to be in the base directory of a git project."
30
- And the exit status should be 1
28
+ And the exit status should be 1
31
29
 
32
30
  Scenario: Commiting in an enabled repo triggers successful capture
33
- Given a git repository named "testcapture"
34
- And an empty file named "testcapture/FOOBAR"
35
- When I cd to "testcapture"
36
- And I successfully run `lolcommits --enable`
37
- And I successfully run `git add .`
38
- And I successfully run `git commit -m 'can haz commit'`
31
+ Given I am in a git repository named "testcapture" with lolcommits enabled
32
+ When I do a git commit
39
33
  Then the output should contain "*** Preserving this moment in history."
40
- And a directory named "../.lolcommits/testcapture" should exist
41
- And a file named "../.lolcommits/testcapture/tmp_snapshot.jpg" should not exist
42
- And there should be 1 jpg in "../.lolcommits/testcapture"
34
+ And a directory named "../.lolcommits/testcapture" should exist
35
+ And a file named "../.lolcommits/testcapture/tmp_snapshot.jpg" should not exist
36
+ And there should be exactly 1 jpg in "../.lolcommits/testcapture"
43
37
 
44
38
  Scenario: Commiting in an enabled repo subdirectory triggers successful capture of parent repo
45
- Given a git repository named "testcapture"
46
- And a directory named "testcapture/subdir"
47
- And an empty file named "testcapture/subdir/FOOBAR"
48
- When I cd to "testcapture/"
49
- And I successfully run `lolcommits --enable`
50
- Then I cd to "subdir/"
51
- And I successfully run `git add .`
52
- And I successfully run `git commit -m 'can haz commit'`
39
+ Given I am in a git repository named "testcapture" with lolcommits enabled
40
+ And a directory named "subdir"
41
+ And an empty file named "subdir/FOOBAR"
42
+ When I cd to "subdir/"
43
+ And I do a git commit
53
44
  Then the output should contain "*** Preserving this moment in history."
54
- And a directory named "../../.lolcommits/testcapture" should exist
55
- And a file named "../../.lolcommits/testcapture/tmp_snapshot.jpg" should not exist
56
- And there should be 1 jpg in "../../.lolcommits/testcapture"
45
+ And a directory named "../../.lolcommits/testcapture" should exist
46
+ And a directory named "../../.lolcommits/subdir" should not exist
47
+ And there should be exactly 1 jpg in "../../.lolcommits/testcapture"
57
48
 
58
49
  Scenario: Show plugins
59
50
  When I successfully run `lolcommits --plugins`
@@ -103,33 +94,30 @@ Feature: Basic UI functionality
103
94
  And the output should contain "enabled: true"
104
95
 
105
96
  Scenario: test capture should work regardless of whether in a git repository
106
- Given a directory named "nothingtoseehere"
107
- When I cd to "nothingtoseehere"
108
- And I run `lolcommits --test --capture`
97
+ Given I am in a directory named "nothingtoseehere"
98
+ When I run `lolcommits --test --capture`
109
99
  Then the output should contain "*** Capturing in test mode."
110
- And the output should not contain "path does not exist (ArgumentError)"
111
- And the exit status should be 0
100
+ And the output should not contain "path does not exist (ArgumentError)"
101
+ And the exit status should be 0
112
102
 
113
103
  Scenario: test capture should store in its own test directory
114
- Given a git repository named "randomgitrepo"
115
- When I cd to "randomgitrepo"
116
- And I successfully run `lolcommits --test --capture`
104
+ Given I am in a git repository named "randomgitrepo" with lolcommits enabled
105
+ When I successfully run `lolcommits --test --capture`
117
106
  Then a directory named "../.lolcommits/test" should exist
118
107
  And a directory named "../.lolcommits/randomgitrepo" should not exist
119
108
 
120
109
  Scenario: last command should work properly when in a lolrepo
121
110
  Given a git repository named "randomgitrepo"
122
- And a loldir named "randomgitrepo" with 2 lolimages
123
- And I cd to "randomgitrepo"
111
+ And a loldir named "randomgitrepo" with 2 lolimages
112
+ And I cd to "randomgitrepo"
124
113
  When I run `lolcommits --last`
125
114
  Then the exit status should be 0
126
115
 
127
116
  Scenario: last command should fail gracefully if not in a lolrepo
128
- Given a directory named "gitsuxcvs4eva"
129
- And I cd to "gitsuxcvs4eva"
117
+ Given I am in a directory named "gitsuxcvs4eva"
130
118
  When I run `lolcommits --last`
131
119
  Then the output should contain "Can't do that since we're not in a valid git repository!"
132
- Then the exit status should be 1
120
+ And the exit status should be 1
133
121
 
134
122
  Scenario: last command should fail gracefully if zero lolimages in lolrepo
135
123
  Given a git repository named "randomgitrepo"
@@ -141,15 +129,14 @@ Feature: Basic UI functionality
141
129
 
142
130
  Scenario: browse command should work properly when in a lolrepo
143
131
  Given a git repository named "randomgitrepo"
144
- And a loldir named "randomgitrepo" with 2 lolimages
145
- And I cd to "randomgitrepo"
132
+ And a loldir named "randomgitrepo" with 2 lolimages
133
+ And I cd to "randomgitrepo"
146
134
  When I run `lolcommits --browse`
147
135
  Then the exit status should be 0
148
136
 
149
137
  Scenario: browse command should fail gracefully when not in a lolrepo
150
- Given a directory named "gitsuxcvs4eva"
151
- And I cd to "gitsuxcvs4eva"
138
+ Given I am in a directory named "gitsuxcvs4eva"
152
139
  When I run `lolcommits --browse`
153
140
  Then the output should contain "Can't do that since we're not in a valid git repository!"
154
- Then the exit status should be 1
141
+ And the exit status should be 1
155
142
 
@@ -15,7 +15,7 @@ Feature: Plugins Work
15
15
  When I successfully run `git add .`
16
16
  And I successfully run `git commit -m 'can haz commit'`
17
17
  Then the output should contain "*** Preserving this moment in history."
18
- And there should be 1 jpg in "../.lolcommits/dot_com"
18
+ And there should be exactly 1 jpg in "../.lolcommits/dot_com"
19
19
 
20
20
  Scenario: Disable loltext
21
21
  Given a git repository named "loltext"
@@ -29,5 +29,5 @@ Feature: Plugins Work
29
29
  When I successfully run `git add .`
30
30
  And I successfully run `git commit -m 'can haz commit'`
31
31
  Then the output should contain "*** Preserving this moment in history."
32
- And there should be 1 jpg in "../.lolcommits/loltext"
32
+ And there should be exactly 1 jpg in "../.lolcommits/loltext"
33
33
 
@@ -1,11 +1,19 @@
1
1
  include FileUtils
2
2
 
3
+ Given /^I am in a directory named "(.*?)"$/ do |dir_name|
4
+ steps %Q{
5
+ Given a directory named "#{dir_name}"
6
+ And I cd to "#{dir_name}"
7
+ }
8
+ end
3
9
 
4
10
  Given /^a git repository named "(.*?)"$/ do |repo_name|
5
11
  repo_dir = File.join current_dir, repo_name
6
12
  mkdir_p repo_dir
7
13
  Dir.chdir repo_dir do
8
14
  sh "git init --quiet ."
15
+ sh "git config user.name 'Testy McTesterson'"
16
+ sh "git config user.email 'testy@tester.com'"
9
17
  end
10
18
  end
11
19
 
@@ -24,6 +32,14 @@ Given /^a git repository named "(.*?)" with (a|no) "(.*?)" hook$/ do |repo_name,
24
32
  step %{the git repository named "#{repo_name}" has #{yesno_modifier} "#{hook_name}" hook}
25
33
  end
26
34
 
35
+ Given /^I am in a git repository named "(.*?)" with lolcommits enabled$/ do |repo_name|
36
+ steps %Q{
37
+ Given a git repository named "#{repo_name}"
38
+ And I cd to "#{repo_name}"
39
+ And I successfully run `lolcommits --enable`
40
+ }
41
+ end
42
+
27
43
  When /^I run `(.*?)` and wait for output$/ do |command|
28
44
  command = "cd #{current_dir} && #{command}"
29
45
  @stdin, @stdout, @stderr = Open3.popen3(command)
@@ -48,10 +64,33 @@ When /^I enter "(.*?)" for "(.*?)"$/ do |input, field|
48
64
  @stdin.puts input
49
65
  end
50
66
 
51
- Then /^there should be (.*?) jpg(|s) in "(.*?)"$/ do |n, _, folder|
67
+ Then /^there should be (?:exactly|only) (.*?) jpg(?:s?) in "(.*?)"$/ do |n, folder|
52
68
  assert_equal n.to_i, Dir["#{current_dir}/#{folder}/*.jpg"].count
53
69
  end
54
70
 
55
71
  Then /^the output should contain a list of plugins$/ do
56
72
  step %{the output should contain "Available plugins: "}
57
- end
73
+ end
74
+
75
+ When /^I do a git commit with commit message "(.*?)"$/ do |commit_msg|
76
+ filename = Faker::Lorem.words(1).first
77
+ step %{a 98 byte file named "#{filename}"}
78
+ step %{I successfully run `git add #{filename}`}
79
+ step %{I successfully run `git commit -m "#{commit_msg}"`}
80
+ end
81
+
82
+ When /^I do a git commit$/ do
83
+ commit_msg = Faker::Lorem.sentence
84
+ step %{I do a git commit with commit message "#{commit_msg}"}
85
+ end
86
+
87
+ When /^I do (\d+) git commits$/ do |n|
88
+ n.to_i.times do
89
+ step %{I do a git commit}
90
+ end
91
+ end
92
+
93
+ Then /^there should be (\d+) commit entries in the git log$/ do |n|
94
+ #sleep 1
95
+ assert_equal n.to_i, `git shortlog | grep -E '^[ ]+\w+' | wc -l`.chomp.to_i
96
+ end
@@ -3,6 +3,7 @@ require 'methadone/cucumber'
3
3
  require 'open3'
4
4
  require 'test/unit/assertions'
5
5
  include Test::Unit::Assertions
6
+ require 'faker'
6
7
 
7
8
  ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
8
9
  LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
@@ -10,15 +11,19 @@ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
10
11
  Before do
11
12
  # Using "announce" causes massive warnings on 1.9.2
12
13
  @puts = true
13
- @original_rubylib = ENV['RUBYLIB']
14
14
  @aruba_timeout_seconds = 20
15
+
16
+ @original_rubylib = ENV['RUBYLIB']
15
17
  ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
16
18
 
17
19
  @original_fakecapture = ENV['LOLCOMMITS_FAKECAPTURE']
18
20
  ENV['LOLCOMMITS_FAKECAPTURE'] = "1"
19
21
 
20
- @original_loldir = ENV['LOLCOMMITS_DIR']
21
- ENV['LOLCOMMITS_DIR'] = File.expand_path( File.join(current_dir, ".lolcommits") )
22
+ # @original_loldir = ENV['LOLCOMMITS_DIR']
23
+ # ENV['LOLCOMMITS_DIR'] = File.expand_path( File.join(current_dir, ".lolcommits") )
24
+
25
+ @original_home = ENV['HOME']
26
+ ENV['HOME'] = File.expand_path( current_dir )
22
27
 
23
28
  ENV['LAUNCHY_DRY_RUN'] = 'true'
24
29
  end
@@ -26,20 +31,7 @@ end
26
31
  After do
27
32
  ENV['RUBYLIB'] = @original_rubylib
28
33
  ENV['LOLCOMMITS_FAKECAPTURE'] = @original_fakecapture
29
- ENV['LOLCOMMITS_DIR'] = @original_loldir
34
+ # ENV['LOLCOMMITS_DIR'] = @original_loldir
35
+ ENV['HOME'] = @original_home
30
36
  ENV['LAUNCHY_DRY_RUN'] = nil
31
37
  end
32
-
33
- # ###moved the below into env for everything
34
- # Before('@simulate-env') do
35
- # @original_fakecapture = ENV['LOLCOMMITS_FAKECAPTURE']
36
- # ENV['LOLCOMMITS_FAKECAPTURE'] = "1"
37
-
38
- # @original_loldir = ENV['LOLCOMMITS_DIR']
39
- # ENV['LOLCOMMITS_DIR'] = File.join(current_dir, ".lolcommits")
40
- # end
41
-
42
- # After('@simulate-env') do
43
- # ENV['LOLCOMMITS_FAKECAPTURE'] = @original_fakecapture
44
- # ENV['LOLCOMMITS_DIR'] = @original_loldir
45
- # end
@@ -11,7 +11,7 @@ module Lolcommits
11
11
  private
12
12
 
13
13
  def imagesnap_bin
14
- File.join(Configuration::LOLCOMMITS_ROOT, "ext", "imagesnap", "imagesnap")
14
+ File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "ext", "imagesnap", "imagesnap")
15
15
  end
16
16
  end
17
17
  end
@@ -1,7 +1,7 @@
1
1
  module Lolcommits
2
2
  class CaptureWindows < Capturer
3
3
  def capture
4
- commandcam_exe = File.join Configuration::LOLCOMMITS_ROOT, "ext", "CommandCam", "CommandCam.exe"
4
+ commandcam_exe = File.join Configuration::LOLCOMMITS_ROOT, "vendor", "ext", "CommandCam", "CommandCam.exe"
5
5
  # DirectShow takes a while to show... at least for me anyway
6
6
  delaycmd = " /delay 3000"
7
7
  if capture_delay > 0
@@ -71,7 +71,7 @@ module Lolcommits
71
71
  puts "Available plugins: #{names.join(', ')}"
72
72
  end
73
73
 
74
- def do_configure!(plugin)
74
+ def do_configure!(plugin, forced_options=nil)
75
75
  if plugin.nil? || plugin.strip == ''
76
76
  puts_plugins
77
77
  print "Name of plugin to configure: "
@@ -90,14 +90,19 @@ module Lolcommits
90
90
  return
91
91
  end
92
92
 
93
- options = plugin_object.options.inject(Hash.new) do |acc, option|
94
- print "#{option}: "
95
- val = STDIN.gets.strip
96
- val = true if val == 'true'
97
- val = false if val == 'false'
93
+ if forced_options.nil?
94
+ options = plugin_object.options.inject(Hash.new) do |acc, option|
95
+ print "#{option}: "
96
+ val = STDIN.gets.strip
97
+ val = true if val == 'true'
98
+ val = false if val == 'false'
98
99
 
99
- acc.merge(option => val)
100
+ acc.merge(option => val)
101
+ end
102
+ else
103
+ options = forced_options
100
104
  end
105
+
101
106
  config = self.user_configuration || Hash.new
102
107
  config[plugin] = options
103
108
  File.open(self.user_configuration_file, 'w') do |f|
@@ -109,11 +114,11 @@ module Lolcommits
109
114
  end
110
115
 
111
116
  def self.is_mac?
112
- RUBY_PLATFORM.downcase.include?("darwin")
117
+ RUBY_PLATFORM.to_s.downcase.include?("darwin")
113
118
  end
114
119
 
115
120
  def self.is_linux?
116
- RUBY_PLATFORM.downcase.include?("linux")
121
+ RUBY_PLATFORM.to_s.downcase.include?("linux")
117
122
  end
118
123
 
119
124
  def self.is_windows?
@@ -0,0 +1,99 @@
1
+ require 'yaml'
2
+ require 'twitter'
3
+ require 'oauth'
4
+
5
+ TWITTER_CONSUMER_KEY = 'qc096dJJCxIiqDNUqEsqQ'
6
+ TWITTER_CONSUMER_SECRET = 'rvjNdtwSr1H0TvBvjpk6c4bvrNydHmmbvv7gXZQI'
7
+
8
+ module Lolcommits
9
+
10
+ class LolTwitter < Plugin
11
+
12
+ def initialize(runner)
13
+ super
14
+ self.name = 'twitter'
15
+ self.default = false
16
+ end
17
+
18
+ def initial_twitter_auth
19
+ puts "\n--------------------------------------------"
20
+ puts "Need to grab twitter tokens (first time only)"
21
+ puts "---------------------------------------------"
22
+
23
+ consumer = OAuth::Consumer.new(TWITTER_CONSUMER_KEY,
24
+ TWITTER_CONSUMER_SECRET,
25
+ :site => 'http://api.twitter.com',
26
+ :request_endpoint => 'http://api.twitter.com',
27
+ :sign_in => true)
28
+
29
+ request_token = consumer.get_request_token
30
+ rtoken = request_token.token
31
+ rsecret = request_token.secret
32
+
33
+ puts "\n1.) Open the following url in your browser, get the PIN:\n\n"
34
+ puts request_token.authorize_url
35
+ puts "\n2.) Enter PIN, then press enter:"
36
+
37
+ begin
38
+ STDOUT.flush
39
+ twitter_pin = STDIN.gets.chomp
40
+ rescue
41
+ end
42
+
43
+ if (twitter_pin.nil?) || (twitter_pin.length == 0)
44
+ puts "\n\tERROR: Could not read PIN, auth fail"
45
+ return
46
+ end
47
+
48
+ begin
49
+ OAuth::RequestToken.new(consumer, rtoken, rsecret)
50
+ access_token = request_token.get_access_token(:oauth_verifier => twitter_pin)
51
+ rescue Twitter::Unauthorized
52
+ puts "> FAIL!"
53
+ return
54
+ end
55
+
56
+ # saves the config back to yaml file.
57
+ self.runner.config.do_configure!('twitter', { 'enabled' => true,
58
+ 'access_token' => access_token.token,
59
+ 'secret' => access_token.secret })
60
+ end
61
+
62
+ def run
63
+ commit_msg = self.runner.message
64
+ available_commit_msg_size = 128
65
+ tweet_msg = commit_msg.length > available_commit_msg_size ? "#{commit_msg[0..(available_commit_msg_size-3)]}..." : commit_msg
66
+ tweet_text = "#{tweet_msg} #lolcommits"
67
+ puts "Tweeting: #{tweet_text}"
68
+
69
+ if configuration['access_token'].nil? || configuration['secret'].nil?
70
+ initial_twitter_auth()
71
+ end
72
+
73
+ if configuration['access_token'].nil? || configuration['secret'].nil?
74
+ puts "Missing Twitter Credentials - Skipping The Tweet"
75
+ return
76
+ end
77
+
78
+ Twitter.configure do |config|
79
+ config.consumer_key = TWITTER_CONSUMER_KEY
80
+ config.consumer_secret = TWITTER_CONSUMER_SECRET
81
+ end
82
+
83
+ client = Twitter::Client.new(
84
+ :oauth_token => configuration['access_token'],
85
+ :oauth_token_secret => configuration['secret']
86
+ )
87
+ retries = 2
88
+ begin
89
+ if client.update_with_media(tweet_text, File.open(self.runner.main_image, 'r'))
90
+ puts "\t--> Tweet Sent!"
91
+ end
92
+ rescue Twitter::Error::InternalServerError
93
+ retries -= 1
94
+ retry if retries > 0
95
+ puts "\t ! --> Tweet 500 Error - Tweet Not Posted"
96
+ end
97
+ end
98
+ end
99
+ end
@@ -12,7 +12,7 @@ module Lolcommits
12
12
  def run
13
13
  canvas = ImageList.new(self.runner.main_image)
14
14
  draw = Magick::Draw.new
15
- draw.font = File.join(Configuration::LOLCOMMITS_ROOT, "fonts", "Impact.ttf")
15
+ draw.font = File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "fonts", "Impact.ttf")
16
16
 
17
17
  draw.fill = 'white'
18
18
  draw.stroke = 'black'
@@ -12,6 +12,7 @@ module Lolcommits
12
12
 
13
13
  # Executed Last
14
14
  set_callback :run, :after, :cleanup!
15
+ set_callback :run, :after, :execute_lolcommits_lol_twitter
15
16
  set_callback :run, :after, :execute_lolcommits_stats_d
16
17
  set_callback :run, :after, :execute_lolcommits_dot_com
17
18
  set_callback :run, :after, :execute_lolcommits_loltext
@@ -1,3 +1,3 @@
1
1
  module Lolcommits
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2.pre1"
3
3
  end
data/lib/lolcommits.rb CHANGED
@@ -22,6 +22,7 @@ require 'lolcommits/plugins/loltext'
22
22
  require 'lolcommits/plugins/dot_com'
23
23
  require 'lolcommits/plugins/tranzlate'
24
24
  require 'lolcommits/plugins/statsd'
25
+ require 'lolcommits/plugins/lol_twitter'
25
26
 
26
27
  # require runner after all the plugins have been required
27
28
  require 'lolcommits/runner'
data/lolcommits.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Lolcommits::VERSION
8
8
  s.authors = ["Matthew Rothenberg"]
9
9
  s.email = ["mrothenberg@gmail.com"]
10
- s.homepage = "http://github.com/mroth/lolcommits"
10
+ s.homepage = "http://mroth.github.com/lolcommits/"
11
11
  s.summary = %q{Capture webcam image on git commit for lulz.}
12
12
  s.description = %q{Takes a snapshot with your Mac's built-in iSight/FaceTime webcam (or any working webcam on Linux or Windows) every time you git commit code, and archives a lolcat style image with it.}
13
13
  s.license = "LGPL-3"
@@ -22,11 +22,14 @@ Gem::Specification.new do |s|
22
22
  s.add_runtime_dependency('git', '~> 1.2.5')
23
23
  s.add_runtime_dependency('choice', '~> 0.1.6')
24
24
  s.add_runtime_dependency('launchy', '~> 2.1.1')
25
+ s.add_runtime_dependency("twitter")
26
+ s.add_runtime_dependency("oauth")
25
27
 
26
28
  s.add_development_dependency('rdoc')
27
29
  s.add_development_dependency('aruba')
28
30
  s.add_development_dependency('rake','~> 0.9.2')
29
31
  s.add_development_dependency('fivemat')
32
+ s.add_development_dependency('faker')
30
33
 
31
34
  s.add_dependency('methadone', '~>1.2.1')
32
35
  s.add_runtime_dependency('httmultiparty')
@@ -31,8 +31,8 @@ class LolTest < Test::Unit::TestCase
31
31
  # this will test the permissions but only locally, important before building a gem package!
32
32
  #
33
33
  def test_permissions
34
- impact_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, "fonts", "Impact.ttf")).mode & 0777
35
- imagesnap_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, "ext", "imagesnap", "imagesnap")).mode & 0777
34
+ impact_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "fonts", "Impact.ttf")).mode & 0777
35
+ imagesnap_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "ext", "imagesnap", "imagesnap")).mode & 0777
36
36
  assert impact_perms == 0644 || impact_perms == 0664,
37
37
  "expected perms of 644/664 but instead got #{sprintf '%o', impact_perms}"
38
38
  assert imagesnap_perms == 0755 || imagesnap_perms == 0775,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolcommits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
5
- prerelease:
4
+ version: 0.3.2.pre1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matthew Rothenberg
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rmagick
@@ -75,6 +75,38 @@ dependencies:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
77
  version: 2.1.1
78
+ - !ruby/object:Gem::Dependency
79
+ name: twitter
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: oauth
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
78
110
  - !ruby/object:Gem::Dependency
79
111
  name: rdoc
80
112
  requirement: !ruby/object:Gem::Requirement
@@ -139,6 +171,22 @@ dependencies:
139
171
  - - ! '>='
140
172
  - !ruby/object:Gem::Version
141
173
  version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: faker
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
142
190
  - !ruby/object:Gem::Dependency
143
191
  name: methadone
144
192
  requirement: !ruby/object:Gem::Requirement
@@ -216,23 +264,18 @@ files:
216
264
  - .gitignore
217
265
  - .travis.yml
218
266
  - CHANGELOG
267
+ - CONTRIBUTING
219
268
  - Gemfile
220
269
  - LICENSE
221
270
  - NOTES
222
271
  - README.md
223
272
  - Rakefile
224
273
  - bin/lolcommits
225
- - ext/CommandCam/COPYING
226
- - ext/CommandCam/CommandCam.exe
227
- - ext/CommandCam/LICENSE
228
- - ext/imagesnap/ReadMeOrDont.rtf
229
- - ext/imagesnap/imagesnap
230
274
  - features/bugs.feature
231
275
  - features/lolcommits.feature
232
276
  - features/plugins.feature
233
277
  - features/step_definitions/lolcommits_steps.rb
234
278
  - features/support/env.rb
235
- - fonts/Impact.ttf
236
279
  - lib/core_ext/class.rb
237
280
  - lib/lolcommits.rb
238
281
  - lib/lolcommits/capture_fake.rb
@@ -244,6 +287,7 @@ files:
244
287
  - lib/lolcommits/git_info.rb
245
288
  - lib/lolcommits/plugin.rb
246
289
  - lib/lolcommits/plugins/dot_com.rb
290
+ - lib/lolcommits/plugins/lol_twitter.rb
247
291
  - lib/lolcommits/plugins/loltext.rb
248
292
  - lib/lolcommits/plugins/statsd.rb
249
293
  - lib/lolcommits/plugins/tranzlate.rb
@@ -253,7 +297,13 @@ files:
253
297
  - lolcommits.gemspec
254
298
  - test/images/test_image.jpg
255
299
  - test/test_lolcommits.rb
256
- homepage: http://github.com/mroth/lolcommits
300
+ - vendor/ext/CommandCam/COPYING
301
+ - vendor/ext/CommandCam/CommandCam.exe
302
+ - vendor/ext/CommandCam/LICENSE
303
+ - vendor/ext/imagesnap/ReadMeOrDont.rtf
304
+ - vendor/ext/imagesnap/imagesnap
305
+ - vendor/fonts/Impact.ttf
306
+ homepage: http://mroth.github.com/lolcommits/
257
307
  licenses:
258
308
  - LGPL-3
259
309
  post_install_message:
@@ -266,18 +316,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
316
  - - ! '>='
267
317
  - !ruby/object:Gem::Version
268
318
  version: '0'
269
- segments:
270
- - 0
271
- hash: 1355111623428597869
272
319
  required_rubygems_version: !ruby/object:Gem::Requirement
273
320
  none: false
274
321
  requirements:
275
- - - ! '>='
322
+ - - ! '>'
276
323
  - !ruby/object:Gem::Version
277
- version: '0'
278
- segments:
279
- - 0
280
- hash: 1355111623428597869
324
+ version: 1.3.1
281
325
  requirements: []
282
326
  rubyforge_project: lolcommits
283
327
  rubygems_version: 1.8.24