imessage 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 834fd3fcec66c49f18ae7b6a875759a7eb555671
4
+ data.tar.gz: cebbf8e85d8a4b7ad39d8d125a19c589e38b3ebe
5
+ SHA512:
6
+ metadata.gz: 57a1a6c95617ceedc779847ab0c46808b0f1e5c58de35444b57187c05ad6b4078e9527f1f580a338ffe787d87c38f929e3965354afe4811331a3f949ef936c56
7
+ data.tar.gz: 3e28e72351d44df1c0801c7ee0202ff323dde8053db581b32cbd9b114e2b4c848b69b6cc30c2b08b55df2c9f0f7af675a1f6222a2f2957436e8414781c9f9200
data/.gitignore ADDED
@@ -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/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ script: "bundle exec rspec spec"
3
+ rvm:
4
+ - 2.0.0
5
+ - ruby-head
6
+
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # CHANGELOG
2
+
3
+ ## master
4
+
5
+ ## [v0.0.1](https://github.com/linjunpop/imessage/tree/v0.0.1)
6
+
7
+ * Implement send iMessage.
8
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jun Lin
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.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # Imessage
2
+
3
+ Command line tool to send iMessage.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'imessage'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install imessage
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ $ imessage send "hello" --to "foo@example.com"
23
+ ```
24
+
25
+ ## [Changelog](CHANGELOG.md)
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
34
+
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
7
+
data/bin/imessage ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ require 'imessage'
4
+
5
+ include GLI::App
6
+
7
+ program_desc 'Command line tool to send iMessage.'
8
+
9
+ version Imessage::VERSION
10
+
11
+ desc 'Send iMessage'
12
+ long_desc <<-EOS
13
+ Example: $ imessage send "hello" --to "foo@example.com"
14
+ EOS
15
+
16
+ command :send do |c|
17
+ c.desc 'Contacts'
18
+ c.flag [:to, :contacts], type: Array
19
+
20
+ c.action do |global_options, options, args|
21
+ help_now!('Message is required') if args.empty?
22
+ help_now!('Contacts is required') unless options[:contacts]
23
+
24
+ Imessage::Sender.send(
25
+ message: args.first,
26
+ contacts: options[:contacts]
27
+ )
28
+ end
29
+ end
30
+
31
+ pre do |global,command,options,args|
32
+ true
33
+ end
34
+
35
+ post do |global,command,options,args|
36
+ # Post logic here
37
+ # Use skips_post before a command to skip this
38
+ # block on that command only
39
+ end
40
+
41
+ on_error do |exception|
42
+ # Error logic here
43
+ # return false to skip default error handling
44
+ true
45
+ end
46
+
47
+ exit run(ARGV)
data/imessage.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'imessage/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "imessage"
8
+ spec.version = Imessage::VERSION
9
+ spec.authors = ["Jun Lin"]
10
+ spec.email = ["linjunpop@gmail.com"]
11
+ spec.description = "Command line tool to send iMessage."
12
+ spec.summary = "Command line tool to send iMessage."
13
+ spec.homepage = "https://github.com/linjunpop/imessage"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec", '~> 2.14'
24
+
25
+ spec.add_runtime_dependency 'gli','~> 2.8.1'
26
+ end
data/lib/imessage.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'imessage/version'
2
+ require 'imessage/sender'
3
+
4
+ module Imessage
5
+ end
6
+
@@ -0,0 +1,7 @@
1
+ on run argv
2
+ set toAddress to first item of argv
3
+ set message to second item of argv
4
+ tell application "Messages"
5
+ send message to buddy toAddress of (service 1 whose service type is iMessage)
6
+ end tell
7
+ end run
@@ -0,0 +1,10 @@
1
+ module Imessage
2
+ class Sender
3
+ def self.send(message:'', contacts: [])
4
+ contacts.each do |contact|
5
+ apple_script_file = File.join(File.dirname(File.expand_path(__FILE__)), 'scripts/send_imessage.applescript')
6
+ `osascript #{apple_script_file} '#{contact}' '#{message}'`
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Imessage
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,3 @@
1
+ require 'rspec/autorun'
2
+ require 'imessage'
3
+
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: imessage
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jun Lin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: gli
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.8.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 2.8.1
69
+ description: Command line tool to send iMessage.
70
+ email:
71
+ - linjunpop@gmail.com
72
+ executables:
73
+ - imessage
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - .rspec
79
+ - .travis.yml
80
+ - CHANGELOG.md
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/imessage
86
+ - imessage.gemspec
87
+ - lib/imessage.rb
88
+ - lib/imessage/scripts/send_imessage.applescript
89
+ - lib/imessage/sender.rb
90
+ - lib/imessage/version.rb
91
+ - spec/spec_helper.rb
92
+ homepage: https://github.com/linjunpop/imessage
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.1.10
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Command line tool to send iMessage.
116
+ test_files:
117
+ - spec/spec_helper.rb
118
+ has_rdoc: