rmate 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rmate.gemspec
4
+ gemspec
@@ -2,13 +2,15 @@
2
2
 
3
3
  If you wish to activate TextMate from an ssh session you can do so by copying the `rmate` (ruby) script to the server you are logged into. The script will connect back to TextMate running on your Mac so you should setup an ssh tunnel (as your Mac is likely behind NAT):
4
4
 
5
- ssh -R 52698:127.0.0.1:52698 «server»
5
+ ssh -R 52698:127.0.0.1:52698 user@example.org
6
6
 
7
7
  # Usage
8
8
 
9
- Call `rmate --help` for options. Default options can be set in `/etc/rmate.rc` or `~/.rmate.rc`, e.g.:
9
+ rmate [options] file
10
10
 
11
- host: auto
11
+ Call `rmate --help` for a list of options. Default options can be set in `/etc/rmate.rc` or `~/.rmate.rc`, e.g.:
12
+
13
+ host: auto # prefer host from SSH_CONNECTION over localhost
12
14
  port: 52698
13
15
 
14
16
  You can also set the `RMATE_HOST` and `RMATE_PORT` environment variables.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/rmate CHANGED
@@ -8,8 +8,10 @@ require 'optparse'
8
8
  require 'socket'
9
9
  require 'tempfile'
10
10
  require 'yaml'
11
+ require 'fileutils'
12
+ require 'rmate'
11
13
 
12
- VERSION_STRING = 'rmate version 1.5 (2012-09-19)'
14
+ VERSION_STRING = 'rmate version %s (%s)' % Rmate::VERSION, Rmate::DATE
13
15
 
14
16
  class Settings
15
17
  attr_accessor :host, :port, :wait, :force, :verbose, :lines, :names, :types
@@ -99,26 +101,20 @@ end
99
101
 
100
102
  def handle_save(socket, variables, data)
101
103
  path = variables["token"]
102
- $stderr.puts "Saving #{path}" if $settings.verbose
103
- begin
104
- backup_path = "#{path}~"
105
- backup_path = "#{backup_path}~" while File.exists? backup_path
106
- File.link(path, backup_path) if File.exist? path
107
- Tempfile.open("rmate", File.dirname(path)) do |temp|
108
- temp.close(false)
109
- if File.exists?(path)
110
- if stat = File.stat(path)
111
- File.chown(stat.uid, stat.gid, temp.path)
112
- File.chmod(stat.mode, temp.path)
113
- end
114
- end
115
- open(temp.path, 'wb') {|file| file << data }
116
- File.rename(temp.path, path)
104
+ if File.writable? path
105
+ $stderr.puts "Saving #{path}" if $settings.verbose
106
+ begin
107
+ backup_path = "#{path}~"
108
+ backup_path = "#{backup_path}~" while File.exists? backup_path
109
+ FileUtils.cp(path, backup_path, :preserve => true) if File.exists?(path)
110
+ open(path, 'wb') { |file| file << data }
111
+ File.unlink(backup_path) if File.exist? backup_path
112
+ rescue
113
+ # TODO We probably want some way to notify the server app that the save failed
114
+ $stderr.puts "Save failed! #{$!}" if $settings.verbose
117
115
  end
118
- File.unlink(backup_path) if File.exist? backup_path
119
- rescue
120
- # TODO We probably want some way to notify the server app that the save failed
121
- $stderr.puts "Save failed! #{$!}" if $settings.verbose
116
+ else
117
+ $stderr.puts "Skipping save, file not writable." if $settings.verbose
122
118
  end
123
119
  end
124
120
 
@@ -0,0 +1,5 @@
1
+ require "rmate/version"
2
+
3
+ module Rmate
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,4 @@
1
+ module Rmate
2
+ VERSION = "1.5.3"
3
+ DATE = "2013-03-16"
4
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/rmate/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'rmate'
6
+ gem.version = Rmate::VERSION
7
+ gem.date = Rmate::DATE
8
+ gem.description = %q{Remote TextMate}
9
+ gem.summary = %q{Edit files from anywhere in TextMate 2 on your local Mac.}
10
+ gem.email = ['rmate@textmate.org']
11
+ gem.homepage = 'https://github.com/textmate/rmate/'
12
+
13
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.authors = `git log --pretty="format:%an"|sort -u`.split("\n")
16
+ gem.require_paths = ['lib']
17
+ end
metadata CHANGED
@@ -5,15 +5,17 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 2
9
- version: 1.5.2
8
+ - 3
9
+ version: 1.5.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex Ross
13
13
  - Allan Odgaard
14
14
  - "Ciar\xC3\xA1n Walsh"
15
+ - Curt Sellmer
15
16
  - James Edward Gray II
16
17
  - John St. John
18
+ - Michael Sheets
17
19
  - Nicolas Ledez
18
20
  - OZAWA Sakuro
19
21
  - Timothy Andrew
@@ -26,8 +28,9 @@ date: 2013-03-16 00:00:00 +01:00
26
28
  default_executable:
27
29
  dependencies: []
28
30
 
29
- description: This program can be used to edit text files in TextMate 2 running on your local Mac.
30
- email: rmate@textmate.org
31
+ description: Remote TextMate
32
+ email:
33
+ - rmate@textmate.org
31
34
  executables:
32
35
  - rmate
33
36
  extensions: []
@@ -35,10 +38,15 @@ extensions: []
35
38
  extra_rdoc_files: []
36
39
 
37
40
  files:
38
- - bin/rmate
41
+ - Gemfile
39
42
  - README.mdown
43
+ - Rakefile
44
+ - bin/rmate
45
+ - lib/rmate.rb
46
+ - lib/rmate/version.rb
47
+ - rmate.gemspec
40
48
  has_rdoc: true
41
- homepage: https://github.com/textmate/rmate
49
+ homepage: https://github.com/textmate/rmate/
42
50
  licenses: []
43
51
 
44
52
  post_install_message:
@@ -66,6 +74,6 @@ rubyforge_project:
66
74
  rubygems_version: 1.3.6
67
75
  signing_key:
68
76
  specification_version: 3
69
- summary: Proxy edits to a Mac running TextMate 2
77
+ summary: Edit files from anywhere in TextMate 2 on your local Mac.
70
78
  test_files: []
71
79