inko 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in say_tweets.gemspec
4
+ gem 'userstream'
5
+
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 rhysd
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,50 @@
1
+ # Inko(インコ)
2
+
3
+ Inko is Twitter-call-off client for MacOS X.
4
+ Inko means parakeet in Japanese.
5
+
6
+ ## Installation
7
+
8
+ $ gem install inko
9
+
10
+ ## Usage
11
+
12
+ 1. Make your own client and get consumer key and OAuth key at https://dev.twitter.com/ to authenticate.
13
+ 2. Run `inko`. If you want to run `inko` as daemon, add `--daemon` option.
14
+ 3. If you want some help, add `--help` option.
15
+
16
+ ## 日本語読み上げ (call off in Japanese)
17
+
18
+ 日本語を読み上げるには,日本語音声(Kyoko)をダウンロードする必要があります.
19
+ `システム環境設定→音声入力と読み上げ→システムの声→カスタマイズ`と進んで,
20
+ ダウンロードしてください.
21
+ `~/.inkorc.yml` の voice\_actor には Kyoko を指定して下さい.
22
+
23
+ ## LICENSE: MIT License
24
+
25
+ Copyright (c) 2012 rhysd
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a copy
28
+ of this software and associated documentation files (the "Software"), to deal
29
+ in the Software without restriction, including without limitation the rights
30
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
31
+ of the Software, and to permit persons to whom the Software is furnished to do so,
32
+ subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in all
35
+ copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
38
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
39
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
40
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
41
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
42
+ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ def show_usage_and_exit
5
+ puts <<-EOS
6
+ USAGE:
7
+ inko [-d | --daemon | -h | --help]
8
+
9
+ DESCRIPTION:
10
+ read-only? no, hear-only twitter-client for MacOS X using say command.
11
+
12
+ -d,--daemon Run in deamon-mode. If you want to quit this app, simply kill this app's process.
13
+
14
+ --help show this usage.
15
+ EOS
16
+ exit
17
+ end
18
+
19
+ case ARGV.first
20
+ when '-h', '--help'
21
+ ARGV.shift
22
+ show_usage_and_exit
23
+ when '-d', '--daemon'
24
+ ARGV.shift
25
+ puts <<-EOS.gsub /^\s+/,''
26
+ `inko` runs in background.
27
+ If you want to quit this app, kill process simply.
28
+ EOS
29
+ Process.daemon true,true
30
+ end
31
+
32
+ show_usage_and_exit unless ARGV.empty?
33
+
34
+ require 'inko'
35
+ begin
36
+ Inko::run
37
+ rescue Interrupt
38
+ puts "Inko is interrupted."
39
+ end
40
+
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/inko/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["rhysd"]
6
+ gem.email = ["lin90162@yahoo.co.jp"]
7
+ gem.description = %q{Inko(インコ) is Twitter-call-off client for MacOS X.}
8
+ gem.summary = %q{read-only? no, Inko is hear-only twitter-client for MacOS X using say command. Inko means parakeet in Japanese.}
9
+ gem.homepage = "https://github.com/rhysd/inko"
10
+ gem.authors = ["rhysd"]
11
+
12
+ gem.files = `git ls-files`.split($\)
13
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.name = "inko"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = Inko::VERSION
18
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ require "inko/version"
4
+ require 'inko/config'
5
+
6
+ require 'user_stream'
7
+
8
+ module Inko extend self
9
+
10
+ def filter? status
11
+ !status.user || !status.text
12
+ end
13
+
14
+ # modify screen_name and text to make them easy to pronounce
15
+ # _,!
16
+ # cf http://d.hatena.ne.jp/nacookan/20081220/1229745342
17
+ def pronunciationize status
18
+ status
19
+ end
20
+
21
+ def run
22
+ begin
23
+ UserStream.configure do |config|
24
+ config.consumer_key = Config::ConsumerKey
25
+ config.consumer_secret = Config::ConsumerSecret
26
+ config.oauth_token = Config::OAuthToken
27
+ config.oauth_token_secret = Config::OAuthSecret
28
+ end
29
+ rescue UserStream::Unauthorized => e
30
+ STDERR.puts "contents of #{Config::ConfigFileName} is invalid!"
31
+ raise e
32
+ end
33
+
34
+ client = UserStream::client
35
+
36
+ client.user do |status|
37
+ unless filter? status
38
+ status = pronunciationize status
39
+ # puts "#{status.user.screen_name}: "
40
+ # puts status.text
41
+ `say -v #{Config::VoiceActor} #{status.user.screen_name.gsub(/_/, '. ').gsub(/([a-zA-Z]+|[0-9]+)/)do $1 + ' ' end} さんのツイート}`
42
+ `say -v #{Config::VoiceActor} #{status.text}`
43
+ end
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,39 @@
1
+ # encoding: utf-8
2
+
3
+ require 'yaml'
4
+
5
+ module Inko
6
+ module Config
7
+ # file name for credential information
8
+ ConfigFileName = File.expand_path('~') + '/.inkorc.yml'
9
+
10
+ # if file is not found
11
+ unless File.exist? ConfigFileName
12
+ File.open ConfigFileName,"w" do |file|
13
+ file.print <<-EOS.gsub(/^\s+/, '')
14
+ # Choose voice actor from System Setting.
15
+ # To call off in Japanese, download voice data (Kyoko).
16
+ voice_actor: Alex
17
+
18
+ # Get app keys at https://dev.twitter.com/ and write them.
19
+ consumer_key: YourConsumerKey
20
+ consumer_secret: YourConsumerSecretKey
21
+ oauth_token: YourOAuthToken
22
+ oauth_token_secret: YourOAuthSecretToken
23
+ EOS
24
+
25
+ STDERR.puts "Configuration-keys are not found."
26
+ STDERR.puts "Write your consumer keys and OAuth keys to #{ConfigFileName}"
27
+ end
28
+ system 'bash', '-c', (ENV['EDITOR'] || 'vi')+' "$@"', '--', ConfigFileName
29
+ end
30
+
31
+ # load configuration from file
32
+ yaml = YAML.load(File.open(Config::ConfigFileName).read)
33
+ VoiceActor = yaml['voice_actor']
34
+ ConsumerKey = yaml['consumer_key']
35
+ ConsumerSecret = yaml['consumer_secret']
36
+ OAuthToken = yaml['oauth_token']
37
+ OAuthSecret = yaml['oauth_token_secret']
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module Inko
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inko
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - rhysd
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-13 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Inko(インコ) is Twitter-call-off client for MacOS X.
15
+ email:
16
+ - lin90162@yahoo.co.jp
17
+ executables:
18
+ - inko
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - bin/inko
28
+ - inko.gemspec
29
+ - lib/inko.rb
30
+ - lib/inko/config.rb
31
+ - lib/inko/version.rb
32
+ homepage: https://github.com/rhysd/inko
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project:
52
+ rubygems_version: 1.8.23
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: read-only? no, Inko is hear-only twitter-client for MacOS X using say command.
56
+ Inko means parakeet in Japanese.
57
+ test_files: []