wt-commit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Antek Piechnik
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.textile ADDED
@@ -0,0 +1,19 @@
1
+ h1. wt-commit
2
+
3
+ Wt-commit is a "whatthecommit":http://whatthecommit.com commit message fetcher and git commiter. It is designed for people who truly hate their collaborators and/or coworkers.
4
+
5
+ h2. usage
6
+
7
+ Simply run
8
+
9
+ `gem install wt-commit`
10
+
11
+ Then, after adding files to your current commit, run `wt-commit` from the command line to commit your changes with a newly fetched commit message.
12
+
13
+ h2. contributing
14
+
15
+ Ideas/problems? Create an issue or fork the project, add tests, code and send me a pull request.
16
+
17
+ h2. license
18
+
19
+ Copyright (c) 2010 Antek Piechnik, released under the MIT license
data/bin/wt-commit ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/evn ruby
2
+ require 'wt-commit'
3
+
4
+ `git commit -m "#{WtCommit::fetch_message}"`
data/lib/wt-commit.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'httparty'
2
+ require 'hpricot'
3
+
4
+ module WtCommit
5
+ def self.fetch_message
6
+ response = Hpricot(HTTParty.get('http://whatthecommit.com/').body)
7
+ WtCommit::sanitize((response/"div[@id='content']/p").inner_html)
8
+ end
9
+
10
+ def self.sanitize(message)
11
+ message.gsub('"', '\"')
12
+ end
13
+ end
14
+
@@ -0,0 +1,2 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
2
+ require 'wt-commit'
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "fetching a commit message" do
4
+
5
+ before(:all) do
6
+ @ok_result = "<div id=\"content\"><p>fixed!</p></div>"
7
+ @quoted_result = '<div id="content"><p>Issa "test"!</p></div>'
8
+ end
9
+
10
+ it "should query whatthecommit.com and fetch a message" do
11
+ HTTParty.stub_chain(:get, :body).and_return(@ok_result)
12
+ HTTParty.should_receive(:get).once.with('http://whatthecommit.com/')
13
+ WtCommit::fetch_message
14
+ end
15
+
16
+ it "should return the proper message" do
17
+ HTTParty.stub_chain(:get, :body).and_return(@ok_result)
18
+ WtCommit::fetch_message.should == "fixed!"
19
+ end
20
+
21
+ it "should sanitize any quotes" do
22
+ HTTParty.stub_chain(:get, :body).and_return(@quoted_result)
23
+ WtCommit::fetch_message.should == 'Issa \\"test\\"!'
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wt-commit
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Antek Piechnik
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-13 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: httparty
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: hpricot
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: rake
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: rspec
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 13
72
+ segments:
73
+ - 1
74
+ - 2
75
+ - 9
76
+ version: 1.2.9
77
+ type: :development
78
+ version_requirements: *id004
79
+ description: For when you hate your coworkers/collaborators
80
+ email: antek.piechnik@gmail.com
81
+ executables:
82
+ - wt-commit
83
+ extensions: []
84
+
85
+ extra_rdoc_files: []
86
+
87
+ files:
88
+ - bin/wt-commit
89
+ - lib/wt-commit.rb
90
+ - spec/spec_helper.rb
91
+ - spec/wt-commit_spec.rb
92
+ - README.textile
93
+ - LICENSE
94
+ has_rdoc: true
95
+ homepage:
96
+ licenses: []
97
+
98
+ post_install_message:
99
+ rdoc_options: []
100
+
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
121
+ requirements: []
122
+
123
+ rubyforge_project:
124
+ rubygems_version: 1.3.7
125
+ signing_key:
126
+ specification_version: 3
127
+ summary: whatthecommit.com commit message fetcher and git autocommiter
128
+ test_files: []
129
+