kilt 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -23,3 +23,4 @@ pkg
23
23
  cache
24
24
  gems
25
25
  bin/pivotal-tracker-client.rb.pid
26
+ .rvmrc
data/README.textile CHANGED
@@ -1,20 +1,33 @@
1
1
  h2. ABOUT
2
2
 
3
- Kilt looks for new activities in all your projects and displays them with Growl/Libnotify, so you are up-to-date with everything is happening.
3
+ Kilt looks for new activities in all your projects and displays them with Growl/Libnotify/Snarl, so you are up-to-date with everything is happening.
4
+ If you want to help, please send me a pull request.
4
5
 
5
- Example: http://img684.imageshack.us/img684/4875/screenshot20100319at349.png
6
+ h2. SCREENSHOTS
6
7
 
7
- Support for Windows is comming. If you want to help, please send me a pull request.
8
+ OS X
9
+ !http://img13.imageshack.us/img13/2583/kiltonosx.png!
10
+
11
+ Ubuntu
12
+ !http://img691.imageshack.us/img691/9453/kiltonubuntu.png!
13
+
14
+ Windows
15
+ !http://img192.imageshack.us/img192/9405/kiltonwindows.png!
8
16
 
9
17
  h2. DEPENDENCIES
10
18
 
11
19
  On OS X:
12
20
 
