callsite 0.0.2 → 0.0.3

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.
@@ -18,7 +18,7 @@ Gives back
18
18
 
19
19
  This is also suitable for parsing a backtrace, to get detailed information about it.
20
20
 
21
- There are also five methods which patch existing objects to give you powerful usage of the caller.
21
+ There are also six methods which patch existing objects to give you powerful usage of the caller.
22
22
 
23
23
  === Callsite.activate_string_methods
24
24
 
@@ -46,8 +46,8 @@ In this case, lib/whatever will be treated as a relative path from the definitio
46
46
 
47
47
  === Callsite.activate_kernel_dir_methods
48
48
 
49
- This adds the __DIR_REL__ and optionally __DIR__ and require_relative methods to Kernel. __DIR__ or __DIR_REL__ will give you your current directory, much like
50
- __FILE__ gives you the current __FILE__ you're in. +require_relative+ is like +require+ .. only, it's relative.
49
+ This adds the <tt>\_\_DIR_REL__</tt> and optionally <tt>\_\_DIR__</tt> and require_relative methods to Kernel. <tt>\_\_DIR__</tt> or <tt>\_\_DIR_REL__</tt> will give you your current directory, much like
50
+ <tt>\_\_FILE__</tt> gives you the current <tt>\_\_FILE__</tt> you're in. +require_relative+ is like +require+ .. only, it's relative.
51
51
 
52
52
  === Callsite.activate_kernel_require_methods
53
53
 
@@ -57,9 +57,7 @@ This adds a couple of weird methods to Kernel, require_next and require_all. The
57
57
 
58
58
  This adds some super useful methods to $LOAD_PATH. There are find_file (finds a single file on your load path), find_all_files (finds all of em), add_current (adds to the end of the load path your current dir) and add_current! (adds it to the beginning).
59
59
 
60
- == I lied
61
-
62
- I said there were 5, I meant 6. There are 5 lights.
60
+ As well, this gives you add and add!, both of which guard against a path being added twice to the load path. Add appends to the end if it doesn't exist, and add! forces it to the beginning.
63
61
 
64
62
  == This deprecates +dirge+ and +load_path_find+
65
63
 
data/Rakefile CHANGED
@@ -1,18 +1,3 @@
1
- begin
2
- require 'jeweler'
3
- Jeweler::Tasks.new do |s|
4
- s.name = "callsite"
5
- s.description = s.summary = "Caller/backtrace parser with some useful utilities for manipulating the load path, and doing other relative things."
6
- s.email = "joshbuddy@gmail.com"
7
- s.homepage = "http://github.com/joshbuddy/callsite"
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
15
-
16
1
  require 'spec'
17
2
  require 'spec/rake/spectask'
