rmate 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.mdown +8 -5
- data/bin/rmate +36 -20
- data/lib/rmate.rb +36 -20
- data/rmate.gemspec +2 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df13b1ad905e18aecc8727b1f12d7f3ad3efc0c8
|
4
|
+
data.tar.gz: 7011a8c285b498fb9caacd053b5641e203f8201d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a1b17c25063cad0bda780f83954e9f8af439a29d110b00d68ff1335c63a40c8f90b8290eb2b3628800a8376d440edf20dc1f05aba368c84854f8c4b816b455
|
7
|
+
data.tar.gz: b5fa8782db9ed962040cf3f0512fe15f6ca3bde3c6b62e91cb5d8abf08c5d1fc0bbeddee0e6206514ee838a0784dbcf1a08bea799eb96f41db9ae60dd73026fa
|
data/README.mdown
CHANGED
@@ -4,6 +4,10 @@ If you wish to activate TextMate from an ssh session you can do so by copying th
|
|
4
4
|
|
5
5
|
ssh -R 52698:localhost:52698 user@example.org
|
6
6
|
|
7
|
+
or, if using unix sockets (available with OpenSSH v6.7 and above):
|
8
|
+
|
9
|
+
ssh -R /home/user/.rmate.socket:localhost:52698 user@example.org
|
10
|
+
|
7
11
|
# Install
|
8
12
|
|
9
13
|
## Rubygems
|
@@ -33,16 +37,15 @@ If `~/bin` is not already in your `PATH` then you may want to add something like
|
|
33
37
|
|
34
38
|
Call `rmate --help` for a list of options. Default options can be set in `/etc/rmate.rc` or `~/.rmate.rc`, e.g.:
|
35
39
|
|
36
|
-
host: auto
|
40
|
+
host: auto # Prefer host from SSH_CONNECTION over localhost
|
37
41
|
port: 52698
|
42
|
+
unixsocket: ~/.rmate.socket # Use this socket file if it exists
|
38
43
|
|
39
|
-
You can also set the `RMATE_HOST` and `
|
44
|
+
You can also set the `RMATE_HOST`, `RMATE_PORT` and `RMATE_UNIXSOCKET` environment variables.
|
40
45
|
|
41
46
|
For more info see this [blog post about rmate](http://blog.macromates.com/2011/mate-and-rmate/ "TextMate Blog » mate and rmate").
|
42
47
|
|
43
48
|
# Ports
|
44
49
|
|
45
50
|
- [Bash](https://github.com/aurora/rmate) by Harald Lapp
|
46
|
-
|
47
|
-
|
48
|
-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/textmate/rmate/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
51
|
+
- [Python](https://github.com/sclukey/rmate-python) by Steven Clukey
|
data/bin/rmate
CHANGED
@@ -11,15 +11,15 @@ require 'yaml'
|
|
11
11
|
require 'fileutils'
|
12
12
|
|
13
13
|
module Rmate
|
14
|
-
DATE = "
|
15
|
-
VERSION = "1.5.
|
14
|
+
DATE = "2015-06-23"
|
15
|
+
VERSION = "1.5.8"
|
16
16
|
VERSION_STRING = "rmate version #{Rmate::VERSION} (#{Rmate::DATE})"
|
17
17
|
|
18
18
|
class Settings
|
19
|
-
attr_accessor :host, :port, :wait, :force, :verbose, :lines, :names, :types
|
19
|
+
attr_accessor :host, :port, :unixsocket, :wait, :force, :verbose, :lines, :names, :types
|
20
20
|
|
21
21
|
def initialize
|
22
|
-
@host, @port = 'localhost', 52698
|
22
|
+
@host, @port, @unixsocket = 'localhost', 52698, '~/.rmate.socket'
|
23
23
|
|
24
24
|
@wait = false
|
25
25
|
@force = false
|
@@ -30,8 +30,9 @@ module Rmate
|
|
30
30
|
|
31
31
|
read_disk_settings
|
32
32
|
|
33
|
-
@host
|
34
|
-
@port
|
33
|
+
@host = ENV['RMATE_HOST'].to_s if ENV.has_key? 'RMATE_HOST'
|
34
|
+
@port = ENV['RMATE_PORT'].to_i if ENV.has_key? 'RMATE_PORT'
|
35
|
+
@unixsocket = ENV['RMATE_UNIXSOCKET'].to_s if ENV.has_key? 'RMATE_UNIXSOCKET'
|
35
36
|
|
36
37
|
parse_cli_options
|
37
38
|
|
@@ -43,22 +44,25 @@ module Rmate
|
|
43
44
|
file = File.expand_path current_file
|
44
45
|
if File.exist? file
|
45
46
|
params = YAML::load(File.open(file))
|
46
|
-
@host
|
47
|
-
@port
|
47
|
+
@host = params["host"] unless params["host"].nil?
|
48
|
+
@port = params["port"] unless params["port"].nil?
|
49
|
+
@unixsocket = params["unixsocket"] unless params["unixsocket"].nil?
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
52
54
|
def parse_cli_options
|
53
55
|
OptionParser.new do |o|
|
54
|
-
o.on( '--host=name', "Connect to host.", "Use 'auto' to detect the host from SSH.", "Defaults to #{@host}.") { |v| @host
|
55
|
-
o.on('-
|
56
|
-
|
57
|
-
o.on('-
|
58
|
-
o.on('-
|
59
|
-
o.on('-
|
60
|
-
o.on('-
|
61
|
-
o.on('-
|
56
|
+
o.on( '--host=name', "Connect to host.", "Use 'auto' to detect the host from SSH.", "Defaults to #{@host}.") { |v| @host = v }
|
57
|
+
o.on('-s', '--unixsocket=name', "UNIX socket path.", "Takes precedence over host/port if the file exists", \
|
58
|
+
"Default #{@unixsocket}") { |v| @unixsocket = v }
|
59
|
+
o.on('-p', '--port=#', Integer, "Port number to use for connection.", "Defaults to #{@port}.") { |v| @port = v }
|
60
|
+
o.on('-w', '--[no-]wait', 'Wait for file to be closed by TextMate.') { |v| @wait = v }
|
61
|
+
o.on('-l', '--line [NUMBER]', 'Place caret on line [NUMBER] after loading file.') { |v| @lines <<= v }
|
62
|
+
o.on('-m', '--name [NAME]', 'The display name shown in TextMate.') { |v| @names <<= v }
|
63
|
+
o.on('-t', '--type [TYPE]', 'Treat file as having [TYPE].') { |v| @types <<= v }
|
64
|
+
o.on('-f', '--force', 'Open even if the file is not writable.') { |v| @force = v }
|
65
|
+
o.on('-v', '--verbose', 'Verbose logging messages.') { |v| @verbose = v }
|
62
66
|
o.on_tail('-h', '--help', 'Show this message.') { puts o; exit }
|
63
67
|
o.on_tail( '--version', 'Show version.') { puts VERSION_STRING; exit }
|
64
68
|
o.parse!
|
@@ -153,8 +157,20 @@ module Rmate
|
|
153
157
|
end
|
154
158
|
end
|
155
159
|
|
156
|
-
def connect_and_handle_cmds(host, port, cmds)
|
157
|
-
socket =
|
160
|
+
def connect_and_handle_cmds(host, port, unixsocketpath, cmds)
|
161
|
+
socket = nil
|
162
|
+
unixsocketpath = File.expand_path(unixsocketpath) unless unixsocketpath.nil?
|
163
|
+
if unixsocketpath.nil? || !File.exist?(unixsocketpath)
|
164
|
+
$stderr.puts "Using TCP socket to connect: ‘#{host}:#{port}’" if $settings.verbose
|
165
|
+
begin
|
166
|
+
socket = TCPSocket.new(host, port)
|
167
|
+
rescue Exception => e
|
168
|
+
abort "Error connecting to ‘#{host}:#{port}’: #{e.message}"
|
169
|
+
end
|
170
|
+
else
|
171
|
+
$stderr.puts "Using UNIX socket to connect: ‘#{unixsocketpath}’" if $settings.verbose
|
172
|
+
socket = UNIXSocket.new(unixsocketpath)
|
173
|
+
end
|
158
174
|
server_info = socket.readline.chomp
|
159
175
|
$stderr.puts "Connect: ‘#{server_info}’" if $settings.verbose
|
160
176
|
|
@@ -204,9 +220,9 @@ end
|
|
204
220
|
|
205
221
|
unless $settings.wait
|
206
222
|
pid = fork do
|
207
|
-
Rmate::connect_and_handle_cmds($settings.host, $settings.port, cmds)
|
223
|
+
Rmate::connect_and_handle_cmds($settings.host, $settings.port, $settings.unixsocket, cmds)
|
208
224
|
end
|
209
225
|
Process.detach(pid)
|
210
226
|
else
|
211
|
-
Rmate::connect_and_handle_cmds($settings.host, $settings.port, cmds)
|
227
|
+
Rmate::connect_and_handle_cmds($settings.host, $settings.port, $settings.unixsocket, cmds)
|
212
228
|
end
|
data/lib/rmate.rb
CHANGED
@@ -11,15 +11,15 @@ require 'yaml'
|
|
11
11
|
require 'fileutils'
|
12
12
|
|
13
13
|
module Rmate
|
14
|
-
DATE = "
|
15
|
-
VERSION = "1.5.
|
14
|
+
DATE = "2015-06-23"
|
15
|
+
VERSION = "1.5.8"
|
16
16
|
VERSION_STRING = "rmate version #{Rmate::VERSION} (#{Rmate::DATE})"
|
17
17
|
|
18
18
|
class Settings
|
19
|
-
attr_accessor :host, :port, :wait, :force, :verbose, :lines, :names, :types
|
19
|
+
attr_accessor :host, :port, :unixsocket, :wait, :force, :verbose, :lines, :names, :types
|
20
20
|
|
21
21
|
def initialize
|
22
|
-
@host, @port = 'localhost', 52698
|
22
|
+
@host, @port, @unixsocket = 'localhost', 52698, '~/.rmate.socket'
|
23
23
|
|
24
24
|
@wait = false
|
25
25
|
@force = false
|
@@ -30,8 +30,9 @@ module Rmate
|
|
30
30
|
|
31
31
|
read_disk_settings
|
32
32
|
|
33
|
-
@host
|
34
|
-
@port
|
33
|
+
@host = ENV['RMATE_HOST'].to_s if ENV.has_key? 'RMATE_HOST'
|
34
|
+
@port = ENV['RMATE_PORT'].to_i if ENV.has_key? 'RMATE_PORT'
|
35
|
+
@unixsocket = ENV['RMATE_UNIXSOCKET'].to_s if ENV.has_key? 'RMATE_UNIXSOCKET'
|
35
36
|
|
36
37
|
parse_cli_options
|
37
38
|
|
@@ -43,22 +44,25 @@ module Rmate
|
|
43
44
|
file = File.expand_path current_file
|
44
45
|
if File.exist? file
|
45
46
|
params = YAML::load(File.open(file))
|
46
|
-
@host
|
47
|
-
@port
|
47
|
+
@host = params["host"] unless params["host"].nil?
|
48
|
+
@port = params["port"] unless params["port"].nil?
|
49
|
+
@unixsocket = params["unixsocket"] unless params["unixsocket"].nil?
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
52
54
|
def parse_cli_options
|
53
55
|
OptionParser.new do |o|
|
54
|
-
o.on( '--host=name', "Connect to host.", "Use 'auto' to detect the host from SSH.", "Defaults to #{@host}.") { |v| @host
|
55
|
-
o.on('-
|
56
|
-
|
57
|
-
o.on('-
|
58
|
-
o.on('-
|
59
|
-
o.on('-
|
60
|
-
o.on('-
|
61
|
-
o.on('-
|
56
|
+
o.on( '--host=name', "Connect to host.", "Use 'auto' to detect the host from SSH.", "Defaults to #{@host}.") { |v| @host = v }
|
57
|
+
o.on('-s', '--unixsocket=name', "UNIX socket path.", "Takes precedence over host/port if the file exists", \
|
58
|
+
"Default #{@unixsocket}") { |v| @unixsocket = v }
|
59
|
+
o.on('-p', '--port=#', Integer, "Port number to use for connection.", "Defaults to #{@port}.") { |v| @port = v }
|
60
|
+
o.on('-w', '--[no-]wait', 'Wait for file to be closed by TextMate.') { |v| @wait = v }
|
61
|
+
o.on('-l', '--line [NUMBER]', 'Place caret on line [NUMBER] after loading file.') { |v| @lines <<= v }
|
62
|
+
o.on('-m', '--name [NAME]', 'The display name shown in TextMate.') { |v| @names <<= v }
|
63
|
+
o.on('-t', '--type [TYPE]', 'Treat file as having [TYPE].') { |v| @types <<= v }
|
64
|
+
o.on('-f', '--force', 'Open even if the file is not writable.') { |v| @force = v }
|
65
|
+
o.on('-v', '--verbose', 'Verbose logging messages.') { |v| @verbose = v }
|
62
66
|
o.on_tail('-h', '--help', 'Show this message.') { puts o; exit }
|
63
67
|
o.on_tail( '--version', 'Show version.') { puts VERSION_STRING; exit }
|
64
68
|
o.parse!
|
@@ -153,8 +157,20 @@ module Rmate
|
|
153
157
|
end
|
154
158
|
end
|
155
159
|
|
156
|
-
def connect_and_handle_cmds(host, port, cmds)
|
157
|
-
socket =
|
160
|
+
def connect_and_handle_cmds(host, port, unixsocketpath, cmds)
|
161
|
+
socket = nil
|
162
|
+
unixsocketpath = File.expand_path(unixsocketpath) unless unixsocketpath.nil?
|
163
|
+
if unixsocketpath.nil? || !File.exist?(unixsocketpath)
|
164
|
+
$stderr.puts "Using TCP socket to connect: ‘#{host}:#{port}’" if $settings.verbose
|
165
|
+
begin
|
166
|
+
socket = TCPSocket.new(host, port)
|
167
|
+
rescue Exception => e
|
168
|
+
abort "Error connecting to ‘#{host}:#{port}’: #{e.message}"
|
169
|
+
end
|
170
|
+
else
|
171
|
+
$stderr.puts "Using UNIX socket to connect: ‘#{unixsocketpath}’" if $settings.verbose
|
172
|
+
socket = UNIXSocket.new(unixsocketpath)
|
173
|
+
end
|
158
174
|
server_info = socket.readline.chomp
|
159
175
|
$stderr.puts "Connect: ‘#{server_info}’" if $settings.verbose
|
160
176
|
|
@@ -204,9 +220,9 @@ end
|
|
204
220
|
|
205
221
|
unless $settings.wait
|
206
222
|
pid = fork do
|
207
|
-
Rmate::connect_and_handle_cmds($settings.host, $settings.port, cmds)
|
223
|
+
Rmate::connect_and_handle_cmds($settings.host, $settings.port, $settings.unixsocket, cmds)
|
208
224
|
end
|
209
225
|
Process.detach(pid)
|
210
226
|
else
|
211
|
-
Rmate::connect_and_handle_cmds($settings.host, $settings.port, cmds)
|
227
|
+
Rmate::connect_and_handle_cmds($settings.host, $settings.port, $settings.unixsocket, cmds)
|
212
228
|
end
|
data/rmate.gemspec
CHANGED
@@ -9,8 +9,9 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.summary = %q{Edit files from anywhere in TextMate 2 on your local Mac.}
|
10
10
|
gem.email = ['rmate@textmate.org']
|
11
11
|
gem.homepage = 'https://github.com/textmate/rmate/'
|
12
|
+
gem.license = 'MIT'
|
12
13
|
|
13
14
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
15
|
gem.files = `git ls-files`.split("\n")
|
15
|
-
gem.authors = `git log --pretty=
|
16
|
+
gem.authors = `git log --pretty='format:%an' -- . ':!README*'|sort|uniq -c|sort -k2|sort -srnk1|sed -E 's/^ *[0-9]+ //'`.split("\n")
|
16
17
|
end
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Adam Strzelecki
|
8
|
-
- Alex Ross
|
9
7
|
- Allan Odgaard
|
8
|
+
- Alex Ross
|
10
9
|
- Ciarán Walsh
|
11
|
-
- Curt Sellmer
|
12
10
|
- James Edward Gray II
|
11
|
+
- Curt Sellmer
|
12
|
+
- OZAWA Sakuro
|
13
|
+
- Adam Strzelecki
|
14
|
+
- Benjamin Piwowarski
|
13
15
|
- John St. John
|
14
|
-
- Michael Sheets
|
15
16
|
- Nicolas Ledez
|
16
|
-
- OZAWA Sakuro
|
17
17
|
- Richard Myers
|
18
18
|
- Rogelio Gudino
|
19
19
|
- Timothy Andrew
|
@@ -21,7 +21,7 @@ authors:
|
|
21
21
|
autorequire:
|
22
22
|
bindir: bin
|
23
23
|
cert_chain: []
|
24
|
-
date:
|
24
|
+
date: 2015-06-23 00:00:00.000000000 Z
|
25
25
|
dependencies: []
|
26
26
|
description: Remote TextMate
|
27
27
|
email:
|
@@ -38,7 +38,8 @@ files:
|
|
38
38
|
- lib/rmate.rb
|
39
39
|
- rmate.gemspec
|
40
40
|
homepage: https://github.com/textmate/rmate/
|
41
|
-
licenses:
|
41
|
+
licenses:
|
42
|
+
- MIT
|
42
43
|
metadata: {}
|
43
44
|
post_install_message:
|
44
45
|
rdoc_options: []
|
@@ -56,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
57
|
version: '0'
|
57
58
|
requirements: []
|
58
59
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.0.
|
60
|
+
rubygems_version: 2.0.14
|
60
61
|
signing_key:
|
61
62
|
specification_version: 4
|
62
63
|
summary: Edit files from anywhere in TextMate 2 on your local Mac.
|