imessage 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3033c20266aa70a54833ca0b742d3f1efd297637
4
- data.tar.gz: b1f4f038b0aaf761f43e7c7811609f3b4f9a7981
2
+ SHA256:
3
+ metadata.gz: 84d3609bcbf7bd4228608fd4185f899278186039b407ea8afd43b39c6424d851
4
+ data.tar.gz: 232d7de780bd3da50af7ad945dc0db053249d67842c81a59490f4a45b3365815
5
5
  SHA512:
6
- metadata.gz: 2eadd43ab98e74ba19a26e64731d0cfb828becc4517b8bf5f0506daa2e202bf430c53ab07e4e3dcabd64295e02883de33225b84e9c47bcfad6b58115ca25b43a
7
- data.tar.gz: 03f6fae3016e3b9b682fdf3386cf2348b2ecb62c2b37f10025e39d0107ce3bcebb3ca1fd74ccd804abc630efc9a4ba8616cf8b179e02c608994f7a3ab4134cd3
6
+ metadata.gz: 50c2fe12402815d65da455484ebebdafccc99d7e652d01bf192144b00c38f8024cfc0b2f152d1b21c1509f004cae64adf19108801b5b3bef1b52f082c6faf099
7
+ data.tar.gz: b9700299416ef10d5b5aa0eb39baff1305656d18ed68ee6e2b8c82aebe035425c509f02ee7286f23477ab999e7a6e5a5844d3014829820a625c16560815c56e9
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [linjunpop]
@@ -0,0 +1,28 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+
15
+ runs-on: macos-latest
16
+ strategy:
17
+ matrix:
18
+ ruby-version: ['2.3', '2.4', '2.6', '2.7', '3.0']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
27
+ - name: Run tests
28
+ run: bundle exec rake spec
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.6.9
data/CHANGELOG.md CHANGED
@@ -2,32 +2,36 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## [v0.3.2](https://github.com/linjunpop/imessage/tree/v0.3.2)
6
+
7
+ - Fixes Unable to send the single quote(') in message body. [#13](https://github.com/linjunpop/imessage/issues/13)
8
+
5
9
  ## [v0.3.1](https://github.com/linjunpop/imessage/tree/v0.3.1)
6
10
 
7
- * Skip dev tasks when being installed by Homebrew
11
+ - Skip dev tasks when being installed by Homebrew
8
12
 
9
13
  ## [v0.3.0](https://github.com/linjunpop/imessage/tree/v0.3.0)
10
14
 
11
- * Raise error if no contacts specified.
12
- * Update project structure for better development experience.
13
- * Fixes typo in help message [@bfontaine](https://github.com/bfontaine)
15
+ - Raise error if no contacts specified.
16
+ - Update project structure for better development experience.
17
+ - Fixes typo in help message [@bfontaine](https://github.com/bfontaine)
14
18
 
15
19
  ## [v0.2.0](https://github.com/linjunpop/imessage/tree/v0.2.0)
16
20
 
17
- * Make it possible to run imessage standalone.
21
+ - Make it possible to run imessage standalone.
18
22
 
19
23
  ## [v0.1.1](https://github.com/linjunpop/imessage/tree/v0.1.1)
20
24
 
21
- * Fixes fail to send messages without attachment. [#3](https://github.com/linjunpop/imessage/issues/3)
25
+ - Fixes fail to send messages without attachment. [#3](https://github.com/linjunpop/imessage/issues/3)
22
26
 
23
27
  ## [v0.1.0](https://github.com/linjunpop/imessage/tree/v0.1.0)
24
28
 
25
- * Now imessage can send attachment with `-a`.
29
+ - Now imessage can send attachment with `-a`.
26
30
 
27
31
  ## [v0.0.2](https://github.com/linjunpop/imessage/tree/v0.0.2)
28
32
 
29
- * Keep ruby 1.9 compatibility [@otzy007](https://github.com/otzy007) (https://github.com/linjunpop/imessage/pull/1)
33
+ - Keep ruby 1.9 compatibility [@otzy007](https://github.com/otzy007) (https://github.com/linjunpop/imessage/pull/1)
30
34
 
31
35
  ## [v0.0.1](https://github.com/linjunpop/imessage/tree/v0.0.1)
32
36
 
33
- * Implement send iMessage.
37
+ - Implement send iMessage.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 Jun Lin
1
+ Copyright (c) 2013-2018 Jun Lin
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -2,10 +2,9 @@
2
2
 
3
3
  Command line tool to send iMessage.
4
4
 
5
- [![Build Status](https://travis-ci.org/linjunpop/imessage.png?branch=master)](https://travis-ci.org/linjunpop/imessage)
6
- [![Gem Version](https://badge.fury.io/rb/imessage.png)](http://badge.fury.io/rb/imessage)
7
- [![Code Climate](https://codeclimate.com/github/linjunpop/imessage.png)](https://codeclimate.com/github/linjunpop/imessage)
8
-
5
+ ![Tests](https://github.com/linjunpop/imessage/actions/workflows/test.yml/badge.svg)
6
+ [![Gem Version](https://img.shields.io/gem/v/imessage.svg)](https://rubygems.org/gems/imessage)
7
+ [![codebeat badge](https://codebeat.co/badges/69f6f8ee-8ddd-4355-aa7c-0cd4ac369718)](https://codebeat.co/projects/github-com-linjunpop-imessage-master)
9
8
 
10
9
  ## Installation
11
10
 
@@ -59,4 +58,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
59
58
  ## Contributing
60
59
 
61
60
  Bug reports and pull requests are welcome on GitHub at https://github.com/linjunpop/imessage.
62
-
data/bin/console CHANGED
@@ -1,15 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "imessage"
3
+ require 'bundler/setup'
4
+ require 'imessage'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- require "pry"
11
- Pry.start
12
-
13
- # require "irb"
14
- # IRB.start
15
-
9
+ require 'irb'
10
+ IRB.start
data/bin/setup CHANGED
@@ -5,4 +5,3 @@ IFS=$'\n\t'
5
5
  bundle install
6
6
 
7
7
  # Do any other automated setup that you need to do here
8
-
data/imessage.gemspec CHANGED
@@ -1,27 +1,23 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'imessage/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "imessage"
6
+ spec.name = 'imessage'
8
7
  spec.version = Imessage::VERSION
9
- spec.authors = ["Jun Lin"]
10
- spec.email = ["linjunpop@gmail.com"]
8
+ spec.authors = ['Jun Lin']
9
+ spec.email = ['linjunpop@gmail.com']
11
10
 
12
- spec.summary = "Command line tool to send iMessage."
13
- spec.description = "Command line tool to send iMessage."
14
- spec.homepage = "https://github.com/linjunpop/imessage"
15
- spec.license = "MIT"
11
+ spec.summary = 'Command line tool to send iMessage.'
12
+ spec.description = 'Command line tool to send iMessage.'
13
+ spec.homepage = 'https://github.com/linjunpop/imessage'
14
+ spec.license = 'MIT'
16
15
 
17
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
17
+ spec.bindir = 'exe'
19
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
21
20
 
22
- spec.add_development_dependency "bundler", "~> 1.10"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "rspec", '~> 3.3'
25
- spec.add_development_dependency "pry"
26
- spec.add_development_dependency "pry-doc"
21
+ spec.add_development_dependency 'rake', '~> 13.0'
22
+ spec.add_development_dependency 'rspec', '~> 3.3'
27
23
  end
@@ -0,0 +1,15 @@
1
+ on run argv
2
+ set toAddress to first item of argv
3
+ set theFilePath to second item of argv
4
+ set theFile to POSIX file theFilePath
5
+
6
+ tell application "System Events"
7
+ if exists file theFilePath then
8
+ tell application "Messages"
9
+ send theFile to buddy toAddress of (service 1 whose service type is iMessage)
10
+ end tell
11
+ else
12
+ error "File not exist."
13
+ end if
14
+ end tell
15
+ end run
@@ -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
@@ -1,13 +1,11 @@
1
+ require 'shellwords'
2
+
1
3
  module Imessage
2
4
  class Sender
3
- def deliver(options = {text:nil, attachment:nil, contacts: []})
4
- if options[:text].nil? && options[:attachment].nil?
5
- raise "You must specific at least a text or attachment."
6
- end
5
+ def deliver(options = { text: nil, attachment: nil, contacts: [] })
6
+ raise 'You must specific at least a text or attachment.' if options[:text].nil? && options[:attachment].nil?
7
7
 
8
- if options[:contacts].empty?
9
- raise "You must specific at least one contact"
10
- end
8
+ raise 'You must specific at least one contact' if options[:contacts].empty?
11
9
 
12
10
  options[:contacts].each do |contact|
13
11
  _deliver(options[:text], options[:attachment], contact)
@@ -32,36 +30,25 @@ module Imessage
32
30
  end
33
31
 
34
32
  def deliver_attachment(attachment, contact)
35
- script = <<-SCRIPT
36
- on run argv
37
- set toAddress to first item of argv
38
- set theFilePath to second item of argv
39
- set theFile to POSIX file theFilePath
40
- tell application "System Events"
41
- if exists file theFilePath then
42
- tell application "Messages"
43
- send theFile to buddy toAddress of (service 1 whose service type is iMessage)
44
- end tell
45
- else
46
- error "File not exist."
47
- end if
48
- end tell
49
- end run
50
- SCRIPT
51
- `osascript -e'#{script}' '#{contact}' '#{attachment}'`
33
+ apple_script_file = File.join(File.dirname(File.expand_path(__FILE__)), 'scripts/send_attachment.applescript')
34
+
35
+ cmd = <<~CMD.strip
36
+ osascript #{apple_script_file} "#{contact}" "#{attachment}"
37
+ CMD
38
+
39
+ system cmd
52
40
  end
53
41
 
54
42
  def deliver_text(text, contact)
55
- script = <<-SCRIPT
56
- on run argv
57
- set toAddress to first item of argv
58
- set message to second item of argv
59
- tell application "Messages"
60
- send message to buddy toAddress of (service 1 whose service type is iMessage)
61
- end tell
62
- end run
63
- SCRIPT
64
- `osascript -e '#{script}' '#{contact}' '#{text}'`
43
+ apple_script_file = File.join(File.dirname(File.expand_path(__FILE__)), 'apple_scripts/send_text.applescript')
44
+
45
+ cmd = <<~CMD.strip
46
+ osascript #{apple_script_file} "#{contact}" "#{text}"
47
+ CMD
48
+
49
+ puts cmd
50
+
51
+ system cmd
65
52
  end
66
53
  end
67
54
  end
@@ -1,3 +1,3 @@
1
1
  module Imessage
2
- VERSION = "0.3.1"
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imessage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jun Lin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-30 00:00:00.000000000 Z
11
+ date: 2022-05-07 00:00:00.000000000 Z
12
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.10'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.10'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '10.0'
19
+ version: '13.0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '10.0'
26
+ version: '13.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,34 +38,6 @@ dependencies:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
40
  version: '3.3'
55
- - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-doc
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
41
  description: Command line tool to send iMessage.
84
42
  email:
85
43
  - linjunpop@gmail.com
@@ -88,9 +46,11 @@ executables:
88
46
  extensions: []
89
47
  extra_rdoc_files: []
90
48
  files:
49
+ - ".github/FUNDING.yml"
50
+ - ".github/workflows/test.yml"
91
51
  - ".gitignore"
92
52
  - ".rspec"
93
- - ".travis.yml"
53
+ - ".tool-versions"
94
54
  - CHANGELOG.md
95
55
  - Gemfile
96
56
  - LICENSE.txt
@@ -101,6 +61,8 @@ files:
101
61
  - exe/imessage
102
62
  - imessage.gemspec
103
63
  - lib/imessage.rb
64
+ - lib/imessage/apple_scripts/send_attachment.applescript
65
+ - lib/imessage/apple_scripts/send_text.applescript
104
66
  - lib/imessage/parser.rb
105
67
  - lib/imessage/sender.rb
106
68
  - lib/imessage/version.rb
@@ -123,10 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
85
  - !ruby/object:Gem::Version
124
86
  version: '0'
125
87
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.4.8
88
+ rubygems_version: 3.0.3.1
128
89
  signing_key:
129
90
  specification_version: 4
130
91
  summary: Command line tool to send iMessage.
131
92
  test_files: []
132
- has_rdoc:
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- script: "bundle exec rake spec"
3
- rvm:
4
- - 1.9.2
5
- - 1.9.3
6
- - 2.0.0
7
- - ruby-head
8
- before_install:
9
- - gem update bundler