benschwarz-smoke 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/dependencies +1 -1
- data/vendor/dependencies/bin/dep +2 -2
- data/vendor/dependencies/dependencies.gemspec +1 -1
- data/vendor/dependencies/dependencies.gemspec.erb +1 -1
- data/vendor/dependencies/lib/dependencies/dep.rb +17 -1
- data/vendor/dependencies/lib/dependencies.rb +2 -1
- data/vendor/dependencies/test/dependencies_test.rb +22 -1
- metadata +1 -1
data/VERSION.yml
CHANGED
data/dependencies
CHANGED
data/vendor/dependencies/bin/dep
CHANGED
@@ -11,5 +11,5 @@ Gem::Specification.new do |s|
|
|
11
11
|
|
12
12
|
s.files = ["README.markdown", "Rakefile", "bin/dep", "dependencies.gemspec", "lib/dependencies/dep.rb", "lib/dependencies.rb", "test/dependencies_test.rb", "test/foobaz-0.3.gem", "test/vendor/bar/lib", "test/vendor/barz-2.0/lib", "test/vendor/baz-1.0/lib"]
|
13
13
|
|
14
|
-
s.add_dependency("
|
14
|
+
s.add_dependency("thor", "~> 0.11")
|
15
15
|
end
|
@@ -1,4 +1,20 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
1
3
|
class Dep
|
4
|
+
DependenciesFileNotFound = Class.new(StandardError)
|
5
|
+
|
6
|
+
def self.dependencies_file
|
7
|
+
current = Pathname.new(Dir.pwd)
|
8
|
+
|
9
|
+
until current.root?
|
10
|
+
filename = current.join("dependencies")
|
11
|
+
return filename if filename.exist? and filename.file?
|
12
|
+
current = current.parent
|
13
|
+
end
|
14
|
+
|
15
|
+
raise DependenciesFileNotFound
|
16
|
+
end
|
17
|
+
|
2
18
|
class Dependency
|
3
19
|
attr :name
|
4
20
|
attr :version
|
@@ -62,7 +78,7 @@ class Dep
|
|
62
78
|
@missing = []
|
63
79
|
|
64
80
|
dependencies.each_line do |line|
|
65
|
-
next unless line =~ /^([\w\-_]+)
|
81
|
+
next unless line =~ /^([\w\-_]+)\s*([<~=>]* ?[\d\.]+)?\s*(?: \(([\w, ]+)\))?\s*(?: ([a-z]+:\/\/.+?))?\s*$/
|
66
82
|
@dependencies << Dependency.new($1, $2, $3, $4)
|
67
83
|
end
|
68
84
|
end
|
@@ -9,6 +9,8 @@ require "fileutils"
|
|
9
9
|
|
10
10
|
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
11
11
|
|
12
|
+
DEP_BINARY = File.expand_path(File.join(File.dirname(__FILE__), "..", "bin", "dep"))
|
13
|
+
|
12
14
|
class Dep
|
13
15
|
# Override exit to allow the tests to keep running.
|
14
16
|
def exit(*attrs)
|
@@ -104,7 +106,7 @@ class DependenciesTest < Test::Unit::TestCase
|
|
104
106
|
def dep(args = nil)
|
105
107
|
out, err = nil
|
106
108
|
|
107
|
-
Open3.popen3("#{
|
109
|
+
Open3.popen3("#{DEP_BINARY} #{args}") do |stdin, stdout, stderr|
|
108
110
|
out = stdout.read
|
109
111
|
err = stderr.read
|
110
112
|
end
|
@@ -127,10 +129,29 @@ class DependenciesTest < Test::Unit::TestCase
|
|
127
129
|
end
|
128
130
|
end
|
129
131
|
|
132
|
+
test "allow for arbitrary spaces in the declarations" do
|
133
|
+
with_dependencies "foo 1.0 (test)\nbar >= 3.1 (test)\nbaz 2.0 (development)" do
|
134
|
+
out, err = dep "list test"
|
135
|
+
assert_equal "foo 1.0 (test)\nbar >= 3.1 (test)\n", out
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
130
139
|
test "complains when no dependencies file found" do
|
131
140
|
out, err = dep "list"
|
132
141
|
assert_equal "No dependencies file found.\n", err
|
133
142
|
end
|
143
|
+
|
144
|
+
test "search recursively for the dependencies file" do
|
145
|
+
with_dependencies "foo 1.0 (test)\nbar (development)\nbarz 2.0\nbaz 0.1 (test)" do
|
146
|
+
FileUtils.rm_rf("dep-test")
|
147
|
+
FileUtils.mkdir("dep-test")
|
148
|
+
Dir.chdir("dep-test") do
|
149
|
+
out, err = dep "list test"
|
150
|
+
assert_equal "foo 1.0 (test)\nbarz 2.0\nbaz 0.1 (test)\n", out
|
151
|
+
end
|
152
|
+
FileUtils.rm_rf("dep-test")
|
153
|
+
end
|
154
|
+
end
|
134
155
|
end
|
135
156
|
|
136
157
|
context "vendor" do
|