ore 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.8.1 / 2011-07-11
2
+
3
+ * Generated `.gemspec` file:
4
+ * Fixed a redundancy.
5
+ * Load the `version.rb` file, after populating `$LOAD_PATH`.
6
+ * Generated `Rakefile`:
7
+ * Use `warn` instead of `STDERR.puts`.
8
+ * Losen generated `yard` dependency to `~> 0.7`.
9
+
1
10
  ### 0.8.0 / 2011-06-18
2
11
 
3
12
  * Added the `markup`, `date`, `year`, `month` and `day` keywords to
data/README.md CHANGED
@@ -16,7 +16,9 @@ templates to be installed from Git repositories.
16
16
 
17
17
  * Stores project metadata in **one YAML file** (`gemspec.yml`).
18
18
  * Generates a **pure Ruby** `.gemspec` supporting:
19
- * Git
19
+ * [Git](http://git-scm.com/)
20
+ * [Mercurial (Hg)](http://mercurial.selenic.com/)
21
+ * [SubVersion (SVN)](http://subversion.tigris.org/)
20
22
  * `gemspec.yml`
21
23
  * `VERSION` or `version.rb` files
22
24
  * Provides many builtin templates:
@@ -47,7 +49,7 @@ templates to be installed from Git repositories.
47
49
  The `gemspec.yml` file used to build Ore:
48
50
 
49
51
  name: ore
50
- version: 0.8.0
52
+ version: 0.8.1
51
53
  summary: Mine raw RubyGems from YAML.
52
54
  description:
53
55
  Ore is a simple RubyGem building solution. Ore handles the
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
data/bin/mine CHANGED
@@ -5,7 +5,7 @@ require 'rubygems'
5
5
  begin
6
6
  require 'ore/generator'
7
7
  rescue LoadError => e
8
- STDERR.puts 'Could not load "ore/generator"'
8
+ warn 'Could not load "ore/generator"'
9
9
  exit -1
10
10
  end
11
11
 
data/bin/ore CHANGED
@@ -5,7 +5,7 @@ require 'rubygems'
5
5
  begin
6
6
  require 'ore/cli'
7
7
  rescue LoadError => e
8
- STDERR.puts 'Could not load "ore/cli"'
8
+ warn 'Could not load "ore/cli"'
9
9
  exit -1
10
10
  end
11
11
 
@@ -6,16 +6,16 @@ require 'rubygems'
6
6
  begin
7
7
  require 'bundler'
8
8
  rescue LoadError => e
9
- STDERR.puts e.message
10
- STDERR.puts "Run `gem install bundler` to install Bundler."
9
+ warn e.message
10
+ warn "Run `gem install bundler` to install Bundler."
11
11
  exit e.status_code
12
12
  end
13
13
 
14
14
  begin
15
15
  Bundler.setup(:development)
16
16
  rescue Bundler::BundlerError => e
17
- STDERR.puts e.message
18
- STDERR.puts "Run `bundle install` to install missing gems."
17
+ warn e.message
18
+ warn "Run `bundle install` to install missing gems."
19
19
  exit e.status_code
20
20
  end
21
21
 
@@ -3,6 +3,8 @@
3
3
  require 'yaml'
4
4
 
5
5
  Gem::Specification.new do |gemspec|
6
+ root = File.dirname(__FILE__)
7
+ lib_dir = File.join(root,'lib')
6
8
  files = if File.directory?('.git')
7
9
  `git ls-files`.split($/)
8
10
  elsif File.directory?('.hg')
@@ -23,12 +25,12 @@ Gem::Specification.new do |gemspec|
23
25
  }
24
26
 
25
27
  version = {
26
- :file => 'lib/<%= @namespace_dir %>/version.rb',
28
+ :file => '<%= @namespace_dir %>/version',
27
29
  :constant => '<%= @namespace %>::VERSION'
28
30
  }
29
31
 
30
32
  defaults = {
31
- 'name' => File.basename(File.dirname(__FILE__)),
33
+ 'name' => File.basename(root),
32
34
  'files' => files,
33
35
  'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
34
36
  'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
@@ -37,11 +39,13 @@ Gem::Specification.new do |gemspec|
37
39
 
38
40
  metadata = defaults.merge(YAML.load_file('gemspec.yml'))
39
41
 
40
- gemspec.name = metadata.fetch('name',defaults[:name])
42
+ gemspec.name = metadata['name']
41
43
  gemspec.version = if metadata['version']
42
44
  metadata['version']
43
- elsif File.file?(version[:file])
44
- require File.join('.',version[:file])
45
+ else
46
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
47
+
48
+ require version[:file]
45
49
  eval(version[:constant])
46
50
  end
47
51
 
@@ -9,8 +9,8 @@ if File.directory?(File.join(root_dir,'.git'))
9
9
  begin
10
10
  Bundler.setup(:default)
11
11
  rescue Bundler::BundlerError => e
12
- STDERR.puts e.message
13
- STDERR.puts "Run `bundle install` to install missing gems"
12
+ warn e.message
13
+ warn "Run `bundle install` to install missing gems"
14
14
  exit e.status_code
15
15
  end
16
16
  end
@@ -7,8 +7,8 @@ begin
7
7
  gem 'ore', '<%= @ore_core_dependency %>'
8
8
  require 'ore/specification'
9
9
  rescue LoadError
10
- STDERR.puts e.message
11
- STDERR.puts "Run `gem install ore` to install Ore."
10
+ warn e.message
11
+ warn "Run `gem install ore` to install Ore."
12
12
  end
13
13
 
14
14
  begin
@@ -17,6 +17,6 @@ begin
17
17
 
18
18
  Jeweler::Tasks.new(Ore::Specification.new)
19
19
  rescue LoadError
20
- STDERR.puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
20
+ warn 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
21
21
  end
22
22
  <%- end -%>
@@ -8,7 +8,7 @@ begin
8
8
 
9
9
  Ore::Tasks.new
10
10
  rescue LoadError => e
11
- STDERR.puts e.message
12
- STDERR.puts "Run `gem install ore-tasks` to install 'ore/tasks'."
11
+ warn e.message
12
+ warn "Run `gem install ore-tasks` to install 'ore/tasks'."
13
13
  end
14
14
  <%- end -%>
@@ -4,16 +4,16 @@ require 'rubygems'
4
4
  begin
5
5
  require 'bundler'
6
6
  rescue LoadError => e
7
- STDERR.puts e.message
8
- STDERR.puts "Run `gem install bundler` to install Bundler."
7
+ warn e.message
8
+ warn "Run `gem install bundler` to install Bundler."
9
9
  exit e.status_code
10
10
  end
11
11
 
12
12
  begin
13
13
  Bundler.setup(:default, :development, :test)
14
14
  rescue Bundler::BundlerError => e
15
- STDERR.puts e.message
16
- STDERR.puts "Run `bundle install` to install missing gems."
15
+ warn e.message
16
+ warn "Run `bundle install` to install missing gems."
17
17
  exit e.status_code
18
18
  end
19
19
 
@@ -2,4 +2,4 @@ disable:
2
2
  - rdoc
3
3
 
4
4
  variables:
5
- yard_dependency: ~> 0.7.0
5
+ yard_dependency: ~> 0.7
data/gemspec.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: ore
2
- version: 0.8.0
2
+ version: 0.8.1
3
3
  summary: Mine raw RubyGems from YAML
4
4
  description:
5
5
  Ore is a flexible Ruby project generator. Unlike other Ruby project
data/ore.gemspec CHANGED
@@ -1,15 +1,131 @@
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 '#{__FILE__}' 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
+ root = File.dirname(__FILE__)
7
+ lib_dir = File.join(root,'lib')
8
+ files = if File.directory?('.git')
9
+ `git ls-files`.split($/)
10
+ elsif File.directory?('.hg')
11
+ `hg manifest`.split($/)
12
+ elsif File.directory?('.svn')
13
+ `svn ls -R`.split($/).select { |path| File.file?(path) }
14
+ else
15
+ Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
16
+ end
17
+
18
+ filter_files = lambda { |paths|
19
+ case paths
20
+ when Array
21
+ (files & paths)
22
+ when String
23
+ (files & Dir[paths])
24
+ end
25
+ }
26
+
27
+ version = {
28
+ :file => 'ore/version.rb',
29
+ :constant => 'Ore::VERSION'
30
+ }
31
+
32
+ defaults = {
33
+ 'name' => File.basename(File.dirname(__FILE__)),
34
+ 'files' => files,
35
+ 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
36
+ 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
37
+ 'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
38
+ }
39
+
40
+ metadata = defaults.merge(YAML.load_file('gemspec.yml'))
41
+
42
+ gemspec.name = metadata['name']
43
+ gemspec.version = if metadata['version']
44
+ metadata['version']
45
+ else
46
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
47
+
48
+ require version[:file]
49
+ eval(version[:constant])
50
+ end
51
+
52
+ gemspec.summary = metadata.fetch('summary',metadata['description'])
53
+ gemspec.description = metadata.fetch('description',metadata['summary'])
54
+
55
+ case metadata['license']
56
+ when Array
57
+ gemspec.licenses = metadata['license']
58
+ when String
59
+ gemspec.license = metadata['license']
60
+ end
61
+
62
+ case metadata['authors']
63
+ when Array
64
+ gemspec.authors = metadata['authors']
65
+ when String
66
+ gemspec.author = metadata['authors']
67
+ end
68
+
69
+ gemspec.email = metadata['email']
70
+ gemspec.homepage = metadata['homepage']
71
+
72
+ case metadata['require_paths']
73
+ when Array
74
+ gemspec.require_paths = metadata['require_paths']
75
+ when String
76
+ gemspec.require_path = metadata['require_paths']
77
+ end
78
+
79
+ gemspec.files = filter_files[metadata['files']]
80
+
81
+ gemspec.executables = metadata['executables']
82
+ gemspec.extensions = metadata['extensions']
83
+
84
+ if Gem::VERSION < '1.7.'
85
+ gemspec.default_executable = gemspec.executables.first
86
+ end
87
+
88
+ gemspec.test_files = filter_files[metadata['test_files']]
89
+
90
+ unless gemspec.files.include?('.document')
91
+ gemspec.extra_rdoc_files = metadata['extra_doc_files']
92
+ end
93
+
94
+ gemspec.post_install_message = metadata['post_install_message']
95
+ gemspec.requirements = metadata['requirements']
96
+
97
+ if gemspec.respond_to?(:required_ruby_version=)
98
+ gemspec.required_ruby_version = metadata['required_ruby_version']
99
+ end
100
+
101
+ if gemspec.respond_to?(:required_rubygems_version=)
102
+ gemspec.required_rubygems_version = metadata['required_ruby_version']
103
+ end
104
+
105
+ parse_versions = lambda { |versions|
106
+ case versions
107
+ when Array
108
+ versions.map { |v| v.to_s }
109
+ when String
110
+ versions.split(/,\s*/)
111
+ end
112
+ }
113
+
114
+ if metadata['dependencies']
115
+ metadata['dependencies'].each do |name,versions|
116
+ gemspec.add_dependency(name,parse_versions[versions])
117
+ end
118
+ end
119
+
120
+ if metadata['runtime_dependencies']
121
+ metadata['runtime_dependencies'].each do |name,versions|
122
+ gemspec.add_runtime_dependency(name,parse_versions[versions])
123
+ end
124
+ end
125
+
126
+ if metadata['development_dependencies']
127
+ metadata['development_dependencies'].each do |name,versions|
128
+ gemspec.add_development_dependency(name,parse_versions[versions])
129
+ end
14
130
  end
15
131
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ore
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.0
5
+ version: 0.8.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-18 00:00:00 Z
13
+ date: 2011-07-11 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ore-core