need 1.0.0

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.
@@ -0,0 +1,5 @@
1
+ === 1.0.0 / 2008-02-07
2
+
3
+ * 1 major enhancement
4
+ * need can require files relative to the file in which you are calling need.
5
+
@@ -0,0 +1,6 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/need.rb
6
+ test/test_need.rb
@@ -0,0 +1,55 @@
1
+ = need
2
+
3
+ * http://need.rubyforge.org
4
+
5
+ == DESCRIPTION:
6
+
7
+ Need makes ruby relative requires just work. Simply need a file with a relative path
8
+ and the file will always be required correctly, regardless of what file your application is
9
+ being launched through. Typically, ruby projects would unshift lib onto $PATH or use the
10
+ File.dirname(__FILE__) trick. Using need means you don't have to worry about either of these.
11
+
12
+ Assume you have two files, one directly in lib and the other in lib/extensions. Let's assume that file_a in lib requires file_b, in lib/extensions. Previously, you would doing some crazy load path unshifting or use the __FILE__ trick to make these requires flexible enough to work when your app is being accessed by rake, through a test suite, or required as a gem. Now, just use need.
13
+
14
+ In file_a:
15
+ need{"extensions/file_b"}
16
+
17
+ Note that the block syntax is necessary. Need uses the binding of the block to determine the
18
+ location of your file and correct perform your relative require for you.
19
+
20
+ == FEATURES/PROBLEMS:
21
+
22
+ == SYNOPSIS:
23
+
24
+ need{"relative/path/to/file"}
25
+
26
+ == REQUIREMENTS:
27
+
28
+ == INSTALL:
29
+
30
+ * sudo gem install need
31
+
32
+ == LICENSE:
33
+
34
+ (The MIT License)
35
+
36
+ Copyright (c) 2008 FIX
37
+
38
+ Permission is hereby granted, free of charge, to any person obtaining
39
+ a copy of this software and associated documentation files (the
40
+ 'Software'), to deal in the Software without restriction, including
41
+ without limitation the rights to use, copy, modify, merge, publish,
42
+ distribute, sublicense, and/or sell copies of the Software, and to
43
+ permit persons to whom the Software is furnished to do so, subject to
44
+ the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be
47
+ included in all copies or substantial portions of the Software.
48
+
49
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
50
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
51
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
52
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
53
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
54
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
55
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,18 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/need.rb'
6
+
7
+ Hoe.new('need', Need::VERSION) do |p|
8
+ p.rubyforge_name = 'need'
9
+ p.author = 'Drew Olson'
10
+ p.email = 'olsonas@gmail.com'
11
+ p.summary = 'Need makes relative requries just work'
12
+ p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
13
+ p.url = "http://need.rubyforge.org"
14
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
15
+ p.remote_rdoc_dir = ''
16
+ end
17
+
18
+ # vim: syntax=Ruby
@@ -0,0 +1,13 @@
1
+ module Need
2
+ VERSION = '1.0.0'
3
+
4
+ # need takes a block which should contain a string of the relative path to the file
5
+ # you wish to need.
6
+ def need(&block)
7
+ require File.expand_path(File.dirname(eval("__FILE__",block.binding)) + "/" + block.call)
8
+ end
9
+ end
10
+
11
+ class Object
12
+ include Need
13
+ end
@@ -0,0 +1,9 @@
1
+ require "test/unit"
2
+ require "need"
3
+ need {"test_files/file_a"}
4
+
5
+ class TestNeed < Test::Unit::TestCase
6
+ def test_need
7
+ assert file_b_method?, "file_b was not needed correctly"
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: need
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Drew Olson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-02-08 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.0
23
+ version:
24
+ description: "== DESCRIPTION: Need makes ruby relative requires just work. Simply need a file with a relative path and the file will always be required correctly, regardless of what file your application is being launched through. Typically, ruby projects would unshift lib onto $PATH or use the File.dirname(__FILE__) trick. Using need means you don't have to worry about either of these. Assume you have two files, one directly in lib and the other in lib/extensions. Let's assume that file_a in lib requires file_b, in lib/extensions. Previously, you would doing some crazy load path unshifting or use the __FILE__ trick to make these requires flexible enough to work when your app is being accessed by rake, through a test suite, or required as a gem. Now, just use need. In file_a: need{\"extensions/file_b\"}"
25
+ email: olsonas@gmail.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - History.txt
32
+ - Manifest.txt
33
+ - README.txt
34
+ files:
35
+ - History.txt
36
+ - Manifest.txt
37
+ - README.txt
38
+ - Rakefile
39
+ - lib/need.rb
40
+ - test/test_need.rb
41
+ has_rdoc: true
42
+ homepage: http://need.rubyforge.org
43
+ post_install_message:
44
+ rdoc_options:
45
+ - --main
46
+ - README.txt
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ requirements: []
62
+
63
+ rubyforge_project: need
64
+ rubygems_version: 1.0.1
65
+ signing_key:
66
+ specification_version: 2
67
+ summary: Need makes relative requries just work
68
+ test_files:
69
+ - test/test_need.rb