dependencies 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +74 -0
- data/bin/dep +38 -6
- data/dependencies.gemspec +3 -3
- data/lib/dependencies/dep.rb +2 -0
- data/test/dependencies_test.rb +18 -0
- metadata +5 -4
data/README.markdown
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
Dependencies
|
2
|
+
============
|
3
|
+
|
4
|
+
Dependencies manager for RACK enabled applications.
|
5
|
+
|
6
|
+
Description
|
7
|
+
-----------
|
8
|
+
|
9
|
+
Dependencies allows you to declare the list of libraries your application needs,
|
10
|
+
even specifying the version and environment it will be required in, and all with
|
11
|
+
the simple sintax we all have grown to know. It comes with a handy command line
|
12
|
+
tool for inspecting your dependencies.
|
13
|
+
|
14
|
+
Usage
|
15
|
+
-----
|
16
|
+
|
17
|
+
Declare your dependencies in a `dependencies` in the root of your project.
|
18
|
+
This file will look like this:
|
19
|
+
|
20
|
+
rack ~> 1.0
|
21
|
+
sinatra
|
22
|
+
webrat (test) git://github.com/brynary/webrat.git
|
23
|
+
quietbacktrace ~> 0.1
|
24
|
+
contest ~> 0.1 (test)
|
25
|
+
haml ~> 2.0
|
26
|
+
rack-test 0.3 (test)
|
27
|
+
faker ~> 0.3
|
28
|
+
spawn ~> 0.1
|
29
|
+
ohm git://github.com/soveran/ohm.git
|
30
|
+
|
31
|
+
Now you can try the `dep` command line tool to check your dependencies:
|
32
|
+
|
33
|
+
$ dep list
|
34
|
+
|
35
|
+
You can even specify an environment to see if requirements are met:
|
36
|
+
|
37
|
+
$ dep list test
|
38
|
+
|
39
|
+
The list can contain not only gems, but libraries in `vendor` too. Dependencies
|
40
|
+
first checks if a matching library in vendor exists, then tries to find a
|
41
|
+
suitable gem.
|
42
|
+
|
43
|
+
In order to use it in your project, just require the `dependencies` gem.
|
44
|
+
|
45
|
+
Installation
|
46
|
+
------------
|
47
|
+
|
48
|
+
$ sudo gem install dependencies
|
49
|
+
|
50
|
+
License
|
51
|
+
-------
|
52
|
+
|
53
|
+
Copyright (c) 2009 Damian Janowski
|
54
|
+
|
55
|
+
Permission is hereby granted, free of charge, to any person
|
56
|
+
obtaining a copy of this software and associated documentation
|
57
|
+
files (the "Software"), to deal in the Software without
|
58
|
+
restriction, including without limitation the rights to use,
|
59
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
60
|
+
copies of the Software, and to permit persons to whom the
|
61
|
+
Software is furnished to do so, subject to the following
|
62
|
+
conditions:
|
63
|
+
|
64
|
+
The above copyright notice and this permission notice shall be
|
65
|
+
included in all copies or substantial portions of the Software.
|
66
|
+
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
68
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
69
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
70
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
71
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
72
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
73
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
74
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/dep
CHANGED
@@ -5,27 +5,52 @@ require "dependencies/dep"
|
|
5
5
|
require "thor"
|
6
6
|
|
7
7
|
class App < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
desc "list [ENV]", "lists dependencies"
|
8
11
|
def list(env = nil)
|
9
12
|
deps.filter(env).each { |dep| puts dep }
|
10
13
|
deps.require(env)
|
11
14
|
end
|
12
15
|
|
13
|
-
|
16
|
+
desc "vendor", "vendors the dependency to ./vendor"
|
17
|
+
method_options :all => :boolean
|
18
|
+
def vendor(name = nil)
|
19
|
+
name || options[:all] || flunk("No dependency given. Did you mean --all?")
|
20
|
+
|
21
|
+
if name
|
22
|
+
vendor_one(name)
|
23
|
+
else
|
24
|
+
vendor_all
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def vendor_one(name)
|
14
31
|
dep = dependency(name) || flunk("Dependency #{name} not found in dependencies.")
|
15
32
|
dep.url || flunk("Don't know where to vendor #{name} from (no URL given...)")
|
16
33
|
|
17
34
|
FileUtils.mkdir("vendor") unless File.directory?("vendor")
|
18
35
|
|
19
|
-
|
20
|
-
|
21
|
-
|
36
|
+
inside "vendor", :verbose => true do
|
37
|
+
run "git clone #{dep.url} #{dep.name} -q"
|
38
|
+
remove_file File.join(dep.name, ".git")
|
22
39
|
end
|
23
40
|
end
|
24
41
|
|
25
|
-
|
42
|
+
def vendor_all
|
43
|
+
prevent_exit do
|
44
|
+
deps.each do |dep|
|
45
|
+
vendor_one(dep.name)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
26
49
|
|
27
50
|
def deps
|
28
51
|
@deps ||= Dep.new(File.read("dependencies"))
|
52
|
+
rescue Errno::ENOENT
|
53
|
+
flunk "No dependencies file found."
|
29
54
|
end
|
30
55
|
|
31
56
|
def dependency(name)
|
@@ -34,7 +59,14 @@ protected
|
|
34
59
|
|
35
60
|
def flunk(message)
|
36
61
|
$stderr.puts(message)
|
37
|
-
exit 1
|
62
|
+
exit 1 unless @prevent_exit
|
63
|
+
end
|
64
|
+
|
65
|
+
def prevent_exit
|
66
|
+
aux, @prevent_exit = @prevent_exit, false
|
67
|
+
yield
|
68
|
+
ensure
|
69
|
+
@prevent_exit = aux
|
38
70
|
end
|
39
71
|
end
|
40
72
|
|
data/dependencies.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "dependencies"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.4"
|
4
4
|
s.summary = "Specify your project's dependencies in one file."
|
5
5
|
s.authors = ["Damian Janowski", "Michel Martens"]
|
6
6
|
s.email = ["djanowski@dimaion.com", "michel@soveran.com"]
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
|
10
10
|
s.executables << "dep"
|
11
11
|
|
12
|
-
s.files = ["Rakefile", "bin/dep", "dependencies.gemspec", "lib/dependencies/dep.rb", "lib/dependencies.rb", "test/dependencies_test.rb", "test/vendor/bar/lib", "test/vendor/barz-2.0/lib", "test/vendor/baz-1.0/lib"]
|
12
|
+
s.files = ["README.markdown", "Rakefile", "bin/dep", "dependencies.gemspec", "lib/dependencies/dep.rb", "lib/dependencies.rb", "test/dependencies_test.rb", "test/vendor/bar/lib", "test/vendor/barz-2.0/lib", "test/vendor/baz-1.0/lib"]
|
13
13
|
|
14
|
-
s.add_dependency("thor", "~> 0.
|
14
|
+
s.add_dependency("wycats-thor", "~> 0.11")
|
15
15
|
end
|
data/lib/dependencies/dep.rb
CHANGED
data/test/dependencies_test.rb
CHANGED
@@ -107,6 +107,12 @@ class DependenciesTest < Test::Unit::TestCase
|
|
107
107
|
assert_equal "foo 1.0 (test)\nbarz 2.0\nbaz 0.1 (test)\n", out
|
108
108
|
end
|
109
109
|
end
|
110
|
+
|
111
|
+
test "complains when no dependencies file found" do
|
112
|
+
out, err = dep "list"
|
113
|
+
|
114
|
+
assert_equal "No dependencies file found.\n", err
|
115
|
+
end
|
110
116
|
end
|
111
117
|
|
112
118
|
context "vendor" do
|
@@ -139,6 +145,18 @@ class DependenciesTest < Test::Unit::TestCase
|
|
139
145
|
end
|
140
146
|
end
|
141
147
|
|
148
|
+
test "vendors everything with --all" do
|
149
|
+
with_dependencies "foobar 1.0 file://#{@dir}\nbarbar file://#{create_repo "barbar"}" do
|
150
|
+
out, err = dep "vendor --all"
|
151
|
+
|
152
|
+
assert File.exist?("vendor/foobar/lib/foobar.rb")
|
153
|
+
assert !File.exist?("vendor/foobar/.git")
|
154
|
+
|
155
|
+
assert File.exist?("vendor/barbar/lib/barbar.rb")
|
156
|
+
assert !File.exist?("vendor/barbar/.git")
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
142
160
|
teardown do
|
143
161
|
FileUtils.rm_rf(@dir)
|
144
162
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependencies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damian Janowski
|
@@ -10,18 +10,18 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-07-21 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name: thor
|
17
|
+
name: wycats-thor
|
18
18
|
type: :runtime
|
19
19
|
version_requirement:
|
20
20
|
version_requirements: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - ~>
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: "0.
|
24
|
+
version: "0.11"
|
25
25
|
version:
|
26
26
|
description:
|
27
27
|
email:
|
@@ -34,6 +34,7 @@ extensions: []
|
|
34
34
|
extra_rdoc_files: []
|
35
35
|
|
36
36
|
files:
|
37
|
+
- README.markdown
|
37
38
|
- Rakefile
|
38
39
|
- bin/dep
|
39
40
|
- dependencies.gemspec
|