13
- * Growl (http://growl.info/)
21
+ * "Growl":http://growl.info
14
22
 
15
- On Linux:
23
+ On Ubuntu:
16
24
 
17
- * libnotify-bin
25
+ * "libnotify-bin":http://packages.ubuntu.com/lucid/libnotify-bin
26
+
27
+ On Windows:
28
+ * "Snarl":http://www.fullphat.net
29
+ * "ruby-snarl":http://rubygems.org/gems/ruby-snarl
30
+ * "win32-process":http://rubygems.org/gems/win32-process
18
31
 
19
32
  h2. INSTALLATION
20
33
 
@@ -25,9 +38,7 @@ If you don't know your token, you can execute this:
25
38
 
26
39
  <pre><code>curl -u USERNAME:PASSWORD -X GET https://www.pivotaltracker.com/services/v3/tokens/active</code></pre>
27
40
 
28
- More info here and other alternative here:
29
-
30
- http://www.pivotaltracker.com/help/api?version=v3#retrieve_token
41
+ More info and other alternative "here":http://www.pivotaltracker.com/help/api?version=v3#retrieve_token.
31
42
 
32
43
  h2. USAGE
33
44
 
@@ -35,7 +46,6 @@ h2. USAGE
35
46
 
36
47
  h2. TODO
37
48
 
38
- * support for Windows
39
49
  * kilt-check (see issues)
40
50
 
41
51
  h2. LICENSE
data/Rakefile CHANGED
@@ -13,6 +13,8 @@ begin
13
13
  gem.add_dependency "rest-client"
14
14
  gem.add_dependency "crack"
15
15
  gem.add_dependency "rufus-scheduler"
16
+ gem.add_development_dependency "rspec"
17
+ gem.add_development_dependency "fakeweb"
16
18
  end
17
19
  Jeweler::GemcutterTasks.new
18
20
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.5.0
data/bin/kilt-app CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'rubygems'
4
4
  require 'yaml'
5
5
  require 'kilt'
6
+ require 'win32/process' if RUBY_PLATFORM =~ /mswin|mingw|win32/
6
7
 
7
8
  fork do
8
9
  token = YAML.load_file(File.expand_path("~/.pivotal_tracker"))['token']
data/lib/kilt.rb CHANGED
@@ -1,12 +1,15 @@
1
1
  require 'rest_client'
2
2
  require 'crack/xml'
3
3
  require 'rufus/scheduler'
4
+ require 'snarl' if RUBY_PLATFORM =~ /mswin|mingw|win32/
4
5
 
5
6
  class Kilt
6
7
  include Crack
7
8
 
8
9
  attr_reader :id
9
10
 
11
+ ICON = File.expand_path(File.join(File.dirname(__FILE__), '..', 'img', 'pivotal.png'))
12
+
10
13
  def self.init(token)
11
14
  new token
12
15
  end
@@ -36,17 +39,20 @@ class Kilt
36
39
  end
37
40
 
38
41
  def fetch_activities
39
- return XML.parse(RestClient.get("http://www.pivotaltracker.com/services/v3/activities?limit=10", 'X-TrackerToken' => @token).body)['activities']
42
+ return XML.parse(RestClient.get("http://www.pivotaltracker.com/services/v3/activities?limit=10",
43
+ 'X-TrackerToken' => @token).body)['activities']
40
44
  end
41
45
 
42
46
  def notify_about(message)
43
47
  title = 'Pivotal Tracker'
44
- icon_path = File.join File.dirname(__FILE__), '..', 'img', 'pivotal.png'
45
48
  case RUBY_PLATFORM
46
49
  when /linux/
47
- system "notify-send '#{title}' '#{message}'"
50
+ system "notify-send '#{title}' '#{message}' --icon #{Kilt::ICON}"
48
51
  when /darwin/
49
- system "growlnotify -t '#{title}' -m '#{message}' --image #{icon_path}"
52
+ system "growlnotify -t '#{title}' -m '#{message}' --image #{Kilt::ICON}"
53
+ when /mswin|mingw|win32/
54
+ Snarl.show_message title, message, Kilt::ICON
50
55
  end
51
56
  end
57
+
52
58
  end
data/spec/kilt_spec.rb CHANGED
@@ -59,14 +59,14 @@ describe Kilt do
59
59
  end
60
60
 
61
61
  it "should notify growl calling growlnotify with 'Pivotal Tracker' as the name the application, the author and the action" do
62
- regexp = /growlnotify -t \'Pivotal Tracker\' -m \'Superman finished lorem ipsum\' --image \S+.pivotal.png/
62
+ regexp = /growlnotify -t \'Pivotal Tracker\' -m \'\S+. finished lorem ipsum\' --image \S+.pivotal\.png/
63
63
  @client.should_receive(:system).with(regexp)
64
64
  @client.update
65
65
  end
66
66
 
67
67
  it "should notify newer activities at least" do
68
- regexp = /growlnotify -t \'Pivotal Tracker\' -m \'SpongeBog finished lorem ipsum\' --image \S+.pivotal.png/
69
- regexp2 = /growlnotify -t \'Pivotal Tracker\' -m \'Superman finished lorem ipsum\' --image \S+.pivotal.png/
68
+ regexp = /growlnotify -t \'Pivotal Tracker\' -m \'SpongeBog finished lorem ipsum\' --image \S+.pivotal\.png/
69
+ regexp2 = /growlnotify -t \'Pivotal Tracker\' -m \'Superman finished lorem ipsum\' --image \S+.pivotal\.png/
70
70
  @client.should_receive(:system).with(regexp).ordered
71
71
  @client.should_receive(:system).with(regexp2).ordered
72
72
  @client.update
@@ -79,13 +79,34 @@ describe Kilt do
79
79
  end
80
80
 
81
81
  it "should notify libnotify calling notify-send with 'Pivotal Tracker' as the name the application, the author and the action" do
82
- @client.should_receive(:system).with("notify-send 'Pivotal Tracker' 'Superman finished lorem ipsum'")
82
+ regexp = /notify-send \'Pivotal Tracker\' \'\S+. finished lorem ipsum\' --icon \S+.pivotal\.png/
83
+ @client.should_receive(:system).with(regexp)
84
+ @client.update
85
+ end
86
+
87
+ it "should notify newer activities at least" do
88
+ regexp = /notify-send \'Pivotal Tracker\' \'SpongeBog finished lorem ipsum\' --icon \S+.pivotal\.png/
89
+ regexp2 = /notify-send \'Pivotal Tracker\' \'Superman finished lorem ipsum\' --icon \S+.pivotal\.png/
90
+ @client.should_receive(:system).with(regexp).ordered
91
+ @client.should_receive(:system).with(regexp2).ordered
92
+ @client.update
93
+ end
94
+ end
95
+
96
+ context "on windows" do
97
+ before :all do
98
+ silence_warnings { RUBY_PLATFORM = "mswin" }
99
+ Kilt.const_set(:Snarl, @snarl = mock)
100
+ end
101
+
102
+ it "should notify Snarl calling show_message with 'Pivotal Tracker' as the name the application, the author and the action" do
103
+ @snarl.should_receive(:show_message).with('Pivotal Tracker', /\S+ finished lorem ipsum/, /\S+.pivotal\.png/).twice
83
104
  @client.update
84
105
  end
85
106
 
86
107
  it "should notify newer activities at least" do
87
- @client.should_receive(:system).with("notify-send 'Pivotal Tracker' 'SpongeBog finished lorem ipsum'").ordered
88
- @client.should_receive(:system).with("notify-send 'Pivotal Tracker' 'Superman finished lorem ipsum'").ordered
108
+ @snarl.should_receive(:show_message).with('Pivotal Tracker', 'SpongeBog finished lorem ipsum', /\S+.pivotal\.png/).ordered
109
+ @snarl.should_receive(:show_message).with('Pivotal Tracker', 'Superman finished lorem ipsum', /\S+.pivotal\.png/).ordered
89
110
  @client.update
90
111
  end
91
112
  end
data/spec/spec.opts CHANGED
@@ -1 +1,4 @@
1
- --color
1
+ --colour
2
+ --format specdoc
3
+ --loadby mtime
4
+ --reverse
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
8
- - 1
9
- version: 0.4.1
7
+ - 5
8
+ - 0
9
+ version: 0.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Diego Carrion
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-29 00:00:00 -03:00
17
+ date: 2010-05-31 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -53,6 +53,30 @@ dependencies:
53
53
  version: "0"
54
54
  type: :runtime
55
55
  version_requirements: *id003
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ prerelease: false
59
+ requirement: &id004 !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ type: :development
67
+ version_requirements: *id004
68
+ - !ruby/object:Gem::Dependency
69
+ name: fakeweb
70
+ prerelease: false
71
+ requirement: &id005 !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ type: :development
79
+ version_requirements: *id005
56
80
  description: A client that listens to Pivotal Tracker activities and notifies them with Growl.
57
81
  email: dc.rec1@gmail.com
58
82
  executables: