spackle 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +9 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/spackle-vim-load-quickfix +5 -3
- data/bin/spackle-vim-open +2 -1
- data/lib/spackle.rb +4 -3
- data/spec/spackle_spec.rb +3 -3
- metadata +12 -5
- data/bin/ruby-project-root +0 -14
- data/lib/spackle/helpers/ruby_project_root.rb +0 -34
data/README.rdoc
CHANGED
@@ -82,6 +82,15 @@ Add to your spec_helper.rb:
|
|
82
82
|
require "spackle"
|
83
83
|
Spackle.init :with => :spec_formatter
|
84
84
|
|
85
|
+
<b>Note</b>: if you're not otherwise <em>explicitly</em> specifying
|
86
|
+
a standard RSpec formatter, Spackle's formatter will swallow all
|
87
|
+
your test run results, which probably isn't what you want. To prevent
|
88
|
+
this, simply make sure you specify another RSpec output formatter.
|
89
|
+
Probably the easiest way to do this is to ensure you have the following
|
90
|
+
in your <tt>spec/spec.opts</tt>
|
91
|
+
|
92
|
+
--format progress
|
93
|
+
|
85
94
|
Now whenever RSpec runs, Spackle will listen in to your test results and
|
86
95
|
relay information about any errors to your editor.
|
87
96
|
|
data/Rakefile
CHANGED
@@ -15,6 +15,7 @@ Just tell your editor to jump to the next error location.
|
|
15
15
|
gem.homepage = "http://github.com/rleemorlang/spackle"
|
16
16
|
gem.authors = ["Rick Lee-Morlang"]
|
17
17
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
18
|
+
gem.add_dependency "project_scout"
|
18
19
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
19
20
|
end
|
20
21
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -2,7 +2,7 @@
|
|
2
2
|
spackle_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
$LOAD_PATH.unshift(spackle_dir) unless $LOAD_PATH.include?(spackle_dir)
|
4
4
|
|
5
|
-
require '
|
5
|
+
require 'project_scout'
|
6
6
|
|
7
7
|
# Load a Vim Quickfix file in an active vim session.
|
8
8
|
#
|
@@ -24,7 +24,7 @@ def servername_from_arguments
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def servername_from_project_root
|
27
|
-
project_root =
|
27
|
+
project_root = ProjectScout.scan Dir.pwd
|
28
28
|
File.basename(project_root) if project_root
|
29
29
|
end
|
30
30
|
|
@@ -41,7 +41,9 @@ unless server_running?
|
|
41
41
|
sleep 1
|
42
42
|
end
|
43
43
|
|
44
|
+
STDERR.reopen("/dev/null")
|
45
|
+
STDOUT.reopen(STDERR)
|
44
46
|
system %{gvim --servername #{servername} --remote-send "<ESC>" &> /dev/null}
|
45
47
|
system %{gvim --servername #{servername} --remote-expr "LoadSpackleQuickfix('#{ARGV.first}')" &> /dev/null}
|
46
48
|
system %{gvim --servername #{servername} --remote-send "<ESC><C-W>p" &> /dev/null}
|
47
|
-
|
49
|
+
exit
|
data/bin/spackle-vim-open
CHANGED
@@ -30,7 +30,7 @@ def servername_from_arguments
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def servername_from_project_root
|
33
|
-
project_root =
|
33
|
+
project_root = ProjectScout.scan Dir.pwd
|
34
34
|
File.basename(project_root) if project_root
|
35
35
|
end
|
36
36
|
|
@@ -44,6 +44,7 @@ def arguments
|
|
44
44
|
arguments << "--remote-silent"
|
45
45
|
arguments += ARGV
|
46
46
|
end
|
47
|
+
arguments
|
47
48
|
end
|
48
49
|
|
49
50
|
system *arguments
|
data/lib/spackle.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__)))
|
2
2
|
|
3
|
+
require 'project_scout'
|
4
|
+
|
3
5
|
require 'spackle/configuration'
|
4
6
|
require 'spackle/error'
|
5
7
|
require 'spackle/output'
|
6
8
|
require 'spackle/spec' if defined? Spec
|
7
|
-
require 'spackle/helpers/ruby_project_root'
|
8
9
|
|
9
10
|
module Spackle
|
10
11
|
class << self
|
@@ -62,7 +63,7 @@ module Spackle
|
|
62
63
|
else
|
63
64
|
config_files << File.expand_path("~/.spackle")
|
64
65
|
|
65
|
-
project_root =
|
66
|
+
project_root = ProjectScout.scan Dir.pwd
|
66
67
|
if project_root
|
67
68
|
config_files << File.join(project_root, ".spackle")
|
68
69
|
end
|
@@ -78,7 +79,7 @@ module Spackle
|
|
78
79
|
end
|
79
80
|
|
80
81
|
def spackle_file
|
81
|
-
projectname =
|
82
|
+
projectname = ProjectScout.scan Dir.pwd
|
82
83
|
projectname = File.basename(projectname) + ".spackle" if projectname
|
83
84
|
filename = configuration.spackle_file || projectname || "default.spackle"
|
84
85
|
|
data/spec/spackle_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe Spackle do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should check for a .spackle file in the project root directory" do
|
34
|
-
|
34
|
+
ProjectScout.should_receive(:scan).and_return("/some/dir/project")
|
35
35
|
File.should_receive(:exists?).with any_args()
|
36
36
|
File.should_receive(:exists?).with("/some/dir/project/.spackle").and_return(true)
|
37
37
|
Spackle.load_config_from_dotfile.should be_true
|
@@ -82,12 +82,12 @@ describe Spackle do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should end with default.spackle if no project root detected" do
|
85
|
-
|
85
|
+
ProjectScout.stub! :scan => nil
|
86
86
|
Spackle.spackle_file.should match(%r(/default\.spackle$))
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should be named after the project root if detected" do
|
90
|
-
|
90
|
+
ProjectScout.should_receive(:scan).and_return("/some/dir/project")
|
91
91
|
Spackle.spackle_file.should match(%r(/project\.spackle$))
|
92
92
|
end
|
93
93
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spackle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rick Lee-Morlang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-07 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,16 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 1.2.9
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: project_scout
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
25
35
|
description: "\n\
|
26
36
|
Spackle tells your editor about the errors in your code. No more need to \n\
|
27
37
|
visually scan your test output for errors, filenames, and line numbers.\n\
|
@@ -31,7 +41,6 @@ email: rick@lee-morlang.com
|
|
31
41
|
executables:
|
32
42
|
- spackle
|
33
43
|
- spackle-vim-open
|
34
|
-
- ruby-project-root
|
35
44
|
- spackle-vim-load-quickfix
|
36
45
|
extensions: []
|
37
46
|
|
@@ -45,7 +54,6 @@ files:
|
|
45
54
|
- README.rdoc
|
46
55
|
- Rakefile
|
47
56
|
- VERSION
|
48
|
-
- bin/ruby-project-root
|
49
57
|
- bin/spackle
|
50
58
|
- bin/spackle-vim-load-quickfix
|
51
59
|
- bin/spackle-vim-open
|
@@ -53,7 +61,6 @@ files:
|
|
53
61
|
- lib/spackle/commandline.rb
|
54
62
|
- lib/spackle/configuration.rb
|
55
63
|
- lib/spackle/error.rb
|
56
|
-
- lib/spackle/helpers/ruby_project_root.rb
|
57
64
|
- lib/spackle/output.rb
|
58
65
|
- lib/spackle/output/base.rb
|
59
66
|
- lib/spackle/output/vim_quickfix.rb
|
data/bin/ruby-project-root
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
spackle_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
$LOAD_PATH.unshift(spackle_dir) unless $LOAD_PATH.include?(spackle_dir)
|
4
|
-
|
5
|
-
require 'spackle/helpers/ruby_project_root'
|
6
|
-
|
7
|
-
project_root = Spackle::Helpers::RubyProjectRoot.search Dir.pwd
|
8
|
-
|
9
|
-
if project_root.nil?
|
10
|
-
exit 1
|
11
|
-
else
|
12
|
-
puts project_root
|
13
|
-
end
|
14
|
-
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Spackle
|
2
|
-
module Helpers
|
3
|
-
module RubyProjectRoot
|
4
|
-
class << self
|
5
|
-
# Search recursively from the current working directory up for something
|
6
|
-
# that looks like the root directory of a Ruby project.
|
7
|
-
#
|
8
|
-
# Returns the path to the found project dir, if any. Nil otherwise.
|
9
|
-
#
|
10
|
-
# Stops looking when it reaches the top of the tree, or the user's
|
11
|
-
# home directory.
|
12
|
-
#
|
13
|
-
# Detects a project dir via any of:
|
14
|
-
# * a config/environment.rb file
|
15
|
-
# * a spec/spec_helper.rb file
|
16
|
-
# * a features/step_definitions directory
|
17
|
-
def search(directory)
|
18
|
-
directory = File.expand_path(directory)
|
19
|
-
while directory != '/'
|
20
|
-
return directory if is_project_dir?(directory)
|
21
|
-
directory = File.expand_path(directory + '/..')
|
22
|
-
end
|
23
|
-
nil
|
24
|
-
end
|
25
|
-
|
26
|
-
def is_project_dir?(path)
|
27
|
-
File.exists?(File.join(path, "config/environment.rb")) ||
|
28
|
-
File.exists?(File.join(path, "spec/spec_helper.rb")) ||
|
29
|
-
File.directory?(File.join(path, "features/step_definitions"))
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|