lida 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 +7 -0
- data/.gitignore +53 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +23 -0
- data/README.md +8 -0
- data/bin/lida +102 -0
- data/lida.gemspec +16 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 20cf6abf9becdd6727c1831a93aa51bbc4a4339ffb3d49def5028bd6dd608263
|
4
|
+
data.tar.gz: 2df93f21e71361ba390bfec669ffeded0ae5e304bfc13ce219b89a6197e87f06
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a019bb8eef804aa438fd70d2b7deb88acec7c0fa5f7efe49efb3fd2a75e5e92e4dc6dd8c53da78ccdcebe5cd60d4f6535ff49226a68b18033fd1181c9c8cd415
|
7
|
+
data.tar.gz: aa6447b949dc381a7740450857f2866d69f6a6f8cfc160e03d5764e9f32827074898e46834a2afe04aa00afbd6ee2e54928b54537e8e07c04c1addb9359c4864
|
data/.gitignore
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
.idea
|
53
|
+
.vscode
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lida (0.0.1)
|
5
|
+
applescript (~> 1.0)
|
6
|
+
commander (~> 4.4)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
applescript (1.0)
|
12
|
+
commander (4.4.5)
|
13
|
+
highline (~> 1.7.2)
|
14
|
+
highline (1.7.10)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
ruby
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
lida!
|
21
|
+
|
22
|
+
BUNDLED WITH
|
23
|
+
1.16.1
|
data/README.md
ADDED
data/bin/lida
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'commander/import'
|
5
|
+
require 'applescript'
|
6
|
+
|
7
|
+
program :name, 'Lida'
|
8
|
+
program :version, '0.0.1'
|
9
|
+
program :description, 'Folder to terminal, terminal to folder.'
|
10
|
+
program :help, 'Author', 'Quentin Jin <jianstm@gmail.com>'
|
11
|
+
|
12
|
+
# terminal to finder
|
13
|
+
command :finder do |c|
|
14
|
+
c.syntax = 'lida folder'
|
15
|
+
c.description = 'Open current directory in finder'
|
16
|
+
c.action do
|
17
|
+
`open -a Finder ./`
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
# folder to terminal
|
23
|
+
command :terminal do |c|
|
24
|
+
c.syntax = 'lida terminal'
|
25
|
+
c.description = 'Open current directory in terminal'
|
26
|
+
c.action do
|
27
|
+
script = <<-eos
|
28
|
+
set result to (path to frontmost application as text)
|
29
|
+
return result
|
30
|
+
eos
|
31
|
+
|
32
|
+
if AppleScript.execute(script) =~ /iTerm.app/
|
33
|
+
AppleScript.execute(FINDER_TO_ITERM)
|
34
|
+
else
|
35
|
+
AppleScript.execute(FINDER_TO_TERMINAL)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
default_command :terminal
|
41
|
+
|
42
|
+
FINDER_TO_ITERM = <<EOS
|
43
|
+
tell application "Finder"
|
44
|
+
if (count of windows) is 0 then
|
45
|
+
set pathList to "~"
|
46
|
+
else
|
47
|
+
set pathList to (quoted form of POSIX path of (folder of the front window as alias))
|
48
|
+
end if
|
49
|
+
set command to "clear; cd " & pathList
|
50
|
+
end tell
|
51
|
+
|
52
|
+
tell application "System Events"
|
53
|
+
-- some versions might identify as "iTerm2" instead of "iTerm"
|
54
|
+
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2"))
|
55
|
+
end tell
|
56
|
+
|
57
|
+
tell application "iTerm"
|
58
|
+
activate
|
59
|
+
set hasNoWindows to ((count of windows) is 0)
|
60
|
+
if isRunning and hasNoWindows then
|
61
|
+
create window with default profile
|
62
|
+
end if
|
63
|
+
select first window
|
64
|
+
|
65
|
+
tell the first window
|
66
|
+
if isRunning and hasNoWindows is false then
|
67
|
+
create tab with default profile
|
68
|
+
end if
|
69
|
+
tell current session to write text command
|
70
|
+
end tell
|
71
|
+
end tell
|
72
|
+
EOS
|
73
|
+
|
74
|
+
FINDER_TO_TERMINAL = <<-EOS
|
75
|
+
tell application "Finder"
|
76
|
+
if (count of windows) is 0 then
|
77
|
+
set pathList to "~"
|
78
|
+
else
|
79
|
+
set pathList to (quoted form of POSIX path of (folder of the front window as alias))
|
80
|
+
end if
|
81
|
+
end tell
|
82
|
+
|
83
|
+
tell application "System Events"
|
84
|
+
if not (exists (processes where name is "Terminal")) then
|
85
|
+
do shell script "open -a Terminal " & pathList
|
86
|
+
else
|
87
|
+
tell application "Terminal"
|
88
|
+
activate
|
89
|
+
if (count of windows) is 0 then
|
90
|
+
do script ("cd " & pathList)
|
91
|
+
else
|
92
|
+
tell application "System Events" to tell process "Terminal.app" to keystroke "t" using command down
|
93
|
+
delay 1
|
94
|
+
do script ("cd " & pathList) in first window
|
95
|
+
end if
|
96
|
+
end tell
|
97
|
+
end if
|
98
|
+
end tell
|
99
|
+
EOS
|
100
|
+
|
101
|
+
|
102
|
+
|
data/lida.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'lida'
|
3
|
+
spec.version = '0.0.1'
|
4
|
+
spec.authors = ["Quentin Jin"]
|
5
|
+
spec.email = ["jianstm@gmail.com"]
|
6
|
+
|
7
|
+
spec.summary = "Folder to terminal, terminal to folder."
|
8
|
+
spec.homepage = "https://github.com/jianstm/lida"
|
9
|
+
spec.license = "MIT"
|
10
|
+
|
11
|
+
spec.files = `git ls-files`.split("\n")
|
12
|
+
spec.executables = 'lida'
|
13
|
+
|
14
|
+
spec.add_runtime_dependency 'commander', '~> 4.4'
|
15
|
+
spec.add_runtime_dependency 'applescript', '~> 1.0'
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lida
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Quentin Jin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: commander
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: applescript
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- jianstm@gmail.com
|
44
|
+
executables:
|
45
|
+
- lida
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- README.md
|
53
|
+
- bin/lida
|
54
|
+
- lida.gemspec
|
55
|
+
homepage: https://github.com/jianstm/lida
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.7.3
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Folder to terminal, terminal to folder.
|
79
|
+
test_files: []
|