imessage 0.3.2 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84d3609bcbf7bd4228608fd4185f899278186039b407ea8afd43b39c6424d851
4
- data.tar.gz: 232d7de780bd3da50af7ad945dc0db053249d67842c81a59490f4a45b3365815
3
+ metadata.gz: a3f558b44d1c0a21dd1d9b00bab2985d2009c292c58c774555e7410080e664f5
4
+ data.tar.gz: f2432de70abf34c00d85be02ae95f57d2198e8f8c2b953694ddcdf7a5a5c2962
5
5
  SHA512:
6
- metadata.gz: 50c2fe12402815d65da455484ebebdafccc99d7e652d01bf192144b00c38f8024cfc0b2f152d1b21c1509f004cae64adf19108801b5b3bef1b52f082c6faf099
7
- data.tar.gz: b9700299416ef10d5b5aa0eb39baff1305656d18ed68ee6e2b8c82aebe035425c509f02ee7286f23477ab999e7a6e5a5844d3014829820a625c16560815c56e9
6
+ metadata.gz: eb7a871c5bff7ad01527a274e27c5e2d5aeee399d556dd70f332c66769f6c3f754a8c60c9f8c0e40bfde76405b1fec113d37d4f0933bef26729fa9ec8ba5c58c
7
+ data.tar.gz: 293a1e548cdd5a35cbdbbb2a2512385bffb6310c137ec2ad350add83c715b0658baaaca08e643e3a473d6291a06938b95c5f8964374f7bd3ab8c2dc3e61662c3
data/exe/imessage CHANGED
@@ -8,7 +8,7 @@ options = Imessage::Parser.parse(ARGV)
8
8
 
9
9
  sender = Imessage::Sender.new
10
10
  sender.deliver({
11
- text: options.text,
12
- attachment: options.attachment,
13
- contacts: options.contacts
14
- })
11
+ text: options.text,
12
+ attachment: options.attachment,
13
+ contacts: options.contacts
14
+ })
@@ -1,4 +1,4 @@
1
- require 'shellwords'
1
+ require 'pathname'
2
2
 
3
3
  module Imessage
4
4
  class Sender
@@ -30,25 +30,28 @@ module Imessage
30
30
  end
31
31
 
32
32
  def deliver_attachment(attachment, contact)
33
- apple_script_file = File.join(File.dirname(File.expand_path(__FILE__)), 'scripts/send_attachment.applescript')
33
+ apple_script_file_path = build_apple_script_file_path('send_attachment')
34
34
 
35
35
  cmd = <<~CMD.strip
36
- osascript #{apple_script_file} "#{contact}" "#{attachment}"
36
+ osascript #{apple_script_file_path} "#{contact}" "#{attachment}"
37
37
  CMD
38
38
 
39
39
  system cmd
40
40
  end
41
41
 
42
42
  def deliver_text(text, contact)
43
- apple_script_file = File.join(File.dirname(File.expand_path(__FILE__)), 'apple_scripts/send_text.applescript')
43
+ apple_script_file_path = build_apple_script_file_path('send_text')
44
44
 
45
45
  cmd = <<~CMD.strip
46
- osascript #{apple_script_file} "#{contact}" "#{text}"
46
+ osascript #{apple_script_file_path} "#{contact}" "#{text}"
47
47
  CMD
48
48
 
49
- puts cmd
50
-
51
49
  system cmd
52
50
  end
51
+
52
+ def build_apple_script_file_path(filename)
53
+ filepath = File.dirname(Pathname.new(__FILE__).realpath)
54
+ File.join(filepath, "apple_scripts/#{filename}.applescript")
55
+ end
53
56
  end
54
57
  end
@@ -1,3 +1,3 @@
1
1
  module Imessage
2
- VERSION = '0.3.2'
2
+ VERSION = '0.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imessage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jun Lin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-07 00:00:00.000000000 Z
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.3'
41
- description: Command line tool to send iMessage.
41
+ description: A command line tool to send text and attachment in Message.app.
42
42
  email:
43
43
  - linjunpop@gmail.com
44
44
  executables:
@@ -46,20 +46,7 @@ executables:
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".github/FUNDING.yml"
50
- - ".github/workflows/test.yml"
51
- - ".gitignore"
52
- - ".rspec"
53
- - ".tool-versions"
54
- - CHANGELOG.md
55
- - Gemfile
56
- - LICENSE.txt
57
- - README.md
58
- - Rakefile
59
- - bin/console
60
- - bin/setup
61
49
  - exe/imessage
62
- - imessage.gemspec
63
50
  - lib/imessage.rb
64
51
  - lib/imessage/apple_scripts/send_attachment.applescript
65
52
  - lib/imessage/apple_scripts/send_text.applescript
@@ -88,5 +75,5 @@ requirements: []
88
75
  rubygems_version: 3.0.3.1
89
76
  signing_key:
90
77
  specification_version: 4
91
- summary: Command line tool to send iMessage.
78
+ summary: Send text and attachment in Message.app on macOS.
92
79
  test_files: []
