require-me 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +15 -0
- data/lib/require-me.rb +4 -4
- data/spec/require_more_spec.rb +1 -1
- metadata +2 -2
data/README.markdown
CHANGED
@@ -3,6 +3,21 @@
|
|
3
3
|
Includes a DSL for requiring files and folders and some also some static utility functions which can be used in combination.
|
4
4
|
These tools in combination facilitates managing requiring various subfolder structures.
|
5
5
|
|
6
|
+
## Installation ##
|
7
|
+
This gem is also available for installation on gemcutter.
|
8
|
+
|
9
|
+
`$ gem install require-me`
|
10
|
+
|
11
|
+
## Usage ##
|
12
|
+
|
13
|
+
To load the full functionality
|
14
|
+
|
15
|
+
`require 'require-me'`
|
16
|
+
|
17
|
+
To load only the require DSL functionality
|
18
|
+
|
19
|
+
`require 'require-dsl'`
|
20
|
+
|
6
21
|
## Require DSL ##
|
7
22
|
|
8
23
|
The following example code demonstrates how to use the Require DSL
|
data/lib/require-me.rb
CHANGED
@@ -8,14 +8,14 @@ module Require
|
|
8
8
|
attr_accessor :verbose
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.recursive(*names,
|
12
|
-
options = {}
|
11
|
+
def self.recursive(*names, opt, &block)
|
12
|
+
opt.kind_of?(String) ? options = {} : options = opt
|
13
13
|
options[:recursive] = true
|
14
14
|
names.each{|name| folder(name, options) }
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.folders(*names,
|
18
|
-
options = {}
|
17
|
+
def self.folders(*names, opt)
|
18
|
+
opt.kind_of?(String) ? options = {} : options = opt
|
19
19
|
required_files = []
|
20
20
|
names.each do |path|
|
21
21
|
options[:root] = path if is_root?(path, options)
|
data/spec/require_more_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe "static folder functions" do
|
4
4
|
it "show work with here" do
|
5
5
|
Folder.here(__FILE__).require_me '../fixtures/game/game.rb'
|
6
|
-
end
|
6
|
+
end
|
7
7
|
|
8
8
|
it "show work with require_me" do
|
9
9
|
Folder.require_me '../fixtures/game/game.rb'
|