hooker 1.0.0 → 1.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.
data/History.rdoc CHANGED
@@ -1,2 +1,8 @@
1
+ === 1.0.1 (2012-9-12)
2
+ * Ensure Errno::EISDIR when mistaken attempt to load a directory,
3
+ i.e. "./config"
4
+ * Fix shadow warning in tests with 1.9 mode (dev)
5
+ * Upgrade to tarpit ~> 2.0, bundler Gemfile, gemspec (build)
6
+
1
7
  === 1.0.0 (2011-2-6)
2
8
  * Initial release.
data/Manifest.txt CHANGED
@@ -8,3 +8,4 @@ test/alt_entry.rb
8
8
  test/config.rb
9
9
  test/setup.rb
10
10
  test/test_hooker.rb
11
+ test/test_load_dir/placeholder
data/README.rdoc CHANGED
@@ -6,12 +6,9 @@
6
6
 
7
7
  Hooker provides a simple registry of hooks or extension points,
8
8
  enabling decoupled run time configuration in terse but straight ruby
9
- syntax.
10
-
11
- Inspiration includes {Emacs Hook
12
- Functions}[http://www.gnu.org/software/emacs/manual/html_node/emacs/Hooks.html]
13
- (Lisp) and other applications which support configuration
14
- files in ruby.
9
+ syntax. Inspiration includes
10
+ {Emacs Hook Functions}[http://www.gnu.org/software/emacs/manual/html_node/emacs/Hooks.html]
11
+ and other ruby-based configuration files.
15
12
 
16
13
  === Features
17
14
 
@@ -66,7 +63,7 @@ Supports the config:
66
63
 
67
64
  == License
68
65
 
69
- Copyright (c) 2011 David Kellum
66
+ Copyright (c) 2011-2012 David Kellum
70
67
 
71
68
  Licensed under the Apache License, Version 2.0 (the "License"); you
72
69
  may not use this file except in compliance with the License. You
data/Rakefile CHANGED
@@ -1,32 +1,7 @@
1
1
  # -*- ruby -*-
2
2
 
3
- $LOAD_PATH << './lib'
4
-
5
3
  require 'rubygems'
6
- gem 'rjack-tarpit', '~> 1.3.0'
4
+ require 'bundler/setup'
7
5
  require 'rjack-tarpit'
8
6
 
9
- require 'hooker/base'
10
-
11
- t = RJack::TarPit.new( 'hooker', Hooker::VERSION )
12
-
13
- t.specify do |h|
14
- h.developer( 'David Kellum', 'dek-oss@gravitext.com' )
15
- h.testlib = :minitest
16
- h.extra_dev_deps += [ [ 'minitest', '>= 1.7.1', '< 2.1' ] ]
17
- end
18
-
19
- # Version/date consistency checks:
20
-
21
- task :check_history_version do
22
- t.test_line_match( 'History.rdoc', /^==/, / #{ t.version } / )
23
- end
24
- task :check_history_date do
25
- t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
26
- end
27
-
28
- task :gem => [ :check_history_version ]
29
- task :tag => [ :check_history_version, :check_history_date ]
30
- task :push => [ :check_history_version, :check_history_date ]
31
-
32
- t.define_tasks
7
+ RJack::TarPit.new( 'hooker' ).define_tasks
data/lib/hooker/base.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 David Kellum
2
+ # Copyright (c) 2011-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -16,5 +16,5 @@
16
16
 
17
17
  module Hooker
18
18
  # Hooker version
19
- VERSION = '1.0.0'
19
+ VERSION = '1.0.1'
20
20
  end
data/lib/hooker.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 David Kellum
2
+ # Copyright (c) 2011-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -79,7 +79,11 @@ module Hooker
79
79
  # Load the specified file via Kernel.load, with a log message if
80
80
  # set.
81
81
  def load_file( file )
82
- log "Loading file #{file}."
82
+ log "Loading file #{file}"
83
+
84
+ # Workaround for some odd load behavior when not a regular file.
85
+ IO.read( file )
86
+
83
87
  load( file, true ) #wrap in in anonymous module
84
88
  end
85
89
 
data/test/setup.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 David Kellum
2
+ # Copyright (c) 2011-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -16,9 +16,8 @@
16
16
 
17
17
  #### General test setup: LOAD_PATH, logging, console output ####
18
18
 
19
- ldir = File.join( File.dirname( __FILE__ ), "..", "lib" )
20
- $LOAD_PATH.unshift( ldir ) unless $LOAD_PATH.include?( ldir )
21
-
22
19
  require 'rubygems'
20
+ require 'bundler/setup'
21
+
23
22
  require 'minitest/unit'
24
23
  require 'minitest/autorun'
data/test/test_hooker.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env jruby
2
2
  #.hashdot.profile += jruby-shortlived
3
3
  #--
4
- # Copyright (c) 2011 David Kellum
4
+ # Copyright (c) 2011-2012 David Kellum
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you
7
7
  # may not use this file except in compliance with the License. You
@@ -74,8 +74,8 @@ class TestContext < MiniTest::Unit::TestCase
74
74
 
75
75
  def test_apply
76
76
  Hooker.with do |h|
77
- h.add( :test ) { |h| h[ :prop ] = "a" }
78
- h.add( :test ) { |h| h[ :prop ] = "b" }
77
+ h.add( :test ) { |hsh| hsh[ :prop ] = "a" }
78
+ h.add( :test ) { |hsh| hsh[ :prop ] = "b" }
79
79
  end
80
80
 
81
81
  h = Hooker.apply( :test, { :prop => "orig" } )
@@ -141,4 +141,10 @@ class TestContext < MiniTest::Unit::TestCase
141
141
  assert_equal( :returned, Hooker.inject( [ :church, :test ] ) )
142
142
  end
143
143
 
144
+ def test_load_dir_error
145
+ assert_raises( Errno::EISDIR ) do
146
+ Hooker.load_file( File.join( TESTDIR, 'test_load_dir' ) )
147
+ end
148
+ end
149
+
144
150
  end
@@ -0,0 +1,2 @@
1
+ Parent directory is used for testing.
2
+ This is just a placeholder file for that directory.
metadata CHANGED
@@ -1,116 +1,99 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hooker
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 0
9
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.1
10
6
  platform: ruby
11
- authors:
12
- - David Kellum
13
- autorequire:
7
+ authors:
8
+ - David Kellum
9
+ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-02-06 00:00:00 -08:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: minitest
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 7
30
- - 1
31
- version: 1.7.1
32
- - - <
33
- - !ruby/object:Gem::Version
34
- segments:
35
- - 2
36
- - 1
37
- version: "2.1"
38
- type: :development
39
- version_requirements: *id001
40
- - !ruby/object:Gem::Dependency
41
- name: rjack-tarpit
42
- prerelease: false
43
- requirement: &id002 !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- segments:
48
- - 1
49
- - 3
50
- - 0
51
- version: 1.3.0
52
- type: :development
53
- version_requirements: *id002
54
- description: |-
55
- Hooker provides a simple registry of hooks or extension points,
56
- enabling decoupled run time configuration in terse but straight ruby
57
- syntax.
58
-
59
- Inspiration includes {Emacs Hook
60
- Functions}[http://www.gnu.org/software/emacs/manual/html_node/emacs/Hooks.html]
61
- (Lisp) and other applications which support configuration
62
- files in ruby.
63
- email:
64
- - dek-oss@gravitext.com
12
+ date: 2012-09-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: minitest
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '2.3'
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '2.3'
27
+ none: false
28
+ prerelease: false
29
+ type: :development
30
+ - !ruby/object:Gem::Dependency
31
+ name: rjack-tarpit
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ~>
35
+ - !ruby/object:Gem::Version
36
+ version: '2.0'
37
+ none: false
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ version: '2.0'
43
+ none: false
44
+ prerelease: false
45
+ type: :development
46
+ description: Hooker provides a simple registry of hooks or extension points, enabling decoupled run time configuration in terse but straight ruby syntax. Inspiration includes Emacs Hook Functions and other ruby-based configuration files.
47
+ email:
48
+ - dek-oss@gravitext.com
65
49
  executables: []
66
-
67
50
  extensions: []
68
-
69
- extra_rdoc_files:
70
- - Manifest.txt
71
- - History.rdoc
72
- - README.rdoc
73
- files:
74
- - History.rdoc
75
- - Manifest.txt
76
- - README.rdoc
77
- - Rakefile
78
- - lib/hooker/base.rb
79
- - lib/hooker.rb
80
- - test/alt_entry.rb
81
- - test/config.rb
82
- - test/setup.rb
83
- - test/test_hooker.rb
84
- has_rdoc: true
51
+ extra_rdoc_files:
52
+ - History.rdoc
53
+ - README.rdoc
54
+ files:
55
+ - History.rdoc
56
+ - Manifest.txt
57
+ - README.rdoc
58
+ - Rakefile
59
+ - lib/hooker/base.rb
60
+ - lib/hooker.rb
61
+ - test/alt_entry.rb
62
+ - test/config.rb
63
+ - test/setup.rb
64
+ - test/test_hooker.rb
65
+ - test/test_load_dir/placeholder
85
66
  homepage: http://github.com/dekellum/hooker
86
67
  licenses: []
87
-
88
- post_install_message:
89
- rdoc_options:
90
- - --main
91
- - README.rdoc
92
- require_paths:
93
- - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- segments:
99
- - 0
100
- version: "0"
101
- required_rubygems_version: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- segments:
106
- - 0
107
- version: "0"
68
+ post_install_message:
69
+ rdoc_options:
70
+ - --main
71
+ - README.rdoc
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ segments:
80
+ - 0
81
+ hash: 2
82
+ none: false
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ segments:
89
+ - 0
90
+ hash: 2
91
+ none: false
108
92
  requirements: []
109
-
110
- rubyforge_project: hooker
111
- rubygems_version: 1.3.6
112
- signing_key:
93
+ rubyforge_project:
94
+ rubygems_version: 1.8.24
95
+ signing_key:
113
96
  specification_version: 3
114
- summary: Hooker provides a simple registry of hooks or extension points, enabling decoupled run time configuration in terse but straight ruby syntax
115
- test_files:
116
- - test/test_hooker.rb
97
+ summary: Hooker provides a simple registry of hooks or extension points, enabling decoupled run time configuration in terse but straight ruby syntax.
98
+ test_files: []
99
+ ...