data/.github/FUNDING.yml DELETED
@@ -1,3 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: [linjunpop]
@@ -1,28 +0,0 @@
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/.gitignore DELETED
@@ -1,18 +0,0 @@
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
18
- build
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/.tool-versions DELETED
@@ -1 +0,0 @@
1
- ruby 2.6.9
data/CHANGELOG.md DELETED
@@ -1,37 +0,0 @@
1
- # CHANGELOG
2
-
3
- ## master
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
-
9
- ## [v0.3.1](https://github.com/linjunpop/imessage/tree/v0.3.1)
10
-
11
- - Skip dev tasks when being installed by Homebrew
12
-
13
- ## [v0.3.0](https://github.com/linjunpop/imessage/tree/v0.3.0)
14
-
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)
18
-
19
- ## [v0.2.0](https://github.com/linjunpop/imessage/tree/v0.2.0)
20
-
21
- - Make it possible to run imessage standalone.
22
-
23
- ## [v0.1.1](https://github.com/linjunpop/imessage/tree/v0.1.1)
24
-
25
- - Fixes fail to send messages without attachment. [#3](https://github.com/linjunpop/imessage/issues/3)
26
-
27
- ## [v0.1.0](https://github.com/linjunpop/imessage/tree/v0.1.0)
28
-
29
- - Now imessage can send attachment with `-a`.
30
-
31
- ## [v0.0.2](https://github.com/linjunpop/imessage/tree/v0.0.2)
32
-
33
- - Keep ruby 1.9 compatibility [@otzy007](https://github.com/otzy007) (https://github.com/linjunpop/imessage/pull/1)
34
-
35
- ## [v0.0.1](https://github.com/linjunpop/imessage/tree/v0.0.1)
36
-
37
- - Implement send iMessage.
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2013-2018 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 DELETED
@@ -1,60 +0,0 @@
1
- # imessage
2
-
3
- Command line tool to send iMessage.
4
-
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)
8
-
9
- ## Installation
10
-
11
- ### As a Homebrew(http://brew.sh) package
12
-
13
- $ brew install imessage-ruby
14
-
15
- ### As a gem
16
-
17
- Add this line to your application's Gemfile:
18
-
19
- gem 'imessage'
20
-
21
- And then execute:
22
-
23
- $ bundle
24
-
25
- Or install it yourself as:
26
-
27
- $ gem install imessage
28
-
29
- ## Usage
30
-
31
- ```shell
32
- Usage: imessage [options]
33
-
34
- Specific options:
35
- -t, --text [TEXT] The TEXT to deliver
36
- -a, --attachment [ATTACHMENT] Add an attachment
37
- -c, --contacts x,y,z Deliver message to these CONTACTS
38
-
39
- Common options:
40
- -h, --help Prints this help
41
- --version Show version
42
- ```
43
-
44
- ## Example
45
-
46
- ```
47
- $ imessage --text "hello" --contacts "foo@example.com" --attachment 'bar.png'
48
- ```
49
-
50
- ## [Changelog](CHANGELOG.md)
51
-
52
- ## Development
53
-
54
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
55
-
56
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
57
-
58
- ## Contributing
59
-
60
- Bug reports and pull requests are welcome on GitHub at https://github.com/linjunpop/imessage.
data/Rakefile DELETED
@@ -1,39 +0,0 @@
1
- # Skip these tasks when being installed by Homebrew
2
- unless ENV['HOMEBREW_BREW_FILE']
3
- require "bundler/gem_tasks"
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task :default => :spec
9
- end
10
-
11
- namespace :standalone do
12
- desc "Build standalone version of imessage"
13
- task :build do
14
- mkdir_p "build"
15
- File.open("build/imessage", "w") do |f|
16
- f.puts "#!/usr/bin/env ruby"
17
- f.puts "# This file is generated from https://github.com/linjunpop/imessage using `rake standalone:build`"
18
- f.puts "# any changes will be overwritten."
19
-
20
- f.puts File.read("lib/imessage.rb").gsub(/^require_relative.*\n/, '')
21
- f.puts File.read("lib/imessage/version.rb")
22
- f.puts File.read("lib/imessage/parser.rb")
23
- f.puts File.read("lib/imessage/sender.rb")
24
-
25
- f.puts File.read("exe/imessage")
26
- .gsub(/^require_relative.*\n/, '')
27
- .gsub(%r{#!/usr/bin/env ruby}, '')
28
- end
29
- sh 'chmod +x build/imessage'
30
- end
31
-
32
- desc "Install standalone script"
33
- task :install => :build do
34
- prefix = ENV['PREFIX'] || ENV['prefix'] || '/usr/local'
35
-
36
- FileUtils.mkdir_p "#{prefix}/bin"
37
- FileUtils.cp "build/imessage", "#{prefix}/bin"
38
- end
39
- end
data/bin/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'imessage'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- require 'irb'
10
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
data/imessage.gemspec DELETED
@@ -1,23 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'imessage/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'imessage'
7
- spec.version = Imessage::VERSION
8
- spec.authors = ['Jun Lin']
9
- spec.email = ['linjunpop@gmail.com']
10
-
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'
15
-
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
- spec.bindir = 'exe'
18
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_development_dependency 'rake', '~> 13.0'
22
- spec.add_development_dependency 'rspec', '~> 3.3'
23
- end