gemdev 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2006-2007, Regents of the University of Colorado.
2
+ Developer:: Simon Chiang, Biomolecular Structure Program
3
+ Support:: UCHSC School of Medicine Deans Academic Enrichment Fund
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
6
+ software and associated documentation files (the "Software"), to deal in the Software
7
+ without restriction, including without limitation the rights to use, copy, modify, merge,
8
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
9
+ to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or
12
+ substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21
+ OTHER DEALINGS IN THE SOFTWARE.
data/README CHANGED
@@ -0,0 +1,100 @@
1
+ # = GemDev
2
+ # Utilities simplifying gem development.
3
+ #
4
+ # == Introduction
5
+ # RubyGems is an amazing packaging system, hands down. GemDev
6
+ # provides some extensions to make it easy to develop multiple,
7
+ # interrelated gems at once by allowing you to specify your gem
8
+ # development folders in the RubyGems configuration file (.gemrc). Additionally, test
9
+ # extensions are provided to permit test subsetting.
10
+ #
11
+ # Copyright (c) 2006-2007, Regents of the University of Colorado.
12
+ # Developer:: Simon Chiang, Biomolecular Structure Program
13
+ # Support:: UCHSC School of Medicine Deans Academic Enrichment Fund
14
+ # Licence:: MIT-Style
15
+ #
16
+ # == GemDev Usage
17
+ # For specifying development folders, add one big glob or a list of filepaths
18
+ # to the .gemrc file, keyed by 'development'. GemDev will look for 'Rakefile'
19
+ # in every folder specified and read and instantiate each Gem::Specification
20
+ # included therein. As a result, you can require the gems as if they were
21
+ # already installed.
22
+ #
23
+ # Say you were developing 'ioutils' in folder '/path/to/ioutils' with the sample
24
+ # Rakefile (see below) at '/path/to/ioutils/Rakefile'.
25
+ #
26
+ # To specify this file add to '.gemrc':
27
+ #
28
+ # development: /path/to/{ioutils, another_gem}
29
+ #
30
+ # or:
31
+ #
32
+ # development:
33
+ # - /path/to/ioutils
34
+ # - /path/to/another_gem
35
+ #
36
+ # In your scripts:
37
+ #
38
+ # require 'gemdev'
39
+ # require 'ioutils' # => now works
40
+ #
41
+ # == Subsets Usage
42
+ # Subsets are provided to make unit testing more convenient.
43
+ #
44
+ # Example:
45
+ #
46
+ # require 'gemdev'
47
+ # require 'test/unit/subsets'
48
+ #
49
+ # class YourTest < Test::Unit::TestCase
50
+ # # only runs if ENV['benchmark']=true
51
+ # def test_benchmark_some_method
52
+ # benchmark_test do |x|
53
+ # x.report("speed") {...}
54
+ # end
55
+ # end
56
+ # end
57
+ #
58
+ # == Sample Rakefile
59
+ #
60
+ # require 'rake'
61
+ # require 'rake/testtask'
62
+ # require 'rake/rdoctask'
63
+ # require 'rake/gempackagetask'
64
+ #
65
+ # # tasks
66
+ # desc 'Default: Run tests.'
67
+ # task :default => :test
68
+ #
69
+ # desc 'Run tests.'
70
+ # Rake::TestTask.new(:test) do |t|
71
+ # t.libs << 'lib'
72
+ # t.pattern = File.join('test', ENV['subset'] || '', ENV['pattern'] || '**/*_test.rb')
73
+ # t.verbose = true
74
+ # end
75
+ #
76
+ # #
77
+ # # Gem specification
78
+ # #
79
+ # Gem::manage_gems
80
+ # spec = Gem::Specification.new do |s|
81
+ # s.name = "ioutils"
82
+ # s.version = "0.1.0"
83
+ # s.author = "Simon Chiang"
84
+ # s.email = "simon.chiang@uchsc.edu"
85
+ # s.homepage = "http://rubyforge.org/projects/ioutils/"
86
+ # s.platform = Gem::Platform::RUBY
87
+ # s.files = Dir.glob("{test,lib,docs}/**/*")
88
+ # s.require_path = "lib"
89
+ # s.autorequire = "ioutils"
90
+ # s.test_file = "test/ioutils_test_suite.rb"
91
+ #
92
+ # s.has_rdoc = true
93
+ # s.extra_rdoc_files = ["README"]
94
+ # s.add_dependency("gemdev", ">= 0.1.1")
95
+ # s.add_dependency("activesupport", ">= 1.4.2")
96
+ # end
97
+ #
98
+ # Rake::GemPackageTask.new(spec) do |pkg|
99
+ # pkg.need_tar = true
100
+ # end
@@ -15,9 +15,7 @@ module Gem
15
15
  def full_gem_path=(input)
16
16
  @full_gem_path = input
17
17
  end
18
- end
19
18
 
20
- class Specification
21
19
  def self.load_devel(path)
22
20
  gemspecs = []
23
21
  fail "NESTED Specification.load calls not allowed!" if @@gather
@@ -43,10 +41,18 @@ module Gem
43
41
  @@gather = nil
44
42
  end
45
43
  end
46
- end
47
44
 
48
- # reset the gem path searcher
49
- @gempath_searcher = nil
45
+ class GemPathSearcher
46
+ def refresh!
47
+ # cut and paste of the initialize routine
48
+ @gemspecs = init_gemspecs
49
+ @lib_dirs = {}
50
+ @gemspecs.each do |spec|
51
+ @lib_dirs[spec.object_id] = lib_dirs(spec)
52
+ end
53
+ end
54
+ end
55
+ end
50
56
 
