look 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/README.markdown +91 -0
- data/Rakefile +5 -0
- data/lib/look.rb +11 -0
- data/look.gemspec +10 -0
- data/test/gems/bar-0.0.1/lib/bar.rb +1 -0
- data/test/look_test.rb +45 -0
- data/test/test_helper.rb +3 -0
- data/test/vendor/foo/lib/foo.rb +1 -0
- metadata +76 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2010 Michel Martens
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
Look
|
2
|
+
====
|
3
|
+
|
4
|
+
Add a vendor directory to your load path.
|
5
|
+
|
6
|
+
Description
|
7
|
+
-----------
|
8
|
+
|
9
|
+
If you want to "specify your project's dependencies in a single
|
10
|
+
place", check [Dependencies](http://github.com/djanowski/dependencies)
|
11
|
+
(recommended).
|
12
|
+
|
13
|
+
If you want "a way to express and automatically install your project's
|
14
|
+
Gem dependencies", check [Isolate](http://github.com/jbarnette/isolate).
|
15
|
+
|
16
|
+
If you want "the best way to manage your application's dependencies",
|
17
|
+
check [Bundler](http://github.com/carlhuda/bundler).
|
18
|
+
|
19
|
+
There maybe other means to that same goal. Look's goal is way more
|
20
|
+
modest: it allows you to add to your load path directories that respect
|
21
|
+
the [Ruby Packaging Standard](http://chneukirchen.github.com/rps/).
|
22
|
+
|
23
|
+
Usage
|
24
|
+
-----
|
25
|
+
|
26
|
+
Assuming you have the following project layout:
|
27
|
+
|
28
|
+
$ tree
|
29
|
+
|-- my_project.rb
|
30
|
+
`-- vendor
|
31
|
+
`-- foo-0.0.1
|
32
|
+
`-- lib
|
33
|
+
`-- foo.rb
|
34
|
+
|
35
|
+
You can easily configure your project to require `foo` from
|
36
|
+
`vendor/foo-0.0.1/lib/foo` with this command:
|
37
|
+
|
38
|
+
$ cat my_project.rb
|
39
|
+
|
40
|
+
require "look"
|
41
|
+
|
42
|
+
Look.at File.dirname(__FILE__)
|
43
|
+
|
44
|
+
puts Foo.inspect
|
45
|
+
|
46
|
+
The only argument you need to provide is the directory where you want to
|
47
|
+
search for the vendor directory.
|
48
|
+
|
49
|
+
You can optionally supply a second argument, which is the glob used for
|
50
|
+
adding directories to your load path:
|
51
|
+
|
52
|
+
Look.at File.dirname(__FILE__), "gems/*/lib"
|
53
|
+
|
54
|
+
The second parameter defaults to `vendor/*/lib`. You can run `Look.at`
|
55
|
+
as many times as needed, so you can have both `/vendor` and `/gems` if
|
56
|
+
you want.
|
57
|
+
|
58
|
+
How to put those libraries inside `vendor` is out of the scope of this
|
59
|
+
project. One idea is to use the `gem unpack` command, but you are free
|
60
|
+
to improvise.
|
61
|
+
|
62
|
+
Installation
|
63
|
+
------------
|
64
|
+
|
65
|
+
$ sudo gem install look
|
66
|
+
|
67
|
+
License
|
68
|
+
-------
|
69
|
+
|
70
|
+
Copyright (c) 2010 Michel Martens
|
71
|
+
|
72
|
+
Permission is hereby granted, free of charge, to any person
|
73
|
+
obtaining a copy of this software and associated documentation
|
74
|
+
files (the "Software"), to deal in the Software without
|
75
|
+
restriction, including without limitation the rights to use,
|
76
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
77
|
+
copies of the Software, and to permit persons to whom the
|
78
|
+
Software is furnished to do so, subject to the following
|
79
|
+
conditions:
|
80
|
+
|
81
|
+
The above copyright notice and this permission notice shall be
|
82
|
+
included in all copies or substantial portions of the Software.
|
83
|
+
|
84
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
86
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
87
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
88
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
89
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
90
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
91
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/lib/look.rb
ADDED
data/look.gemspec
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "look"
|
3
|
+
s.version = "0.0.1"
|
4
|
+
s.summary = "Add a vendor directory to your load path."
|
5
|
+
s.description = "Add to your load path directories that respect the Ruby Packaging Standard (http://chneukirchen.github.com/rps/)"
|
6
|
+
s.authors = ["Michel Martens"]
|
7
|
+
s.email = ["michel@soveran.com"]
|
8
|
+
s.homepage = "http://github.com/soveran/look"
|
9
|
+
s.files = ["LICENSE", "README.markdown", "Rakefile", "lib/look.rb", "look.gemspec", "test/gems/bar-0.0.1/lib/bar.rb", "test/look_test.rb", "test/test_helper.rb", "test/vendor/foo/lib/foo.rb"]
|
10
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Bar = "Bar in gems/bar-0.0.1/lib"
|
data/test/look_test.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_helper")
|
2
|
+
require "ruby-debug"
|
3
|
+
|
4
|
+
class TestLook < Test::Unit::TestCase
|
5
|
+
context "loading libraries" do
|
6
|
+
|
7
|
+
should "raise an error if a directory is not provided" do
|
8
|
+
assert_raises ArgumentError do
|
9
|
+
Look.at
|
10
|
+
end
|
11
|
+
|
12
|
+
assert_raises ArgumentError do
|
13
|
+
Look.at "nonexistent_directory"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
should "find the library once Look.at is executed" do
|
18
|
+
assert_raises LoadError do
|
19
|
+
require "foo"
|
20
|
+
end
|
21
|
+
|
22
|
+
Look.at File.dirname(__FILE__)
|
23
|
+
|
24
|
+
assert_nothing_raised do
|
25
|
+
require "foo"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
should "load the file in vendor" do
|
30
|
+
Look.at File.dirname(__FILE__)
|
31
|
+
|
32
|
+
require "foo"
|
33
|
+
|
34
|
+
assert_equal "Foo in vendor/foo/lib", Foo
|
35
|
+
end
|
36
|
+
|
37
|
+
should "accept a custom glob" do
|
38
|
+
Look.at File.dirname(__FILE__), "gems/*/lib"
|
39
|
+
|
40
|
+
require "bar"
|
41
|
+
|
42
|
+
assert_equal "Bar in gems/bar-0.0.1/lib", Bar
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Foo = "Foo in vendor/foo/lib"
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: look
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Michel Martens
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-05-19 00:00:00 -03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Add to your load path directories that respect the Ruby Packaging Standard (http://chneukirchen.github.com/rps/)
|
23
|
+
email:
|
24
|
+
- michel@soveran.com
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- LICENSE
|
33
|
+
- README.markdown
|
34
|
+
- Rakefile
|
35
|
+
- lib/look.rb
|
36
|
+
- look.gemspec
|
37
|
+
- test/gems/bar-0.0.1/lib/bar.rb
|
38
|
+
- test/look_test.rb
|
39
|
+
- test/test_helper.rb
|
40
|
+
- test/vendor/foo/lib/foo.rb
|
41
|
+
has_rdoc: true
|
42
|
+
homepage: http://github.com/soveran/look
|
43
|
+
licenses: []
|
44
|
+
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.3.7
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: Add a vendor directory to your load path.
|
75
|
+
test_files: []
|
76
|
+
|