eew_jp_notify 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+ gem 'tweetstream'
6
+ gem 'meow'
7
+
8
+ # Add dependencies to develop your gem here.
9
+ # Include everything needed to run rake, tests, features, etc.
10
+ group :development do
11
+ gem 'rspec'
12
+ gem 'bundler'
13
+ gem 'jeweler'
14
+ gem 'rcov'
15
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ daemons (1.1.0)
5
+ diff-lcs (1.1.2)
6
+ eventmachine (0.12.10)
7
+ git (1.2.5)
8
+ jeweler (1.5.2)
9
+ bundler (~> 1.0.0)
10
+ git (>= 1.2.5)
11
+ rake
12
+ meow (2.1.0)
13
+ rake (0.8.7)
14
+ rcov (0.9.9)
15
+ roauth (0.0.3)
16
+ rspec (2.5.0)
17
+ rspec-core (~> 2.5.0)
18
+ rspec-expectations (~> 2.5.0)
19
+ rspec-mocks (~> 2.5.0)
20
+ rspec-core (2.5.1)
21
+ rspec-expectations (2.5.0)
22
+ diff-lcs (~> 1.1.2)
23
+ rspec-mocks (2.5.0)
24
+ tweetstream (1.0.4)
25
+ daemons
26
+ twitter-stream
27
+ twitter-stream (0.1.12)
28
+ eventmachine (>= 0.12.8)
29
+ roauth (>= 0.0.2)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler
36
+ jeweler
37
+ meow
38
+ rcov
39
+ rspec
40
+ tweetstream
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 CHIKURA Shinsaku
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 ADDED
@@ -0,0 +1,30 @@
1
+ = eew_jp_notify
2
+
3
+ eew_jp_notify is a tool to notify @eew_jp tweets using Growl.
4
+ It only works on Mac OS X.
5
+
6
+ = Install
7
+
8
+ sudo gem install eew_jp_notify
9
+
10
+ = Run
11
+
12
+ /usr/bin/eew_jp_notify -u twitter-user-name -p twitter-password
13
+
14
+ If you want to stop this app, simply press ^C.
15
+
16
+ == Contributing to eew_jp_notify
17
+
18
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
19
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
20
+ * Fork the project
21
+ * Start a feature/bugfix branch
22
+ * Commit and push until you are happy with your contribution
23
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
24
+ * 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.
25
+
26
+ == Copyright
27
+
28
+ Copyright (c) 2011 CHIKURA Shinsaku. See LICENSE.txt for
29
+ further details.
30
+
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "eew_jp_notify"
16
+ gem.homepage = "http://github.com/chsh/eew_jp_notify"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{Show @eew_jp tweets to Growl using Twitter Streaming API.}
19
+ gem.description = %Q{Show @eew_jp tweets to Growl using Twitter Streaming API.}
20
+ gem.email = "chsh@thinq.jp"
21
+ gem.authors = ["CHIKURA Shinsaku"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
36
+ spec.pattern = 'spec/**/*_spec.rb'
37
+ spec.rcov = true
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "eew_jp_notify #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/eew_jp_notify ADDED
@@ -0,0 +1,3 @@
1
+ #!/this/will/be/overritten/or/wrapped/anyways/do/not/warry/ruby
2
+
3
+ require 'eew_jp_notify/cli'
@@ -0,0 +1,75 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{eew_jp_notify}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["CHIKURA Shinsaku"]
12
+ s.date = %q{2011-03-16}
13
+ s.default_executable = %q{eew_jp_notify}
14
+ s.description = %q{Show @eew_jp tweets to Growl using Twitter Streaming API.}
15
+ s.email = %q{chsh@thinq.jp}
16
+ s.executables = ["eew_jp_notify"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ ".rspec",
24
+ "Gemfile",
25
+ "Gemfile.lock",
26
+ "LICENSE.txt",
27
+ "README.rdoc",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "bin/eew_jp_notify",
31
+ "eew_jp_notify.gemspec",
32
+ "lib/eew_jp_notify.rb",
33
+ "lib/eew_jp_notify/cli.rb",
34
+ "lib/eew_jp_notify/main.rb",
35
+ "spec/eew_jp_notify_spec.rb",
36
+ "spec/spec_helper.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/chsh/eew_jp_notify}
39
+ s.licenses = ["MIT"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.5.2}
42
+ s.summary = %q{Show @eew_jp tweets to Growl using Twitter Streaming API.}
43
+ s.test_files = [
44
+ "spec/eew_jp_notify_spec.rb",
45
+ "spec/spec_helper.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ s.specification_version = 3
50
+
51
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
+ s.add_runtime_dependency(%q<tweetstream>, [">= 0"])
53
+ s.add_runtime_dependency(%q<meow>, [">= 0"])
54
+ s.add_development_dependency(%q<rspec>, [">= 0"])
55
+ s.add_development_dependency(%q<bundler>, [">= 0"])
56
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
57
+ s.add_development_dependency(%q<rcov>, [">= 0"])
58
+ else
59
+ s.add_dependency(%q<tweetstream>, [">= 0"])
60
+ s.add_dependency(%q<meow>, [">= 0"])
61
+ s.add_dependency(%q<rspec>, [">= 0"])
62
+ s.add_dependency(%q<bundler>, [">= 0"])
63
+ s.add_dependency(%q<jeweler>, [">= 0"])
64
+ s.add_dependency(%q<rcov>, [">= 0"])
65
+ end
66
+ else
67
+ s.add_dependency(%q<tweetstream>, [">= 0"])
68
+ s.add_dependency(%q<meow>, [">= 0"])
69
+ s.add_dependency(%q<rspec>, [">= 0"])
70
+ s.add_dependency(%q<bundler>, [">= 0"])
71
+ s.add_dependency(%q<jeweler>, [">= 0"])
72
+ s.add_dependency(%q<rcov>, [">= 0"])
73
+ end
74
+ end
75
+
@@ -0,0 +1,5 @@
1
+
2
+ module EewJpNotify
3
+ end
4
+
5
+ require 'eew_jp_notify/main'
@@ -0,0 +1,29 @@
1
+
2
+ require 'optparse'
3
+ require 'eew_jp_notify'
4
+
5
+ class EewJpNotify::CLI
6
+ class Params
7
+ def initialize(args)
8
+ opt = OptionParser.new
9
+ opt.on('-u user') { |v| @user = v }
10
+ opt.on('-p password') { |v| @password = v }
11
+ opt.on('-h') { @help_mode = true }
12
+ opt.parse! args
13
+ @config = {}
14
+ @config[:user] = @user if @user
15
+ @config[:password] = @password if @password
16
+ @config[:help_mode] = true if @help_mode
17
+ end
18
+ attr_reader :config
19
+ end
20
+ def self.run(args)
21
+ self.new.run(args)
22
+ end
23
+ def run(args)
24
+ params = Params.new(args)
25
+ EewJpNotify::Main.new.execute(params.config)
26
+ end
27
+ end
28
+
29
+ EewJpNotify::CLI.run(ARGV)
@@ -0,0 +1,34 @@
1
+
2
+ require 'rubygems'
3
+ require 'tweetstream'
4
+ require 'meow'
5
+
6
+ class EewJpNotify::Main
7
+ FOLLOW_MAP = {
8
+ 'eew_jp' => 16052553
9
+ }
10
+
11
+ def execute(params)
12
+ return false unless verify_params(params)
13
+ g = Meow.new 'eew_jp_notify'
14
+ g.notify 'Start', 'eew_jp_notify started.'
15
+ TweetStream::Client.new(params[:user], params[:password]).follow(FOLLOW_MAP.values) do |status|
16
+ if FOLLOW_MAP[status.user.screen_name]
17
+ puts "#{status.user.screen_name}: #{status.text}"
18
+ url = nil
19
+ if status.text =~ /(http:\/\/twiple\.jp\/e\/\w+)/
20
+ url = $1
21
+ end
22
+ g.notify status.user.screen_name, status.text do
23
+ system "open -a Safari #{url}" if url
24
+ end
25
+ end
26
+ end
27
+ end
28
+ private
29
+ def verify_params(params)
30
+ return true if params[:user] && params[:password]
31
+ puts "usage: #{$0} -u user -p password"
32
+ false
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "EewJpNotify" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'eew_jp_notify'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eew_jp_notify
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - CHIKURA Shinsaku
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-16 00:00:00 +09:00
19
+ default_executable: eew_jp_notify
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :runtime
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ name: tweetstream
33
+ version_requirements: *id001
34
+ prerelease: false
35
+ - !ruby/object:Gem::Dependency
36
+ type: :runtime
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ name: meow
47
+ version_requirements: *id002
48
+ prerelease: false
49
+ - !ruby/object:Gem::Dependency
50
+ type: :development
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ name: rspec
61
+ version_requirements: *id003
62
+ prerelease: false
63
+ - !ruby/object:Gem::Dependency
64
+ type: :development
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ name: bundler
75
+ version_requirements: *id004
76
+ prerelease: false
77
+ - !ruby/object:Gem::Dependency
78
+ type: :development
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ name: jeweler
89
+ version_requirements: *id005
90
+ prerelease: false
91
+ - !ruby/object:Gem::Dependency
92
+ type: :development
93
+ requirement: &id006 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ name: rcov
103
+ version_requirements: *id006
104
+ prerelease: false
105
+ description: Show @eew_jp tweets to Growl using Twitter Streaming API.
106
+ email: chsh@thinq.jp
107
+ executables:
108
+ - eew_jp_notify
109
+ extensions: []
110
+
111
+ extra_rdoc_files:
112
+ - LICENSE.txt
113
+ - README.rdoc
114
+ files:
115
+ - .document
116
+ - .rspec
117
+ - Gemfile
118
+ - Gemfile.lock
119
+ - LICENSE.txt
120
+ - README.rdoc
121
+ - Rakefile
122
+ - VERSION
123
+ - bin/eew_jp_notify
124
+ - eew_jp_notify.gemspec
125
+ - lib/eew_jp_notify.rb
126
+ - lib/eew_jp_notify/cli.rb
127
+ - lib/eew_jp_notify/main.rb
128
+ - spec/eew_jp_notify_spec.rb
129
+ - spec/spec_helper.rb
130
+ has_rdoc: true
131
+ homepage: http://github.com/chsh/eew_jp_notify
132
+ licenses:
133
+ - MIT
134
+ post_install_message:
135
+ rdoc_options: []
136
+
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
147
+ version: "0"
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
157
+ requirements: []
158
+
159
+ rubyforge_project:
160
+ rubygems_version: 1.5.2
161
+ signing_key:
162
+ specification_version: 3
163
+ summary: Show @eew_jp tweets to Growl using Twitter Streaming API.
164
+ test_files:
165
+ - spec/eew_jp_notify_spec.rb
166
+ - spec/spec_helper.rb