closx 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.
- checksums.yaml +15 -0
- data/.gitignore +8 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +10 -0
- data/bin/closx +6 -0
- data/closx.gemspec +24 -0
- data/lib/closx.rb +41 -0
- data/test/closx_test.rb +35 -0
- data/test/test_helper.rb +3 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODg3ZGZlZTg0MGIwMGRkNTliYWM5MTMzYzU4NGRhYTZkZmM1NzczZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDI1YTZmZDc2NjM4MGQ4ODI2YjAyZGE1NTI2OTNlOTkzNWFjMmU3Mg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ODgzYzQ2ZDdmM2MzMDAyMWM0MDUyM2ZlMjk3NTNhOWQ2NDdmNzczY2UzMmIw
|
10
|
+
ZWU0NmU0YzBlOWUyMmZiMGUwYjA4OGZmZjAzYmUxNDM0MzhkODI4NDAwYzUx
|
11
|
+
ZjM1NjViZDhiYmNlMGRmYWI5NTM1YWVkNTViZmU3NTBhZTUwNmU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MDk2ZjVkOGI5YzE0Y2NiODg4OGRjZjM3MWE4MWMwN2U3MWVmOTFlMzJlZTU2
|
14
|
+
ODA5Y2YxNGM0NjUwMmJiZDgzNzBjMmZmZmEwZjIyODRlZjJjZWM4MmM0Nzc3
|
15
|
+
YjQ2MzE1NWVlZjljNDlmNzgyYWViNGY2ZjQyODcwMjBlN2ViODU=
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Teo Ljungberg
|
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,46 @@
|
|
1
|
+
# Closx
|
2
|
+
|
3
|
+
A dumb, really dumb, hack that creates scripts for your apps
|
4
|
+
|
5
|
+
In my defence, I was bored...
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'closx'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install closx
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
This is just stupid...
|
24
|
+
|
25
|
+
$ closx 'iA Writer'
|
26
|
+
|
27
|
+
or
|
28
|
+
|
29
|
+
$ closx "/Applications/iA Writer"
|
30
|
+
|
31
|
+
Will output a script that you should add to your path
|
32
|
+
|
33
|
+
closx 'iA Writer' > ~/bin/iawriter
|
34
|
+
chmod +x ~/bin/iawriter
|
35
|
+
|
36
|
+
Or wherever you want to put it, aslong as the folder is in your $PATH.
|
37
|
+
Everything goes
|
38
|
+
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
1. Fork it
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/closx
ADDED
data/closx.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'closx'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "closx"
|
8
|
+
spec.version = Closx::VERSION
|
9
|
+
spec.authors = ["Teo Ljungberg"]
|
10
|
+
spec.email = ["teo.ljungberg@gmail.com"]
|
11
|
+
spec.description = %q{Creating quick and dirty scripts for opening OS X apps}
|
12
|
+
spec.summary = %q{Creating quick and dirty scripts for opening OS X apps}
|
13
|
+
spec.homepage = "https://github.com/metamorfos/closx"
|
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 "pry"
|
24
|
+
end
|
data/lib/closx.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
class Closx
|
2
|
+
VERSION = "0.0.1"
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def from_path path
|
6
|
+
new strip(path)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def strip name
|
12
|
+
name.split('/').last.gsub('.app', '')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :full_name, :name
|
17
|
+
|
18
|
+
def initialize full_name
|
19
|
+
@full_name = full_name.split(' ').map(&:capitalize).join(' ')
|
20
|
+
@name = full_name.gsub(' ', '').downcase
|
21
|
+
end
|
22
|
+
|
23
|
+
def script
|
24
|
+
<<-EOS
|
25
|
+
#!/bin/sh
|
26
|
+
#
|
27
|
+
# Quick shortcut to #{full_name}
|
28
|
+
#
|
29
|
+
# USAGE:
|
30
|
+
|
31
|
+
# $ #{name}
|
32
|
+
# # => opens #{full_name}
|
33
|
+
#
|
34
|
+
# $ #{name} .
|
35
|
+
# $ #{name} /path/to/some_file
|
36
|
+
# # => opens the specified directory/file in #{full_name}
|
37
|
+
|
38
|
+
open -a "#{full_name}" "$1"
|
39
|
+
EOS
|
40
|
+
end
|
41
|
+
end
|
data/test/closx_test.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class TestClosx < MiniTest::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@app = Closx.new(app_name)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_name
|
9
|
+
assert @app.name, "iawriter"
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_full_name
|
13
|
+
assert Closx.new('GoOGLe chROMe').full_name, "Google Chrome"
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_script
|
17
|
+
assert @app.script, /open\ -a \"#{app_name}\" \"\$1\"/
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_from_path
|
21
|
+
app_from_path = Closx.from_path(app_path)
|
22
|
+
assert app_from_path.name, "iawriter"
|
23
|
+
assert app_from_path.script, /open\ -a \"#{app_name}\" \"\$1\"/
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def app_name
|
29
|
+
"iA Writer"
|
30
|
+
end
|
31
|
+
|
32
|
+
def app_path
|
33
|
+
"/Applications/iA Writer.app"
|
34
|
+
end
|
35
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: closx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Teo Ljungberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
prerelease: false
|
15
|
+
name: bundler
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.3'
|
21
|
+
requirement: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ~>
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '1.3'
|
26
|
+
type: :development
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
prerelease: false
|
29
|
+
name: rake
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
prerelease: false
|
43
|
+
name: pry
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
description: Creating quick and dirty scripts for opening OS X apps
|
56
|
+
email:
|
57
|
+
- teo.ljungberg@gmail.com
|
58
|
+
executables:
|
59
|
+
- closx
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- .travis.yml
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/closx
|
70
|
+
- closx.gemspec
|
71
|
+
- lib/closx.rb
|
72
|
+
- test/closx_test.rb
|
73
|
+
- test/test_helper.rb
|
74
|
+
homepage: https://github.com/metamorfos/closx
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.0.3
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Creating quick and dirty scripts for opening OS X apps
|
98
|
+
test_files:
|
99
|
+
- test/closx_test.rb
|
100
|
+
- test/test_helper.rb
|