im-kayac 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.1.1 2013-03-14
2
+
3
+ * add im-kayac command
4
+
1
5
  === 0.1.0 2013-03-14
2
6
 
3
7
  * new API
data/README.md CHANGED
@@ -16,8 +16,15 @@ Registration
16
16
  please registrate on http://im.kayac.com
17
17
 
18
18
 
19
- Usage
20
- -----
19
+ im-kayac command
20
+ ----------------
21
+
22
+ % im-kayac --help
23
+ % im-kayac --to USER_NAME "hello world"
24
+
25
+
26
+ Gem Usage
27
+ ---------
21
28
 
22
29
  ```ruby
23
30
  require 'im-kayac'
data/bin/im-kayac ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
4
+ require 'args_parser'
5
+ require 'im-kayac'
6
+
7
+ parser = ArgsParser.parse ARGV do
8
+ arg :to, 'message to', :alias => :t
9
+ arg :password, 'password auth', :alias => :p
10
+ arg :secret, 'secret key auth', :alias => :s
11
+ arg :version, 'show version', :alias => :v
12
+ arg :help, 'show help', :alias => :h
13
+ end
14
+
15
+ if parser.has_option? :version
16
+ puts "im-kayac v#{ImKayac::VERSION}"
17
+ exit
18
+ end
19
+
20
+ if parser.has_option? :help or !parser.has_param? :to or parser.argv.empty?
21
+ STDERR.puts parser.help
22
+ STDERR.puts
23
+ STDERR.puts "e.g."
24
+ STDERR.puts %q{ im-kayac --to USER_NAME "hello world"}
25
+ STDERR.puts %q{ im-kayac --to USER_NAME --password YOUR_PASS "hello password"}
26
+ STDERR.puts %q{ im-kayac --to USER_NAME --secret YOUR_KEY "hello secret key"}
27
+ exit 1
28
+ end
29
+
30
+ im = ImKayac.to(parser[:to])
31
+ if parser.has_param? :password
32
+ im.password parser[:password]
33
+ elsif parser.has_param? :secret
34
+ im.secret parser[:secret]
35
+ end
36
+ im.post parser.argv.join ''
data/im-kayac.gemspec CHANGED
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.add_dependency "json"
20
20
  gem.add_dependency "httparty"
21
+ gem.add_dependency "args_parser"
21
22
  end
@@ -1,3 +1,3 @@
1
1
  module ImKayac
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: im-kayac
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sho Hashimoto
@@ -34,11 +34,22 @@ dependencies:
34
34
  version: "0"
35
35
  type: :runtime
36
36
  version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: args_parser
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id003
37
48
  description: post message http://im.kayac.com
38
49
  email:
39
50
  - hashimoto@shokai.org
40
- executables: []
41
-
51
+ executables:
52
+ - im-kayac
42
53
  extensions: []
43
54
 
44
55
  extra_rdoc_files: []
@@ -50,6 +61,7 @@ files:
50
61
  - LICENSE.txt
51
62
  - README.md
52
63
  - Rakefile
64
+ - bin/im-kayac
53
65
  - im-kayac.gemspec
54
66
  - lib/im-kayac.rb
55
67
  - lib/im-kayac/main.rb