open_namespace 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.3.2 / 2011-07-12
2
+
3
+ * Fixed a bug in {OpenNamespace.constant_path} where the argument was
4
+ being modified in-place.
5
+
1
6
  ### 0.3.1 / 2011-03-08
2
7
 
3
8
  * Fixed a typo in {OpenNamespace::ClassMethods#require_file}.
data/README.md CHANGED
@@ -63,7 +63,7 @@ Loading constants from alternate namespace root directories:
63
63
 
64
64
  ## Install
65
65
 
66
- $ sudo gem install open_namespace
66
+ $ gem install open_namespace
67
67
 
68
68
  ## License
69
69
 
data/Rakefile CHANGED
@@ -7,8 +7,8 @@ begin
7
7
 
8
8
  Ore::Tasks.new
9
9
  rescue LoadError => e
10
- STDERR.puts e.message
11
- STDERR.puts "Run `gem install ore-tasks` to install 'ore/tasks'."
10
+ warn e.message
11
+ warn "Run `gem install ore-tasks` to install 'ore/tasks'."
12
12
  end
13
13
 
14
14
  begin
@@ -25,7 +25,7 @@ task :test => :spec
25
25
  task :default => :spec
26
26
 
27
27
  begin
28
- gem 'yard', '~> 0.6.0'
28
+ gem 'yard', '~> 0.7.0'
29
29
  require 'yard'
30
30
 
31
31
  YARD::Rake::YardocTask.new
data/gemspec.yml CHANGED
@@ -13,4 +13,4 @@ has_yard: true
13
13
  development_dependencies:
14
14
  ore-tasks: ~> 0.4
15
15
  rspec: ~> 2.4
16
- yard: ~> 0.6.0
16
+ yard: ~> 0.7.0
@@ -17,7 +17,7 @@ module OpenNamespace
17
17
  # @since 0.3.0
18
18
  #
19
19
  def OpenNamespace.constant_path(name)
20
- path = name.to_s
20
+ path = name.to_s.dup
21
21
 
22
22
  # back-ported from extlib's String#to_const_path
23
23
  path.gsub!(/::/,'/')
@@ -27,8 +27,8 @@ module OpenNamespace
27
27
  path.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
28
28
  path.gsub!(/([a-z])([A-Z])/, '\1_\2')
29
29
  end
30
- path.downcase!
31
30
 
31
+ path.downcase!
32
32
  return path
33
33
  end
34
34
  end
@@ -1,4 +1,4 @@
1
1
  module OpenNamespace
2
2
  # open_namespace version
3
- VERSION = '0.3.1'
3
+ VERSION = '0.3.2'
4
4
  end
@@ -1,15 +1,127 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- begin
4
- Ore::Specification.new do |gemspec|
5
- # custom logic here
6
- end
7
- rescue NameError
8
- begin
9
- require 'ore/specification'
10
- retry
11
- rescue LoadError
12
- STDERR.puts "The 'open_namespace.gemspec' file requires Ore."
13
- STDERR.puts "Run `gem install ore-core` to install Ore."
1
+ # encoding: utf-8
2
+
3
+ require 'yaml'
4
+
5
+ Gem::Specification.new do |gemspec|
6
+ files = if File.directory?('.git')
7
+ `git ls-files`.split($/)
8
+ elsif File.directory?('.hg')
9
+ `hg manifest`.split($/)
10
+ elsif File.directory?('.svn')
11
+ `svn ls -R`.split($/).select { |path| File.file?(path) }
12
+ else
13
+ Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
14
+ end
15
+
16
+ filter_files = lambda { |paths|
17
+ case paths
18
+ when Array
19
+ (files & paths)
20
+ when String
21
+ (files & Dir[paths])
22
+ end
23
+ }
24
+
25
+ version = {
26
+ :file => 'lib/open_namespace/version.rb',
27
+ :constant => 'OpenNamespace::VERSION'
28
+ }
29
+
30
+ defaults = {
31
+ 'name' => File.basename(File.dirname(__FILE__)),
32
+ 'files' => files,
33
+ 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
34
+ 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
35
+ 'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
36
+ }
37
+
38
+ metadata = defaults.merge(YAML.load_file('gemspec.yml'))
39
+
40
+ gemspec.name = metadata['name']
41
+ gemspec.version = if metadata['version']
42
+ metadata['version']
43
+ elsif File.file?(version[:file])
44
+ require File.join('.',version[:file])
45
+ eval(version[:constant])
46
+ end
47
+
48
+ gemspec.summary = metadata.fetch('summary',metadata['description'])
49
+ gemspec.description = metadata.fetch('description',metadata['summary'])
50
+
51
+ case metadata['license']
52
+ when Array
53
+ gemspec.licenses = metadata['license']
54
+ when String
55
+ gemspec.license = metadata['license']
56
+ end
57
+
58
+ case metadata['authors']
59
+ when Array
60
+ gemspec.authors = metadata['authors']
61
+ when String
62
+ gemspec.author = metadata['authors']
63
+ end
64
+
65
+ gemspec.email = metadata['email']
66
+ gemspec.homepage = metadata['homepage']
67
+
68
+ case metadata['require_paths']
69
+ when Array
70
+ gemspec.require_paths = metadata['require_paths']
71
+ when String
72
+ gemspec.require_path = metadata['require_paths']
73
+ end
74
+
75
+ gemspec.files = filter_files[metadata['files']]
76
+
77
+ gemspec.executables = metadata['executables']
78
+ gemspec.extensions = metadata['extensions']
79
+
80
+ if Gem::VERSION < '1.7.'
81
+ gemspec.default_executable = gemspec.executables.first
82
+ end
83
+
84
+ gemspec.test_files = filter_files[metadata['test_files']]
85
+
86
+ unless gemspec.files.include?('.document')
87
+ gemspec.extra_rdoc_files = metadata['extra_doc_files']
88
+ end
89
+
90
+ gemspec.post_install_message = metadata['post_install_message']
91
+ gemspec.requirements = metadata['requirements']
92
+
93
+ if gemspec.respond_to?(:required_ruby_version=)
94
+ gemspec.required_ruby_version = metadata['required_ruby_version']
95
+ end
96
+
97
+ if gemspec.respond_to?(:required_rubygems_version=)
98
+ gemspec.required_rubygems_version = metadata['required_ruby_version']
99
+ end
100
+
101
+ parse_versions = lambda { |versions|
102
+ case versions
103
+ when Array
104
+ versions.map { |v| v.to_s }
105
+ when String
106
+ versions.split(/,\s*/)
107
+ end
108
+ }
109
+
110
+ if metadata['dependencies']
111
+ metadata['dependencies'].each do |name,versions|
112
+ gemspec.add_dependency(name,parse_versions[versions])
113
+ end
114
+ end
115
+
116
+ if metadata['runtime_dependencies']
117
+ metadata['runtime_dependencies'].each do |name,versions|
118
+ gemspec.add_runtime_dependency(name,parse_versions[versions])
119
+ end
120
+ end
121
+
122
+ if metadata['development_dependencies']
123
+ metadata['development_dependencies'].each do |name,versions|
124
+ gemspec.add_development_dependency(name,parse_versions[versions])
125
+ end
14
126
  end
15
127
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: open_namespace
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.1
5
+ version: 0.3.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-08 00:00:00 -08:00
14
- default_executable:
13
+ date: 2011-07-12 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: ore-tasks
@@ -43,7 +42,7 @@ dependencies:
43
42
  requirements:
44
43
  - - ~>
45
44
  - !ruby/object:Gem::Version
46
- version: 0.6.0
45
+ version: 0.7.0
47
46
  type: :development
48
47
  version_requirements: *id003
49
48
  description: OpenNamespace allows namespaces to require and find classes and modules from other RubyGems.
@@ -83,7 +82,6 @@ files:
83
82
  - spec/classes/simple_namespace/sub/constant_four.rb
84
83
  - spec/open_namespace_spec.rb
85
84
  - spec/spec_helper.rb
86
- has_rdoc: yard
87
85
  homepage: http://github.com/postmodern/open_namespace
88
86
  licenses:
89
87
  - MIT
@@ -107,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
105
  requirements: []
108
106
 
109
107
  rubyforge_project: open_namespace
110
- rubygems_version: 1.6.1
108
+ rubygems_version: 1.8.5
111
109
  signing_key:
112
110
  specification_version: 3
113
111
  summary: Allows namespaces to load constants on-demand