ore 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/ChangeLog.md +70 -7
- data/LICENSE.txt +1 -1
- data/README.md +93 -88
- data/Rakefile +5 -5
- data/data/ore/templates/base/README.md.erb +3 -0
- data/data/ore/templates/base/README.rdoc.erb +3 -0
- data/data/ore/templates/base/README.tt.erb +3 -0
- data/data/ore/templates/base/template.yml +2 -2
- data/data/ore/templates/bin/bin/[name].erb +1 -1
- data/data/ore/templates/bundler/Gemfile.erb +14 -3
- data/data/ore/templates/bundler/template.yml +7 -2
- data/data/ore/templates/bundler_tasks/_tasks.erb +1 -0
- data/data/ore/templates/bundler_tasks/template.yml +6 -0
- data/data/ore/templates/gem_package_task/_tasks.erb +5 -0
- data/data/ore/templates/gem_package_task/template.yml +4 -0
- data/data/ore/templates/gemspec/[name].gemspec.erb +45 -0
- data/data/ore/templates/gemspec/template.yml +2 -0
- data/data/ore/templates/{base → gemspec_yml}/[name].gemspec.erb +36 -55
- data/data/ore/templates/gemspec_yml/gemspec.yml.erb +41 -0
- data/data/ore/templates/gemspec_yml/template.yml +2 -0
- data/data/ore/templates/git/.gitignore.erb +3 -0
- data/data/ore/templates/git/template.yml +2 -0
- data/data/ore/templates/hg/.hgignore.erb +3 -0
- data/data/ore/templates/hg/template.yml +2 -0
- data/data/ore/templates/jeweler_tasks/_tasks.erb +3 -12
- data/data/ore/templates/jeweler_tasks/template.yml +4 -3
- data/data/ore/templates/rdoc/_tasks.erb +1 -1
- data/data/ore/templates/rdoc/template.yml +3 -0
- data/data/ore/templates/rspec/_tasks.erb +1 -1
- data/data/ore/templates/rspec/spec/spec_helper.rb.erb +1 -1
- data/data/ore/templates/rspec/template.yml +2 -2
- data/data/ore/templates/rubygems_tasks/_tasks.erb +14 -0
- data/data/ore/templates/rubygems_tasks/template.yml +7 -0
- data/data/ore/templates/rvmrc/.rvmrc.erb +9 -15
- data/data/ore/templates/yard/_gemfile_development.erb +0 -1
- data/data/ore/templates/yard/_tasks.erb +1 -1
- data/data/ore/templates/yard/template.yml +5 -2
- data/gemspec.yml +5 -7
- data/lib/ore.rb +0 -2
- data/lib/ore/actions.rb +85 -0
- data/lib/ore/cli.rb +2 -32
- data/lib/ore/config.rb +20 -20
- data/lib/ore/generator.rb +101 -203
- data/lib/ore/naming.rb +160 -0
- data/lib/ore/options.rb +67 -0
- data/lib/ore/template.rb +8 -0
- data/lib/ore/template/directory.rb +60 -41
- data/lib/ore/template/helpers.rb +55 -7
- data/lib/ore/template/template.rb +61 -0
- data/ore.gemspec +35 -55
- data/spec/gemspec_examples.rb +33 -0
- data/spec/generator_spec.rb +188 -70
- data/spec/helpers/generator.rb +4 -2
- data/spec/helpers/matchers.rb +33 -0
- data/spec/naming_spec.rb +56 -0
- data/spec/spec_helper.rb +1 -1
- metadata +104 -117
- data/data/ore/templates/base/.gitignore.erb +0 -3
- data/data/ore/templates/base/_gemfile_development.erb +0 -3
- data/data/ore/templates/base/gemspec.yml.erb +0 -30
- data/data/ore/templates/bundler/_development_dependencies.erb +0 -1
- data/data/ore/templates/bundler/_gitignore.erb +0 -2
- data/data/ore/templates/bundler/_tasks.erb +0 -3
- data/data/ore/templates/jeweler_tasks/_development_dependencies.erb +0 -3
- data/data/ore/templates/jeweler_tasks/_gemfile_development.erb +0 -1
- data/data/ore/templates/ore_tasks/_development_dependencies.erb +0 -3
- data/data/ore/templates/ore_tasks/_gemfile_development.erb +0 -1
- data/data/ore/templates/ore_tasks/_tasks.erb +0 -14
- data/data/ore/templates/ore_tasks/template.yml +0 -5
- data/data/ore/templates/rdoc/_gitignore.erb +0 -1
- data/data/ore/templates/rspec/_development_dependencies.erb +0 -3
- data/data/ore/templates/rspec/_gemfile_development.erb +0 -1
- data/data/ore/templates/yard/_development_dependencies.erb +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path('../lib/<%= @namespace_path %>/version', __FILE__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = <%= @name.inspect %>
|
7
|
+
gem.version = <%= @namespace %>::VERSION
|
8
|
+
gem.summary = %q{<%= @summary %>}
|
9
|
+
gem.description = %q{<%= @description %>}
|
10
|
+
gem.license = <%= @license.inspect %>
|
11
|
+
gem.authors = <%= @authors.inspect %>
|
12
|
+
gem.email = [<%= @email.inspect %>]
|
13
|
+
gem.homepage = <%= @homepage.inspect %>
|
14
|
+
|
15
|
+
<%- if git? -%>
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
<%- elsif hg? -%>
|
18
|
+
gem.files = `hg manifest`.split($/)
|
19
|
+
<%- elsif svn? -%>
|
20
|
+
gem.files = `svn ls -R`.split($/).select { |path| File.file?(path) }
|
21
|
+
<%- else -%>
|
22
|
+
gem.files = Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
|
23
|
+
<%- end -%>
|
24
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
25
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
26
|
+
gem.require_paths = ["lib"]
|
27
|
+
<%- unless @dependencies.empty? -%>
|
28
|
+
|
29
|
+
<%- @dependencies.each do |name,version| -%>
|
30
|
+
gem.add_dependency <%= name.inspect %>, <%= version.inspect %>
|
31
|
+
<%- end -%>
|
32
|
+
<%- end -%>
|
33
|
+
|
34
|
+
<%- if bundler? -%>
|
35
|
+
gem.add_development_dependency "bundler", <%= @development_dependencies['bundler'].inspect %>
|
36
|
+
<%- if yard? -%>
|
37
|
+
gem.add_development_dependency "yard", <%= @development_dependencies['yard'].inspect %>
|
38
|
+
<%- end -%>
|
39
|
+
<%- else -%>
|
40
|
+
<%- unless @development_dependencies.empty? -%>
|
41
|
+
<%- @development_dependencies.each do |name,version| -%>
|
42
|
+
gem.add_development_dependency <%= name.inspect %>, <%= version.inspect %>
|
43
|
+
<%- end -%>
|
44
|
+
<%- end -%>
|
45
|
+
<%- end -%>end
|
@@ -3,43 +3,45 @@
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
Gem::Specification.new do |gemspec|
|
6
|
-
root
|
6
|
+
root = File.dirname(__FILE__)
|
7
7
|
lib_dir = File.join(root,'lib')
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
<%- if git? -%>
|
9
|
+
files = `git ls-files`.split($/)
|
10
|
+
<%- elsif hg? -%>
|
11
|
+
files = `hg manifest`.split($/)
|
12
|
+
<%- elsif svn? -%>
|
13
|
+
files = `svn ls -R`.split($/).select { |path| File.file?(path) }
|
14
|
+
<%- else -%>
|
15
|
+
files = Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
|
16
|
+
<%- end -%>
|
17
17
|
|
18
18
|
filter_files = lambda { |paths|
|
19
|
-
case paths
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
files & case paths
|
20
|
+
when Array
|
21
|
+
paths
|
22
|
+
when String
|
23
|
+
Dir[paths]
|
24
|
+
end
|
25
25
|
}
|
26
26
|
|
27
27
|
version = {
|
28
|
-
:file
|
28
|
+
:file => '<%= @namespace_path %>/version',
|
29
29
|
:constant => '<%= @namespace %>::VERSION'
|
30
30
|
}
|
31
31
|
|
32
32
|
defaults = {
|
33
|
-
'name'
|
34
|
-
'files'
|
35
|
-
'
|
36
|
-
'
|
37
|
-
'
|
33
|
+
'name' => File.basename(root),
|
34
|
+
'files' => files,
|
35
|
+
'require_paths' => ['ext', 'lib'].select { |dir| File.directory?(dir) },
|
36
|
+
'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
|
37
|
+
'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
|
38
|
+
'doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
|
39
|
+
'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}']
|
38
40
|
}
|
39
41
|
|
40
42
|
metadata = defaults.merge(YAML.load_file('gemspec.yml'))
|
41
43
|
|
42
|
-
gemspec.name
|
44
|
+
gemspec.name = metadata['name']
|
43
45
|
gemspec.version = if metadata['version']
|
44
46
|
metadata['version']
|
45
47
|
else
|
@@ -49,50 +51,29 @@ Gem::Specification.new do |gemspec|
|
|
49
51
|
eval(version[:constant])
|
50
52
|
end
|
51
53
|
|
52
|
-
gemspec.summary
|
54
|
+
gemspec.summary = metadata.fetch('summary',metadata['description'])
|
53
55
|
gemspec.description = metadata.fetch('description',metadata['summary'])
|
54
56
|
|
55
|
-
|
56
|
-
|
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
|
57
|
+
gemspec.licenses = Array(metadata['license'])
|
58
|
+
gemspec.authors = Array(metadata['authors'])
|
68
59
|
|
69
|
-
gemspec.email
|
60
|
+
gemspec.email = metadata['email']
|
70
61
|
gemspec.homepage = metadata['homepage']
|
71
62
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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']
|
63
|
+
gemspec.require_paths = Array(metadata['require_paths'])
|
64
|
+
gemspec.files = filter_files[metadata['files']]
|
65
|
+
gemspec.executables = metadata['executables']
|
66
|
+
gemspec.extensions = metadata['extensions']
|
83
67
|
|
84
68
|
if Gem::VERSION < '1.7.'
|
85
69
|
gemspec.default_executable = gemspec.executables.first
|
86
70
|
end
|
87
71
|
|
88
|
-
gemspec.test_files
|
89
|
-
|
90
|
-
unless gemspec.files.include?('.document')
|
91
|
-
gemspec.extra_rdoc_files = metadata['extra_doc_files']
|
92
|
-
end
|
72
|
+
gemspec.test_files = filter_files[metadata['test_files']]
|
73
|
+
gemspec.extra_rdoc_files = Array(metadata['extra_doc_files'])
|
93
74
|
|
94
75
|
gemspec.post_install_message = metadata['post_install_message']
|
95
|
-
gemspec.requirements
|
76
|
+
gemspec.requirements = metadata['requirements']
|
96
77
|
|
97
78
|
if gemspec.respond_to?(:required_ruby_version=)
|
98
79
|
gemspec.required_ruby_version = metadata['required_ruby_version']
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: <%= @name %>
|
2
|
+
summary: <%= yaml_escape @summary %>
|
3
|
+
description: <%= yaml_escape @description %>
|
4
|
+
<%- if @license -%>
|
5
|
+
license: <%= @license %>
|
6
|
+
<%- end -%>
|
7
|
+
<%- if @authors.length > 1 -%>
|
8
|
+
authors:
|
9
|
+
<%- @authors.each do |name| -%>
|
10
|
+
- <%= name %>
|
11
|
+
<%- end -%>
|
12
|
+
<%- else -%>
|
13
|
+
authors: <%= @authors.first %>
|
14
|
+
<%- end -%>
|
15
|
+
<%- if @email -%>
|
16
|
+
email: <%= @email %>
|
17
|
+
<%- end -%>
|
18
|
+
homepage: <%= @homepage %>
|
19
|
+
<%= includes :gemspec, '' -%>
|
20
|
+
<%- unless @dependencies.empty? -%>
|
21
|
+
|
22
|
+
dependencies:
|
23
|
+
<%- @dependencies.each do |name,version| -%>
|
24
|
+
<%= name %>: <%= version %>
|
25
|
+
<%- end -%>
|
26
|
+
<%- end -%>
|
27
|
+
|
28
|
+
<%- if bundler? -%>
|
29
|
+
development_dependencies:
|
30
|
+
bundler: <%= @development_dependencies['bundler'] %>
|
31
|
+
<%- if yard? -%>
|
32
|
+
yard: <%= @development_dependencies['yard'] %>
|
33
|
+
<%- end -%>
|
34
|
+
<%- else -%>
|
35
|
+
<%- unless @development_dependencies.empty? -%>
|
36
|
+
development_dependencies:
|
37
|
+
<%- @development_dependencies.each do |name,version| -%>
|
38
|
+
<%= name %>: <%= version %>
|
39
|
+
<%- end -%>
|
40
|
+
<%- end -%>
|
41
|
+
<%- end -%>
|
@@ -1,21 +1,12 @@
|
|
1
1
|
<%- if bundler? -%>
|
2
|
-
require 'ore/specification'
|
3
2
|
require 'jeweler'
|
4
|
-
Jeweler::Tasks.new(
|
3
|
+
Jeweler::Tasks.new(Gem::Specification.load('<%= @name %>.gemspec'))
|
5
4
|
<%- else -%>
|
6
5
|
begin
|
7
|
-
gem '
|
8
|
-
require 'ore/specification'
|
9
|
-
rescue LoadError
|
10
|
-
warn e.message
|
11
|
-
warn "Run `gem install ore` to install Ore."
|
12
|
-
end
|
13
|
-
|
14
|
-
begin
|
15
|
-
gem 'jeweler', '<%= @jeweler_dependency %>'
|
6
|
+
gem 'jeweler', '<%= @development_dependencies['jeweler'] %>'
|
16
7
|
require 'jeweler'
|
17
8
|
|
18
|
-
Jeweler::Tasks.new(
|
9
|
+
Jeweler::Tasks.new(Gem::Specification.load('<%= @name %>.gemspec'))
|
19
10
|
rescue LoadError
|
20
11
|
warn 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
|
21
12
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%- if bundler? -%>
|
2
|
+
require 'rubygems/tasks'
|
3
|
+
Gem::Tasks.new
|
4
|
+
<%- else -%>
|
5
|
+
begin
|
6
|
+
gem 'rubygems-tasks', '<%= @development_dependencies['rubygems-tasks'] %>'
|
7
|
+
require 'rubygems/tasks'
|
8
|
+
|
9
|
+
Gem::Tasks.new
|
10
|
+
rescue LoadError => e
|
11
|
+
warn e.message
|
12
|
+
warn "Run `gem install rubygems-tasks` to install 'rubygems/tasks'."
|
13
|
+
end
|
14
|
+
<%- end -%>
|
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
7
7
|
environment_id="<%= if defined?(::RUBY_ENGINE)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
if RUBY_ENGINE == 'ruby'
|
9
|
+
RUBY_VERSION
|
10
|
+
else
|
11
|
+
RUBY_ENGINE
|
12
|
+
end
|
13
|
+
else
|
14
|
+
RUBY_VERSION
|
15
|
+
end -%>@<%= @name -%>"
|
16
16
|
|
17
17
|
#
|
18
18
|
# First we attempt to load the desired environment directly from the environment
|
@@ -34,16 +34,10 @@ fi
|
|
34
34
|
# directory you can uncomment the following code.
|
35
35
|
#
|
36
36
|
|
37
|
-
# Ensure that ore-core is installed.
|
38
|
-
if [[ `gem list -i ore-core` -ne "true" ]]; then
|
39
|
-
printf "The rubygem 'ore-core' is not installed, installing it now.\n"
|
40
|
-
gem install ore-core --version <%= @ore_core_dependency.dump %>
|
41
|
-
fi
|
42
|
-
|
43
37
|
# Ensure that Bundler is installed, install it if it is not.
|
44
38
|
if ! command -v bundle ; then
|
45
39
|
printf "The rubygem 'bundler' is not installed, installing it now.\n"
|
46
|
-
gem install bundler
|
40
|
+
gem install bundler
|
47
41
|
fi
|
48
42
|
|
49
43
|
# Bundle while reducing excess noise.
|