forked from drnic/ruby-tmbundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/drnic/ruby-tmbundle
- Loading branch information
Showing
16 changed files
with
334 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>beforeRunningCommand</key> | ||
<string>nop</string> | ||
<key>command</key> | ||
<string>#!/usr/bin/env ruby -w | ||
unless ENV["TM_FILEPATH"] | ||
puts <<-SIMPLE_SNIPPET | ||
# NOTE: if you save this file first it will create a | ||
# namespaced rake/sake task based on the file's | ||
# path within the project | ||
task ${1::${2:task_name}} do | ||
$0 | ||
end | ||
SIMPLE_SNIPPET | ||
exit | ||
end | ||
def indent_str | ||
"\t" * @indent | ||
end | ||
relative_filepath = ENV["TM_FILEPATH"]. | ||
gsub(ENV["TM_PROJECT_DIRECTORY"], ''). | ||
gsub(/^\/?/,''). | ||
gsub(/\.[sr]ake$/, '') | ||
task_name, *reverse_namespaces = relative_filepath.split(/[\/\\]/).reverse | ||
namespaces = reverse_namespaces.reverse | ||
@indent = 0 | ||
namespaces.each do |namespace| | ||
puts "#{indent_str}namespace '#{namespace}' do" | ||
@indent += 1 | ||
end | ||
puts <<-TASK_SNIPPET | ||
#{indent_str}${2:desc "${1:This task ...}" | ||
#{indent_str}}task :#{task_name} do | ||
#{indent_str} $0 | ||
#{indent_str}end | ||
TASK_SNIPPET | ||
reverse_namespaces.each_with_index do |namespace, index| | ||
@indent -= 1 | ||
puts "#{indent_str}end" | ||
end</string> | ||
<key>fallbackInput</key> | ||
<string>none</string> | ||
<key>input</key> | ||
<string>selection</string> | ||
<key>name</key> | ||
<string>Rake/Sake task using file path</string> | ||
<key>output</key> | ||
<string>insertAsSnippet</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>task</string> | ||
<key>uuid</key> | ||
<string>E07FF68B-C87D-4332-8477-D026929FDADA</string> | ||
</dict> | ||
</plist> |
16 changes: 16 additions & 0 deletions
16
Snippets/File_open(filename, 'r') { |f| f_read }.tmSnippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>File.open(${1:filename}, '${2:r}') { |${3:f}| $3.read }$0</string> | ||
<key>name</key> | ||
<string>File.open(filename, 'r') { |f| f.read }</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>filer</string> | ||
<key>uuid</key> | ||
<string>005EB926-4BFE-4BFA-93B2-C9030636289C</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>File.read(${1:filename})$0</string> | ||
<key>name</key> | ||
<string>File.read(filename)</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>filer</string> | ||
<key>uuid</key> | ||
<string>FAFE9F5C-BF9C-4416-8623-2CB8EBC31B3C</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
Snippets/class __ < Test::Unit::TestCase with test_helper.tmSnippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>require File.dirname(__FILE__) + "/test_helper" | ||
require "${1:`#!/usr/bin/env ruby | ||
require 'rubygems' | ||
require "active_support" | ||
puts (ENV['TM_FILENAME'] || 'test_some_model.rb').gsub(/\.rb$/, '').gsub(/^test_/,'').gsub(/_test$/,'') | ||
`}" | ||
class Test${2:${1/([\w&&[^_]]+)|./\u$1/g}} < Test::Unit::TestCase | ||
def test_${3:case_name} | ||
$0 | ||
end | ||
end</string> | ||
<key>name</key> | ||
<string>class .. < Test::Unit::TestCase with test_helper</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>tch</string> | ||
<key>uuid</key> | ||
<string>228CAB3A-E221-4727-B430-31E94F76C9D3</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>desc ${1:"$2"} | ||
task ${3::name} do | ||
$0 | ||
end</string> | ||
<key>name</key> | ||
<string>desc ... task :name ... end</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>task</string> | ||
<key>uuid</key> | ||
<string>FE9A8EDA-C243-4068-8F38-A615B82D08C9</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>desc ${1:"$2"}$0</string> | ||
<key>name</key> | ||
<string>desc ...</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>desc</string> | ||
<key>uuid</key> | ||
<string>F686E1AD-B03D-45A6-BD51-6E3FD1298FE0</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>namespace ${1::name} do | ||
$0 | ||
end</string> | ||
<key>name</key> | ||
<string>namespace :name ... end</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>namespace</string> | ||
<key>uuid</key> | ||
<string>A3D89AAA-9156-4077-A026-37BB7358C3BA</string> | ||
</dict> | ||
</plist> |
23 changes: 23 additions & 0 deletions
23
Snippets/namespace :name ___ task :default ___ end.tmSnippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>namespace ${1::name} do | ||
desc ${2:"${3:default task for namespace $1}"} | ||
task :default do | ||
$0 | ||
end | ||
end</string> | ||
<key>name</key> | ||
<string>namespace :name ... task :default ... end</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>namespace</string> | ||
<key>uuid</key> | ||
<string>2031FC41-CBD3-41CC-B9A9-7F068E607A05</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>task ${1::name} do | ||
$0 | ||
end</string> | ||
<key>name</key> | ||
<string>task :name ... end</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>tabTrigger</key> | ||
<string>task</string> | ||
<key>uuid</key> | ||
<string>CB81DA55-F3BC-4BFB-B0C5-29F0EE6F8081</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.