dirge 0.0.1

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.
Files changed (5) hide show
  1. data/README.rdoc +16 -0
  2. data/Rakefile +14 -0
  3. data/VERSION +1 -0
  4. data/lib/dirge.rb +19 -0
  5. metadata +58 -0
@@ -0,0 +1,16 @@
1
+ =Dirge
2
+
3
+ ==Usage
4
+
5
+ require 'dirge'
6
+ require_relative '../to_my_file'
7
+
8
+ annnd.
9
+
10
+ class MyAwesomeClass
11
+ autoload_relative :MyConstant, 'my_awesome_class/my_constant'
12
+ end
13
+
14
+ All of this is powered by the new function:
15
+
16
+ __DIR__
@@ -0,0 +1,14 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |s|
4
+ s.name = "dirge"
5
+ s.description = s.summary = "Relative require, relative autoload and __DIR__"
6
+ s.email = "joshbuddy@gmail.com"
7
+ s.homepage = "http://github.com/joshbuddy/dirge"
8
+ s.authors = ["Joshua Hull"]
9
+ s.files = FileList["[A-Z]*", "{lib}/**/*"]
10
+ end
11
+ Jeweler::GemcutterTasks.new
12
+ rescue LoadError
13
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
14
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,19 @@
1
+ module Kernel
2
+ def __DIR__(called_from = nil)
3
+ called_from ||= caller.first
4
+ caller_path = called_from[/(.*?(?=:\d))/, 1]
5
+ caller_path = '.' if caller_path == ''
6
+ File.dirname(caller_path)
7
+ end
8
+
9
+ def require_relative(path)
10
+ require File.join(__DIR__(caller.first), path)
11
+ end
12
+
13
+ end
14
+
15
+ class Module
16
+ def self.autoload_relative(name, filename)
17
+ autoload name, File.join(__DIR__(caller.first), filename)
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dirge
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joshua Hull
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-20 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Relative require, relative autoload and __DIR__
17
+ email: joshbuddy@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - README.rdoc
26
+ - Rakefile
27
+ - VERSION
28
+ - lib/dirge.rb
29
+ has_rdoc: true
30
+ homepage: http://github.com/joshbuddy/dirge
31
+ licenses: []
32
+
33
+ post_install_message:
34
+ rdoc_options:
35
+ - --charset=UTF-8
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: "0"
43
+ version:
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ requirements: []
51
+
52
+ rubyforge_project:
53
+ rubygems_version: 1.3.5
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: Relative require, relative autoload and __DIR__
57
+ test_files: []
58
+