51
57
  if File.exists?(Gem.config_file)
52
58
  config = YAML.load_file(Gem.config_file)
@@ -64,4 +70,6 @@ if File.exists?(Gem.config_file)
64
70
  Gem.source_index.add_spec(spec)
65
71
  end
66
72
  end
67
- end
73
+ end
74
+
75
+ Gem.searcher.refresh!
@@ -9,6 +9,17 @@ require 'pp'
9
9
  class Test::Unit::TestCase
10
10
 
11
11
  class << self
12
+ # Access to the case-insensitive ENV variables
13
+ def env(type, reset=false)
14
+ if @env_vars.nil? || reset
15
+ @env_vars = {}
16
+ ENV.each_pair do |key, value|
17
+ @env_vars[key.downcase] = value
18
+ end
19
+ end
20
+ @env_vars[type.downcase]
21
+ end
22
+
12
23
  # Causes a whole test suite to require one of the listed platforms
13
24
  # in order to run. See match_platform? for details.
14
25
  #
@@ -187,9 +198,14 @@ class Test::Unit::TestCase
187
198
  print ' '
188
199
  end
189
200
 
190
- # Returns true if the ENV[var] is set and matches /^true%/i
201
+ # Access to the case-insensitive ENV variables
202
+ def env(type)
203
+ self.class.env(type)
204
+ end
205
+
206
+ # Returns true if the env_var(var) is set and matches /^true%/i
191
207
  def env_true?(var)
192
- ENV[var] && ENV[var] =~ /^true$/i
208
+ env(var) && env(var) =~ /^true$/i
193
209
  end
194
210
 
195
211
  # Returns true if the subset type or 'ALL' is specified in ENV
@@ -197,13 +213,13 @@ class Test::Unit::TestCase
197
213
  env_true?(type) || env_true?("ALL") ? true : false
198
214
  end
199
215
 
200
- # Returns true if the pretty-print string for obj matches the regexp specified in ENV[type].
216
+ # Returns true if the pretty-print string for obj matches the regexp specified in env_var(type).
201
217
  # Returns the default value if 'ALL' is specified in ENV or type is not specified in ENV.
202
218
  def match_regexp?(type, obj, default=true)
203
219
  return true if env_true?("ALL")
204
- return default unless ENV[type]
220
+ return default unless env(type)
205
221
 
206
- spp(obj) =~ Regexp.new(ENV[type]) ? true : false
222
+ spp(obj) =~ Regexp.new(env(type)) ? true : false
207
223
  end
208
224
 
209
225
  # Calling method iterates over the call stack, and returns the first calling
@@ -227,7 +243,7 @@ class Test::Unit::TestCase
227
243
  def subset_test(type, skip=type[0..0].downcase, &block)
228
244
  type = type.upcase
229
245
  type_test = "#{type}_TEST"
230
- if run_subset?(type) || ENV[type_test]
246
+ if run_subset?(type) || env(type_test)
231
247
  if match_regexp?(type_test, calling_method)
232
248
  yield
233
249
  else
@@ -1,3 +1,4 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__), '../lib')
2
2
 
3
+ # gemdev_test excluded because although they work once installed, they fail on gem install -t
3
4
  require File.join(File.dirname(__FILE__), 'subsets_test')
@@ -2,6 +2,11 @@ require File.join(File.dirname(__FILE__), 'gemdev_test_helper.rb')
2
2
  require 'test/unit/subsets'
3
3
 
4
4
  class SubsetsTest < Test::Unit::TestCase
5
+ class << self
6
+ def env(type)
7
+ super(type, true)
8
+ end
9
+ end
5
10
 
6
11
  def setup
7
12
  ENV['ALL'] = nil
@@ -40,7 +45,7 @@ class SubsetsTest < Test::Unit::TestCase
40
45
  assert_equal true, run_subset?('type')
41
46
  end
42
47
 
43
- def test_run_subset_true_if_ENV_ALL_is_true
48
+ def test_run_subset_true_if_ENV_all_is_true
44
49
  ENV['ALL'] = "true"
45
50
  assert_equal true, run_subset?('type')
46
51
  end
@@ -61,7 +66,7 @@ class SubsetsTest < Test::Unit::TestCase
61
66
  end
62
67
  end
63
68
 
64
- def test_match_regexp_returns_true_if_ENV_ALL_true
69
+ def test_match_regexp_returns_true_if_ENV_all_true
65
70
  ENV['ALL'] = "true"
66
71
  assert_equal true, match_regexp?('type', 1, "default")
67
72
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: gemdev
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2007-04-30 00:00:00 -06:00
6
+ version: 0.1.2
7
+ date: 2007-05-08 00:00:00 -06:00
8
8
  summary: Making gem development a bit easier.
9
9
  require_paths:
10
10
  - lib
@@ -49,12 +49,14 @@ files:
49
49
  - lib/test/unit
50
50
  - lib/test/unit/subsets.rb
51
51
  - README
52
+ - MIT-LICENSE
52
53
  test_files:
53
54
  - test/gemdev_test_suite.rb
54
55
  rdoc_options: []
55
56
 
56
57
  extra_rdoc_files:
57
58
  - README
59
+ - MIT-LICENSE
58
60
  executables: []
59
61
 
60
62
  extensions: []