ssoroka-ruby_textmate 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +4 -0
- data/Rakefile +14 -0
- data/lib/ruby_textmate.rb +41 -0
- data/ruby_textmate.gemspec +31 -0
- metadata +59 -0
data/Manifest
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('ruby_textmate', '0.1.1') do |p|
|
6
|
+
p.description = 'a ruby interface to textmate'
|
7
|
+
p.url = 'http://github.com/ssoroka/ruby_textmate'
|
8
|
+
p.author = 'Steven Soroka'
|
9
|
+
p.email = 'ssoroka78@gmail.com'
|
10
|
+
p.ignore_pattern = ["tmp/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each{|f| load f }
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
class RubyTextmate
|
3
|
+
class <<self
|
4
|
+
def open(thing, options = {})
|
5
|
+
if thing && thing !~ /[\s]/ && File.exist?(thing)
|
6
|
+
open_file(thing, options)
|
7
|
+
else
|
8
|
+
open_text(thing, options)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# acceptable options are:
|
13
|
+
# :async Do not wait for file to be closed by TextMate.
|
14
|
+
# :wait Wait for file to be closed by TextMate.
|
15
|
+
# :line => <number> Place caret on line <number> after loading file.
|
16
|
+
# :recent Add file to Open Recent menu.
|
17
|
+
# :change_dir Change TextMates working directory to that of the file.
|
18
|
+
# :no_reactivation After edit :wait, do not re-activate the calling app.
|
19
|
+
def open_file(filename, options = {})
|
20
|
+
mate_options = []
|
21
|
+
mate_options << '-w' if options[:wait]
|
22
|
+
mate_options << '-a' if options[:async]
|
23
|
+
mate_options << "-l #{options[:line]}" if options[:line]
|
24
|
+
mate_options << '-r' if options[:recent]
|
25
|
+
mate_options << '-d' if options[:change_dir]
|
26
|
+
mate_options << '-n' if options[:no_reactivation]
|
27
|
+
mate_options << filename
|
28
|
+
system("mate", *mate_options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def open_text(text, options = {})
|
32
|
+
t = Tempfile.open('textmate')
|
33
|
+
filename = t.path
|
34
|
+
t.write(text)
|
35
|
+
t.close
|
36
|
+
open_file(filename, options)
|
37
|
+
t.delete
|
38
|
+
filename
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{ruby_textmate}
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Steven Soroka"]
|
9
|
+
s.date = %q{2008-12-14}
|
10
|
+
s.description = %q{a ruby interface to textmate}
|
11
|
+
s.email = %q{ssoroka78@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["lib/ruby_textmate.rb"]
|
13
|
+
s.files = ["lib/ruby_textmate.rb", "Manifest", "Rakefile", "ruby_textmate.gemspec"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://github.com/ssoroka/ruby_textmate}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ruby_textmate"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{ruby_textmate}
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
20
|
+
s.summary = %q{a ruby interface to textmate}
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 2
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ssoroka-ruby_textmate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steven Soroka
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-12-14 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: a ruby interface to textmate
|
17
|
+
email: ssoroka78@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- lib/ruby_textmate.rb
|
24
|
+
files:
|
25
|
+
- lib/ruby_textmate.rb
|
26
|
+
- Manifest
|
27
|
+
- Rakefile
|
28
|
+
- ruby_textmate.gemspec
|
29
|
+
has_rdoc: true
|
30
|
+
homepage: http://github.com/ssoroka/ruby_textmate
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options:
|
33
|
+
- --line-numbers
|
34
|
+
- --inline-source
|
35
|
+
- --title
|
36
|
+
- Ruby_textmate
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "1.2"
|
50
|
+
version:
|
51
|
+
requirements: []
|
52
|
+
|
53
|
+
rubyforge_project: ruby_textmate
|
54
|
+
rubygems_version: 1.2.0
|
55
|
+
signing_key:
|
56
|
+
specification_version: 2
|
57
|
+
summary: a ruby interface to textmate
|
58
|
+
test_files: []
|
59
|
+
|