ore 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +17 -0
- data/GemspecYML.md +12 -0
- data/README.md +3 -2
- data/Rakefile +20 -4
- data/data/ore/templates/base/Rakefile.erb +1 -1
- data/data/ore/templates/base/_gemfile.erb +1 -0
- data/data/ore/templates/base/gemspec.yml.erb +4 -2
- data/data/ore/templates/base/template.yml +2 -0
- data/data/ore/templates/bundler/Gemfile.erb +1 -13
- data/data/ore/templates/bundler/_dependencies.erb +1 -1
- data/data/ore/templates/bundler/template.yml +2 -0
- data/data/ore/templates/jeweler_tasks/_dependencies.erb +1 -1
- data/data/ore/templates/jeweler_tasks/_gemfile.erb +1 -0
- data/data/ore/templates/jeweler_tasks/_tasks.erb +8 -3
- data/data/ore/templates/jeweler_tasks/template.yml +2 -0
- data/data/ore/templates/ore_tasks/_dependencies.erb +1 -1
- data/data/ore/templates/ore_tasks/_gemfile.erb +1 -0
- data/data/ore/templates/ore_tasks/_tasks.erb +2 -0
- data/data/ore/templates/ore_tasks/template.yml +2 -0
- data/data/ore/templates/rspec/_dependencies.erb +1 -1
- data/data/ore/templates/rspec/_gemfile.erb +1 -0
- data/data/ore/templates/rspec/_tasks.erb +2 -0
- data/data/ore/templates/rspec/spec/spec_helper.rb.erb +1 -1
- data/data/ore/templates/rspec/template.yml +2 -0
- data/data/ore/templates/yard/_dependencies.erb +1 -1
- data/data/ore/templates/yard/_gemfile.erb +12 -0
- data/data/ore/templates/yard/{_gem.erb → _gemspec.erb} +0 -0
- data/data/ore/templates/yard/_tasks.erb +2 -0
- data/data/ore/templates/yard/template.yml +2 -0
- data/gemspec.yml +2 -2
- data/lib/ore/generator.rb +7 -3
- data/lib/ore/project.rb +16 -0
- data/lib/ore/settings.rb +16 -0
- data/lib/ore/template/directory.rb +46 -1
- data/lib/ore/template/exceptions.rb +1 -0
- data/lib/ore/template/exceptions/invalid_template.rb +9 -0
- data/spec/helpers/projects/ffi-binding/gemspec.yml +2 -0
- data/spec/projects/ffi_binding_project_spec.rb +4 -0
- metadata +20 -7
data/ChangeLog.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
### 0.2.0 / 2010-10-27
|
2
|
+
|
3
|
+
* Added {Ore::Project#requirements}.
|
4
|
+
* Added {Ore::Settings#set_requirements!}.
|
5
|
+
* Added {Ore::Template::InvalidTemplate}.
|
6
|
+
* Added {Ore::Template::Directory#load!}.
|
7
|
+
* Suppress `no rubyforge_project specified` warnings by setting the
|
8
|
+
`rubyforge_project` to the project name in {Ore::Project#to_gemspec}.
|
9
|
+
* Do not add extra dependencies to the `gemspec.yml` file when generating
|
10
|
+
a Bundler enabled project. Extra dependencies will be added to the
|
11
|
+
`Gemfile` and controlled by Bundler.
|
12
|
+
* Allow Ore template directories to contain `template.yml` which may list
|
13
|
+
template variables:
|
14
|
+
|
15
|
+
data:
|
16
|
+
variable: Value
|
17
|
+
|
1
18
|
### 0.1.4 / 2010-10-26
|
2
19
|
|
3
20
|
* Increased documentation coverage.
|
data/GemspecYML.md
CHANGED
@@ -200,6 +200,18 @@ More than one test-file pattern can be supplied:
|
|
200
200
|
If `test_files` is not listed, Ore will default `files` to
|
201
201
|
`test/{**/}test_*.rb` and `spec/{**/}*_spec.rb`.
|
202
202
|
|
203
|
+
## requirements
|
204
|
+
|
205
|
+
The external requirements of the project can be listed like so:
|
206
|
+
|
207
|
+
requirements: libcairo >= 1.8
|
208
|
+
|
209
|
+
Multiple external requirements can also be listed:
|
210
|
+
|
211
|
+
requirements:
|
212
|
+
- libcairo >= 1.8.0
|
213
|
+
- libclutter >= 1.2.0
|
214
|
+
|
203
215
|
## required_ruby_version
|
204
216
|
|
205
217
|
The version of Ruby required by the project can be listed like so:
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
* [Source](http://github.com/ruby-ore/ore)
|
4
4
|
* [Issues](http://github.com/ruby-ore/ore/issues)
|
5
|
+
* [Documentation](http://rubydoc.info/gems/ore/file/README.md)
|
5
6
|
* IRC: irc.freenode.net #ruby-ore
|
6
7
|
* Postmodern (postmodern.mod3 at gmail.com)
|
7
8
|
|
@@ -44,8 +45,8 @@ the developer to keep all of the project information in a single YAML file.
|
|
44
45
|
The `gemspec.yml` file used to build Ore:
|
45
46
|
|
46
47
|
name: ore
|
47
|
-
version: 0.
|
48
|
-
summary:
|
48
|
+
version: 0.2.0
|
49
|
+
summary: Mine raw RubyGems from YAML.
|
49
50
|
description:
|
50
51
|
Ore is a simple RubyGem building solution. Ore handles the
|
51
52
|
creation of Gem::Specification objects as well as building '.gem'
|
data/Rakefile
CHANGED
@@ -1,9 +1,25 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
begin
|
5
|
+
gem 'rspec', '~> 2.0.0'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new
|
9
|
+
rescue LoadError
|
10
|
+
task :spec do
|
11
|
+
abort "Please run `gem install rspec` to install RSpec."
|
12
|
+
end
|
13
|
+
end
|
6
14
|
task :default => :spec
|
7
15
|
|
8
|
-
|
9
|
-
|
16
|
+
begin
|
17
|
+
gem 'yard', '~> 0.6.0'
|
18
|
+
require 'yard'
|
19
|
+
|
20
|
+
YARD::Rake::YardocTask.new
|
21
|
+
rescue LoadError
|
22
|
+
task :yard do
|
23
|
+
abort "Please run `gem install yard` to install YARD."
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'ore', '<%= @ore_dependency %>'
|
@@ -16,8 +16,10 @@ authors: <%= @authors.first %>
|
|
16
16
|
email: <%= @email %>
|
17
17
|
<%- end -%>
|
18
18
|
homepage: <%= @homepage %>
|
19
|
-
<%= includes :
|
19
|
+
<%= includes :gemspec, '' -%>
|
20
20
|
|
21
21
|
development_dependencies:
|
22
|
-
|
22
|
+
<%- unless bundler? -%>
|
23
|
+
ore: <%= @ore_dependency %>
|
24
|
+
<%- end -%>
|
23
25
|
<%= includes :dependencies, '' -%>
|
@@ -4,17 +4,5 @@ gemspec
|
|
4
4
|
|
5
5
|
group :development do
|
6
6
|
gem 'rake', '~> 0.8.7'
|
7
|
-
|
8
|
-
case @markup
|
9
|
-
when :markdown -%>
|
10
|
-
case RUBY_PLATFORM
|
11
|
-
when 'java'
|
12
|
-
gem 'maruku'
|
13
|
-
else
|
14
|
-
gem 'bluecloth', '>= 2.0.0'
|
15
|
-
end
|
16
|
-
<%- when :textile -%>
|
17
|
-
gem 'RedCloth'
|
18
|
-
<%- end
|
19
|
-
end -%>
|
7
|
+
<%= includes :gemfile, '' -%>
|
20
8
|
end
|
@@ -1 +1 @@
|
|
1
|
-
bundler:
|
1
|
+
bundler: <%= @bundler_dependency %>
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'jeweler', '<%= @jeweler_dependency %>'
|
@@ -4,10 +4,15 @@ require 'jeweler'
|
|
4
4
|
Jeweler::Tasks.new(Ore::Specification.new)
|
5
5
|
<%- else -%>
|
6
6
|
begin
|
7
|
-
gem 'ore', '
|
8
|
-
gem 'jeweler', '~> 1.4'
|
9
|
-
|
7
|
+
gem 'ore', '<%= @ore_dependency %>'
|
10
8
|
require 'ore/specification'
|
9
|
+
rescue LoadError
|
10
|
+
STDERR.puts e.message
|
11
|
+
STDERR.puts "Run `gem install ore` to install Ore."
|
12
|
+
end
|
13
|
+
|
14
|
+
begin
|
15
|
+
gem 'jeweler', '<%= @jeweler_dependency %>'
|
11
16
|
require 'jeweler'
|
12
17
|
|
13
18
|
Jeweler::Tasks.new(Ore::Specification.new)
|
@@ -1 +1 @@
|
|
1
|
-
ore-tasks:
|
1
|
+
ore-tasks: <%= @ore_tasks_dependency %>
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'ore-tasks', '<%= @ore_tasks_dependency %>'
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'rspec', '<%= @rspec_dependency %>'
|
@@ -1 +1 @@
|
|
1
|
-
yard:
|
1
|
+
yard: <%= @yard_dependency %>
|
File without changes
|
data/gemspec.yml
CHANGED
data/lib/ore/generator.rb
CHANGED
@@ -145,8 +145,8 @@ module Ore
|
|
145
145
|
exit -1
|
146
146
|
end
|
147
147
|
|
148
|
-
self.source_paths << template_dir
|
149
148
|
@templates << Template::Directory.new(template_dir)
|
149
|
+
self.source_paths << template_dir
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
@@ -154,8 +154,6 @@ module Ore
|
|
154
154
|
# Initializes variables for the templates.
|
155
155
|
#
|
156
156
|
def initialize_variables!
|
157
|
-
@ore_version = '0.1.0'
|
158
|
-
|
159
157
|
@project_dir = File.basename(destination_root)
|
160
158
|
@name = (options.name || @project_dir)
|
161
159
|
|
@@ -193,6 +191,12 @@ module Ore
|
|
193
191
|
@year = @date.year
|
194
192
|
@month = @date.month
|
195
193
|
@day = @date.day
|
194
|
+
|
195
|
+
@templates.each do |template|
|
196
|
+
template.data.each do |name,value|
|
197
|
+
instance_variable_set("@#{name}",value)
|
198
|
+
end
|
199
|
+
end
|
196
200
|
end
|
197
201
|
|
198
202
|
#
|
data/lib/ore/project.rb
CHANGED
@@ -94,6 +94,9 @@ module Ore
|
|
94
94
|
# The test files for the project
|
95
95
|
attr_reader :test_files
|
96
96
|
|
97
|
+
# Any external requirements needed by the project
|
98
|
+
attr_reader :requirements
|
99
|
+
|
97
100
|
# The version of Ruby required by the project
|
98
101
|
attr_reader :required_ruby_version
|
99
102
|
|
@@ -236,6 +239,12 @@ module Ore
|
|
236
239
|
default_test_files!
|
237
240
|
end
|
238
241
|
|
242
|
+
@requirements = []
|
243
|
+
|
244
|
+
if metadata['requirements']
|
245
|
+
set_requirements! metadata['requirements']
|
246
|
+
end
|
247
|
+
|
239
248
|
if metadata['required_ruby_version']
|
240
249
|
set_required_ruby_version! metadata['required_ruby_version']
|
241
250
|
end
|
@@ -404,6 +413,8 @@ module Ore
|
|
404
413
|
gemspec.files = @files
|
405
414
|
gemspec.test_files = @test_files
|
406
415
|
|
416
|
+
gemspec.requirements = @requirements
|
417
|
+
|
407
418
|
if gemspec.respond_to?(:required_ruby_version=)
|
408
419
|
gemspec.required_ruby_version = @required_ruby_version
|
409
420
|
end
|
@@ -436,6 +447,11 @@ module Ore
|
|
436
447
|
end
|
437
448
|
end
|
438
449
|
|
450
|
+
# legacy information
|
451
|
+
if gemspec.respond_to?(:rubyforge_project=)
|
452
|
+
gemspec.rubyforge_project = gemspec.name
|
453
|
+
end
|
454
|
+
|
439
455
|
yield gemspec if block_given?
|
440
456
|
end
|
441
457
|
end
|
data/lib/ore/settings.rb
CHANGED
@@ -158,6 +158,22 @@ module Ore
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
+
#
|
162
|
+
# Sets the external requirements of the project.
|
163
|
+
#
|
164
|
+
# @param [Array, String] requirements
|
165
|
+
# The external requirements.
|
166
|
+
#
|
167
|
+
# @since 0.2.0
|
168
|
+
#
|
169
|
+
def set_requirements!(requirements)
|
170
|
+
if requirements.kind_of?(Array)
|
171
|
+
@requirements += requirements
|
172
|
+
else
|
173
|
+
@requirements << requirements
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
161
177
|
#
|
162
178
|
# Sets the Ruby version required by the project.
|
163
179
|
#
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'ore/template/exceptions/invalid_template'
|
2
|
+
|
3
|
+
require 'yaml'
|
1
4
|
require 'find'
|
2
5
|
|
3
6
|
module Ore
|
@@ -8,8 +11,11 @@ module Ore
|
|
8
11
|
#
|
9
12
|
class Directory
|
10
13
|
|
14
|
+
# The template configuration file
|
15
|
+
@@config_file = 'template.yml'
|
16
|
+
|
11
17
|
# Files or directory names to ignore
|
12
|
-
@@ignore =
|
18
|
+
@@ignore = ['.git', @@config_file]
|
13
19
|
|
14
20
|
# The known markup languages and file extensions
|
15
21
|
@@markups = {
|
@@ -33,6 +39,9 @@ module Ore
|
|
33
39
|
# The include templates in the template directory
|
34
40
|
attr_reader :includes
|
35
41
|
|
42
|
+
# The data to use when rendering the template files
|
43
|
+
attr_reader :data
|
44
|
+
|
36
45
|
#
|
37
46
|
# Initializes a new template directory.
|
38
47
|
#
|
@@ -47,6 +56,9 @@ module Ore
|
|
47
56
|
@templates = {}
|
48
57
|
@includes = Hash.new { |hash,key| hash[key] = {} }
|
49
58
|
|
59
|
+
@data = {}
|
60
|
+
|
61
|
+
load!
|
50
62
|
scan!
|
51
63
|
end
|
52
64
|
|
@@ -105,6 +117,39 @@ module Ore
|
|
105
117
|
|
106
118
|
protected
|
107
119
|
|
120
|
+
#
|
121
|
+
# Loads template configuration information from `template.yml`.
|
122
|
+
#
|
123
|
+
# @raise [InvalidTemplate]
|
124
|
+
# The `template.yml` file did not contain a YAML Hash.
|
125
|
+
#
|
126
|
+
# @since 0.2.0
|
127
|
+
#
|
128
|
+
def load!
|
129
|
+
config_path = File.join(@path,@@config_file)
|
130
|
+
return false unless File.file?(config_path)
|
131
|
+
|
132
|
+
config = YAML.load_file(config_path)
|
133
|
+
|
134
|
+
unless config.kind_of?(Hash)
|
135
|
+
raise(InvalidTemplate,"invalid configuration in #{config_path.dump}")
|
136
|
+
end
|
137
|
+
|
138
|
+
if (data = config['data'])
|
139
|
+
# data must be a Hash
|
140
|
+
unless data.kind_of?(Hash)
|
141
|
+
raise(InvalidTemplate,"data must be a Hash: #{config_path.dump}")
|
142
|
+
end
|
143
|
+
|
144
|
+
# load the template data
|
145
|
+
data.each do |name,value|
|
146
|
+
@data[name.to_sym] = value
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
return true
|
151
|
+
end
|
152
|
+
|
108
153
|
#
|
109
154
|
# Scans the template directory recursively recording the directories,
|
110
155
|
# files and partial templates.
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'ore/template/exceptions/invalid_template'
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Postmodern
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-27 00:00:00 -07:00
|
18
18
|
default_executable: ore
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -96,27 +96,38 @@ files:
|
|
96
96
|
- data/ore/templates/base/README.rdoc.erb
|
97
97
|
- data/ore/templates/base/README.tt.erb
|
98
98
|
- data/ore/templates/base/Rakefile.erb
|
99
|
+
- data/ore/templates/base/_gemfile.erb
|
99
100
|
- data/ore/templates/base/gemspec.yml.erb
|
100
101
|
- data/ore/templates/base/lib/:namespace_dir:.rb.erb
|
101
102
|
- data/ore/templates/base/lib/:namespace_dir:/version.rb.erb
|
103
|
+
- data/ore/templates/base/template.yml
|
102
104
|
- data/ore/templates/bundler/Gemfile.erb
|
103
105
|
- data/ore/templates/bundler/_dependencies.erb
|
106
|
+
- data/ore/templates/bundler/template.yml
|
104
107
|
- data/ore/templates/jeweler_tasks/_dependencies.erb
|
108
|
+
- data/ore/templates/jeweler_tasks/_gemfile.erb
|
105
109
|
- data/ore/templates/jeweler_tasks/_tasks.erb
|
110
|
+
- data/ore/templates/jeweler_tasks/template.yml
|
106
111
|
- data/ore/templates/ore_tasks/_dependencies.erb
|
112
|
+
- data/ore/templates/ore_tasks/_gemfile.erb
|
107
113
|
- data/ore/templates/ore_tasks/_tasks.erb
|
114
|
+
- data/ore/templates/ore_tasks/template.yml
|
108
115
|
- data/ore/templates/rdoc/_tasks.erb
|
109
116
|
- data/ore/templates/rspec/.rspec
|
110
117
|
- data/ore/templates/rspec/_dependencies.erb
|
118
|
+
- data/ore/templates/rspec/_gemfile.erb
|
111
119
|
- data/ore/templates/rspec/_tasks.erb
|
112
120
|
- data/ore/templates/rspec/spec/:namespace_dir:_spec.rb.erb
|
113
121
|
- data/ore/templates/rspec/spec/spec_helper.rb.erb
|
122
|
+
- data/ore/templates/rspec/template.yml
|
114
123
|
- data/ore/templates/test_unit/test/helper.rb.erb
|
115
124
|
- data/ore/templates/test_unit/test/test_:name:.rb.erb
|
116
125
|
- data/ore/templates/yard/.yardopts.erb
|
117
126
|
- data/ore/templates/yard/_dependencies.erb
|
118
|
-
- data/ore/templates/yard/
|
127
|
+
- data/ore/templates/yard/_gemfile.erb
|
128
|
+
- data/ore/templates/yard/_gemspec.erb
|
119
129
|
- data/ore/templates/yard/_tasks.erb
|
130
|
+
- data/ore/templates/yard/template.yml
|
120
131
|
- gemspec.yml
|
121
132
|
- lib/ore.rb
|
122
133
|
- lib/ore/checks.rb
|
@@ -137,6 +148,8 @@ files:
|
|
137
148
|
- lib/ore/specification.rb
|
138
149
|
- lib/ore/template.rb
|
139
150
|
- lib/ore/template/directory.rb
|
151
|
+
- lib/ore/template/exceptions.rb
|
152
|
+
- lib/ore/template/exceptions/invalid_template.rb
|
140
153
|
- lib/ore/template/helpers.rb
|
141
154
|
- lib/ore/template/interpolations.rb
|
142
155
|
- lib/ore/versions.rb
|
@@ -208,11 +221,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
221
|
version: "0"
|
209
222
|
requirements: []
|
210
223
|
|
211
|
-
rubyforge_project:
|
224
|
+
rubyforge_project: ore
|
212
225
|
rubygems_version: 1.3.7
|
213
226
|
signing_key:
|
214
227
|
specification_version: 3
|
215
|
-
summary:
|
228
|
+
summary: Mine raw RubyGems from YAML
|
216
229
|
test_files:
|
217
230
|
- spec/dependency_spec.rb
|
218
231
|
- spec/naming_spec.rb
|