tm_helper 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -16
- data/Rakefile +1 -22
- data/VERSION +1 -1
- data/lib/tm_helper/tm_helper.rb +19 -14
- data/tm_helper.gemspec +10 -11
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -4,11 +4,11 @@ Some useful utilities for Ruby development in TextMate.
|
|
4
4
|
|
5
5
|
== Features
|
6
6
|
|
7
|
-
* Formats
|
7
|
+
* Formats output when running RSpec specs in TextMate using the RSpec TextMate bundle via the method +output+
|
8
8
|
* Namely, it escapes HTML and converts +\n+ characters to +<br/>+.
|
9
|
-
* This is useful when using
|
9
|
+
* This is useful when using print statements to debug code while running specs in TextMate.
|
10
10
|
* Supports forcing of logs to the Textmate window.
|
11
|
-
* Defining TM_SHOW_LOGS in your
|
11
|
+
* Defining TM_SHOW_LOGS in your environment will cause all logs issued using the Logger class be to redirected to the TextMate runner window.
|
12
12
|
* This is useful when you want to see your application's logs while running an RSpec spec in TextMate.
|
13
13
|
|
14
14
|
== Installation
|
@@ -19,26 +19,21 @@ Include tm_helper into your Gemfile.
|
|
19
19
|
|
20
20
|
== Usage
|
21
21
|
|
22
|
-
|
22
|
+
Use +output+ as you would normally use +puts+. Output will be automatically formatted when running in an RSpec window.
|
23
23
|
|
24
|
-
|
24
|
+
If using spork with --drb, define TM_HELPER=true and TM_RSPEC=true in the shell before running spork.
|
25
25
|
|
26
|
-
|
26
|
+
eg.
|
27
27
|
|
28
|
-
|
28
|
+
$ TM_HELPER=true TM_RSPEC=true spork
|
29
29
|
|
30
|
-
|
31
|
-
puts "I am running in TextMate."
|
32
|
-
end
|
33
|
-
|
34
|
-
To test whether your spec is being executed using the RSpec TextMate bundle, use the +running_rspec_bundle?+ function:
|
30
|
+
Optionally, define TM_SHOW_LOGS to cause Logger logs issued by your application be to redirected to the TextMate runner window.
|
35
31
|
|
36
|
-
if TmHelper.running_rspec_bundle?
|
37
|
-
puts "I am running in TextMate with the RSpec TextMate bundle loaded."
|
38
|
-
end
|
39
|
-
|
40
32
|
== NOTES
|
41
33
|
|
34
|
+
This gem is an extension of the original gem I developed while I was working at Capital Thought in 2010:
|
35
|
+
http://github.com/capitalthought/tm_helper. It is open source, and licensed under the origin gem's license.
|
36
|
+
|
42
37
|
== LICENSE
|
43
38
|
|
44
39
|
Copyright 2010 Capital Thought, LLC
|
data/Rakefile
CHANGED
@@ -15,31 +15,10 @@ begin
|
|
15
15
|
gem.email = "billdoughty@capitalthought.com"
|
16
16
|
gem.homepage = "http://github.com/capitalthought/tm_helper"
|
17
17
|
gem.authors = ["shock"]
|
18
|
-
gem.add_development_dependency "activesupport", ">= 2.3.8"
|
18
|
+
gem.add_development_dependency "activesupport", ">= 2.3.8"
|
19
19
|
end
|
20
20
|
Jeweler::GemcutterTasks.new
|
21
21
|
rescue LoadError
|
22
22
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
23
23
|
end
|
24
24
|
|
25
|
-
require 'rake'
|
26
|
-
require 'rake/rdoctask'
|
27
|
-
|
28
|
-
require 'rspec/core/rake_task'
|
29
|
-
|
30
|
-
RSpec::Core::RakeTask.new( :spec ) do |t|
|
31
|
-
t.pattern = Dir.glob('spec/**/*_spec.rb')
|
32
|
-
t.rspec_opts = '--format progress'
|
33
|
-
# t.rcov = true
|
34
|
-
end
|
35
|
-
|
36
|
-
task :default => :spec
|
37
|
-
|
38
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
39
|
-
rdoc.rdoc_dir = 'rdoc'
|
40
|
-
rdoc.title = 'RailsBridge'
|
41
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
42
|
-
rdoc.rdoc_files.include('README.rdoc')
|
43
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
|
-
end
|
45
|
-
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/tm_helper/tm_helper.rb
CHANGED
@@ -5,7 +5,7 @@ module TmHelper
|
|
5
5
|
def self.convert_to_html string
|
6
6
|
CGI.escapeHTML(string).gsub("\n", "<br/>")
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def self.textmate_wrap string
|
10
10
|
if self.running_rspec_bundle?
|
11
11
|
self.convert_to_html string
|
@@ -13,25 +13,30 @@ module TmHelper
|
|
13
13
|
string
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def self.running_in_textmate?
|
18
|
-
ENV["TM_PROJECT_DIRECTORY"] || ENV["TM_FILEPATH"]
|
18
|
+
ENV["TM_PROJECT_DIRECTORY"] || ENV["TM_FILEPATH"] || ENV["TM_HELPER"]
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.running_rspec_bundle?
|
22
|
-
defined?
|
22
|
+
defined?(::RSpec::Mate) || defined?(::SpecMate) || ENV["TM_RSPEC"]
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
if TmHelper.running_in_textmate? && TmHelper.running_rspec_bundle?
|
27
27
|
module Kernel
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
def output string
|
29
|
+
puts TmHelper.convert_to_html( string ) + "<br/>"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
else
|
33
|
+
module Kernel
|
34
|
+
def output string
|
35
|
+
puts string
|
31
36
|
end
|
32
37
|
end
|
33
38
|
end
|
34
|
-
|
39
|
+
|
35
40
|
if TmHelper.running_in_textmate? && ENV["TM_SHOW_LOGS"]
|
36
41
|
require 'active_support/core_ext/logger'
|
37
42
|
class Logger
|
@@ -39,12 +44,12 @@ if TmHelper.running_in_textmate? && ENV["TM_SHOW_LOGS"]
|
|
39
44
|
alias :orig_debug :debug
|
40
45
|
alias :orig_warn :warn
|
41
46
|
alias :orig_error :error
|
42
|
-
|
43
|
-
def info string;
|
44
|
-
def debug string;
|
45
|
-
def warn string;
|
46
|
-
def error string;
|
47
|
-
|
47
|
+
|
48
|
+
def info string; output TmHelper.textmate_wrap( string ); end
|
49
|
+
def debug string; output TmHelper.textmate_wrap( string ); end
|
50
|
+
def warn string; output TmHelper.textmate_wrap( string ); end
|
51
|
+
def error string; output TmHelper.textmate_wrap( string ); end
|
52
|
+
|
48
53
|
end
|
49
54
|
end
|
50
55
|
|
data/tm_helper.gemspec
CHANGED
@@ -1,32 +1,31 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{tm_helper}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["shock"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2012-12-27}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{billdoughty@capitalthought.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
"LICENSE",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
"README.rdoc",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"lib/tm_helper.rb",
|
25
|
+
"lib/tm_helper/tm_helper.rb",
|
26
|
+
"tm_helper.gemspec"
|
27
27
|
]
|
28
28
|
s.homepage = %q{http://github.com/capitalthought/tm_helper}
|
29
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
30
29
|
s.require_paths = ["lib"]
|
31
30
|
s.rubygems_version = %q{1.3.7}
|
32
31
|
s.summary = %q{Helper for Ruby development in TextMate.}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tm_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- shock
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-12-27 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -56,8 +56,8 @@ homepage: http://github.com/capitalthought/tm_helper
|
|
56
56
|
licenses: []
|
57
57
|
|
58
58
|
post_install_message:
|
59
|
-
rdoc_options:
|
60
|
-
|
59
|
+
rdoc_options: []
|
60
|
+
|
61
61
|
require_paths:
|
62
62
|
- lib
|
63
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|