18
3
  task :spec => ['spec:dirge', 'spec:load_path_find']
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.join(File.dirname(__FILE__), 'lib', 'callsite', 'version')
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{callsite}
7
+ s.version = Callsite::VERSION
8
+
9
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.authors = ["Joshua Hull"]
11
+ s.date = %q{2010-07-15}
12
+ s.description = %q{Caller/backtrace parser with some useful utilities for manipulating the load path, and doing other relative things.}
13
+ s.email = %q{joshbuddy@gmail.com}
14
+ s.extra_rdoc_files = [
15
+ "README.rdoc"
16
+ ]
17
+ s.files = `git ls-files`.split("\n")
18
+ s.homepage = %q{http://github.com/joshbuddy/callsite}
19
+ s.rdoc_options = ["--charset=UTF-8"]
20
+ s.require_paths = ["lib"]
21
+ s.rubygems_version = %q{1.3.6}
22
+ s.summary = %q{Caller/backtrace parser with some useful utilities for manipulating the load path, and doing other relative things.}
23
+ s.test_files = `git ls-files`.split("\n").select{|s| s[/^spec/]}
24
+
25
+ if s.respond_to? :specification_version then
26
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
27
+ s.specification_version = 3
28
+
29
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
30
+ else
31
+ end
32
+ else
33
+ end
34
+ end
35
+
@@ -1,5 +1,7 @@
1
1
  $LOAD_PATH << File.dirname(__FILE__)
2
2
 
3
+ require 'callsite/version'
4
+
3
5
  module Callsite
4
6
  UnparsableCallLine = Class.new(RuntimeError)
5
7
  Line = Struct.new(:filename, :line, :method)
@@ -0,0 +1,3 @@
1
+ module Callsite
2
+ VERSION = '0.0.3'.freeze
3
+ end
@@ -17,10 +17,19 @@ $LOAD_PATH.instance_eval do
17
17
  end
18
18
 
19
19
  def add_current
20
- self << __DIR_REL__(caller.first)
20
+ add(__DIR_REL__(caller.first))
21
21
  end
22
22
 
23
23
  def add_current!
24
- self.unshift(__DIR_REL__(caller.first))
24
+ add!(__DIR_REL__(caller.first))
25
+ end
26
+
27
+ def add(path)
28
+ push(path) unless include?(path)
29
+ end
30
+
31
+ def add!(path)
32
+ delete(path)
33
+ unshift(path)
25
34
  end
26
35
  end
File without changes
File without changes
@@ -38,7 +38,7 @@ describe 'load path find' do
38
38
 
39
39
  it "should add the current path" do
40
40
  $LOAD_PATH.add_current
41
- $LOAD_PATH.last.should == __DIR__
41
+ $LOAD_PATH.should include(__DIR__)
42
42
  end
43
43
 
44
44
  it "should add the current path to the start" do
@@ -0,0 +1,7 @@
1
+ --colour
2
+ --format
3
+ specdoc
4
+ --loadby
5
+ mtime
6
+ --reverse
7
+ --backtrace
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callsite
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 2
9
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Joshua Hull
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-20 00:00:00 -04:00
18
+ date: 2010-07-15 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -30,12 +31,24 @@ files:
30
31
  - README.rdoc
31
32
  - Rakefile
32
33
  - VERSION
34
+ - callsite.gemspec
33
35
  - lib/callsite.rb
36
+ - lib/callsite/version.rb
34
37
  - lib/dirge.rb
35
38
  - lib/load_path_find.rb
36
39
  - lib/loaders/kernel_dir.rb
37
40
  - lib/loaders/kernel_require.rb
38
41
  - lib/loaders/load_path.rb
42
+ - spec/data/dir1/file1
43
+ - spec/data/dir1/test.rb
44
+ - spec/data/dir1/test2.rb
45
+ - spec/data/dir2/file1
46
+ - spec/data/dir2/test.rb
47
+ - spec/data/dir2/test2.rb
48
+ - spec/dirge_spec.rb
49
+ - spec/load_path_find_spec.rb
50
+ - spec/spec.opts
51
+ - spec/test:2test/test.rb
39
52
  has_rdoc: true
40
53
  homepage: http://github.com/joshbuddy/callsite
41
54
  licenses: []
@@ -46,31 +59,38 @@ rdoc_options:
46
59
  require_paths:
47
60
  - lib
48
61
  required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
49
63
  requirements:
50
64
  - - ">="
51
65
  - !ruby/object:Gem::Version
66
+ hash: 3
52
67
  segments:
53
68
  - 0
54
69
  version: "0"
55
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
56
72
  requirements:
57
73
  - - ">="
58
74
  - !ruby/object:Gem::Version
75
+ hash: 3
59
76
  segments:
60
77
  - 0
61
78
  version: "0"
62
79
  requirements: []
63
80
 
64
81
  rubyforge_project:
65
- rubygems_version: 1.3.6
82
+ rubygems_version: 1.3.7
66
83
  signing_key:
67
84
  specification_version: 3
68
85
  summary: Caller/backtrace parser with some useful utilities for manipulating the load path, and doing other relative things.
69
86
  test_files:
87
+ - spec/data/dir1/file1
70
88
  - spec/data/dir1/test.rb
71
89
  - spec/data/dir1/test2.rb
90
+ - spec/data/dir2/file1
72
91
  - spec/data/dir2/test.rb
73
92
  - spec/data/dir2/test2.rb
74
93
  - spec/dirge_spec.rb
75
94
  - spec/load_path_find_spec.rb
95
+ - spec/spec.opts
76
96
  - spec/test:2test/test.rb