ore 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.gitignore +10 -0
  2. data/ChangeLog.md +70 -7
  3. data/LICENSE.txt +1 -1
  4. data/README.md +93 -88
  5. data/Rakefile +5 -5
  6. data/data/ore/templates/base/README.md.erb +3 -0
  7. data/data/ore/templates/base/README.rdoc.erb +3 -0
  8. data/data/ore/templates/base/README.tt.erb +3 -0
  9. data/data/ore/templates/base/template.yml +2 -2
  10. data/data/ore/templates/bin/bin/[name].erb +1 -1
  11. data/data/ore/templates/bundler/Gemfile.erb +14 -3
  12. data/data/ore/templates/bundler/template.yml +7 -2
  13. data/data/ore/templates/bundler_tasks/_tasks.erb +1 -0
  14. data/data/ore/templates/bundler_tasks/template.yml +6 -0
  15. data/data/ore/templates/gem_package_task/_tasks.erb +5 -0
  16. data/data/ore/templates/gem_package_task/template.yml +4 -0
  17. data/data/ore/templates/gemspec/[name].gemspec.erb +45 -0
  18. data/data/ore/templates/gemspec/template.yml +2 -0
  19. data/data/ore/templates/{base → gemspec_yml}/[name].gemspec.erb +36 -55
  20. data/data/ore/templates/gemspec_yml/gemspec.yml.erb +41 -0
  21. data/data/ore/templates/gemspec_yml/template.yml +2 -0
  22. data/data/ore/templates/git/.gitignore.erb +3 -0
  23. data/data/ore/templates/git/template.yml +2 -0
  24. data/data/ore/templates/hg/.hgignore.erb +3 -0
  25. data/data/ore/templates/hg/template.yml +2 -0
  26. data/data/ore/templates/jeweler_tasks/_tasks.erb +3 -12
  27. data/data/ore/templates/jeweler_tasks/template.yml +4 -3
  28. data/data/ore/templates/rdoc/_tasks.erb +1 -1
  29. data/data/ore/templates/rdoc/template.yml +3 -0
  30. data/data/ore/templates/rspec/_tasks.erb +1 -1
  31. data/data/ore/templates/rspec/spec/spec_helper.rb.erb +1 -1
  32. data/data/ore/templates/rspec/template.yml +2 -2
  33. data/data/ore/templates/rubygems_tasks/_tasks.erb +14 -0
  34. data/data/ore/templates/rubygems_tasks/template.yml +7 -0
  35. data/data/ore/templates/rvmrc/.rvmrc.erb +9 -15
  36. data/data/ore/templates/yard/_gemfile_development.erb +0 -1
  37. data/data/ore/templates/yard/_tasks.erb +1 -1
  38. data/data/ore/templates/yard/template.yml +5 -2
  39. data/gemspec.yml +5 -7
  40. data/lib/ore.rb +0 -2
  41. data/lib/ore/actions.rb +85 -0
  42. data/lib/ore/cli.rb +2 -32
  43. data/lib/ore/config.rb +20 -20
  44. data/lib/ore/generator.rb +101 -203
  45. data/lib/ore/naming.rb +160 -0
  46. data/lib/ore/options.rb +67 -0
  47. data/lib/ore/template.rb +8 -0
  48. data/lib/ore/template/directory.rb +60 -41
  49. data/lib/ore/template/helpers.rb +55 -7
  50. data/lib/ore/template/template.rb +61 -0
  51. data/ore.gemspec +35 -55
  52. data/spec/gemspec_examples.rb +33 -0
  53. data/spec/generator_spec.rb +188 -70
  54. data/spec/helpers/generator.rb +4 -2
  55. data/spec/helpers/matchers.rb +33 -0
  56. data/spec/naming_spec.rb +56 -0
  57. data/spec/spec_helper.rb +1 -1
  58. metadata +104 -117
  59. data/data/ore/templates/base/.gitignore.erb +0 -3
  60. data/data/ore/templates/base/_gemfile_development.erb +0 -3
  61. data/data/ore/templates/base/gemspec.yml.erb +0 -30
  62. data/data/ore/templates/bundler/_development_dependencies.erb +0 -1
  63. data/data/ore/templates/bundler/_gitignore.erb +0 -2
  64. data/data/ore/templates/bundler/_tasks.erb +0 -3
  65. data/data/ore/templates/jeweler_tasks/_development_dependencies.erb +0 -3
  66. data/data/ore/templates/jeweler_tasks/_gemfile_development.erb +0 -1
  67. data/data/ore/templates/ore_tasks/_development_dependencies.erb +0 -3
  68. data/data/ore/templates/ore_tasks/_gemfile_development.erb +0 -1
  69. data/data/ore/templates/ore_tasks/_tasks.erb +0 -14
  70. data/data/ore/templates/ore_tasks/template.yml +0 -5
  71. data/data/ore/templates/rdoc/_gitignore.erb +0 -1
  72. data/data/ore/templates/rspec/_development_dependencies.erb +0 -3
  73. data/data/ore/templates/rspec/_gemfile_development.erb +0 -1
  74. data/data/ore/templates/yard/_development_dependencies.erb +0 -1
@@ -1,5 +1,8 @@
1
1
  disable:
2
2
  - rdoc
3
3
 
4
- variables:
5
- yard_dependency: ~> 0.7
4
+ ignore:
5
+ - doc/
6
+
7
+ development_dependencies:
8
+ yard: ~> 0.7
data/gemspec.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  name: ore
2
- version: 0.8.1
3
- summary: Mine raw RubyGems from YAML
2
+ version: 0.9.0
3
+ summary: Mine beautiful RubyGems from Ore
4
4
  description:
5
5
  Ore is a flexible Ruby project generator. Unlike other Ruby project
6
6
  generators, Ore provides many builtin templates and allows custom
@@ -9,7 +9,7 @@ description:
9
9
  license: MIT
10
10
  authors: Postmodern
11
11
  email: postmodern.mod3@gmail.com
12
- homepage: http://github.com/ruby-ore/ore
12
+ homepage: https://github.com/ruby-ore/ore#readme
13
13
  post_install_message: |
14
14
  **************************************************************************
15
15
  Generate a new Ruby library:
@@ -27,11 +27,9 @@ post_install_message: |
27
27
  **************************************************************************
28
28
 
29
29
  dependencies:
30
- ore-core: ~> 0.1, >= 0.1.4
31
- env: ~> 0.1.2
32
30
  thor: ~> 0.14.3
33
31
 
34
32
  development_dependencies:
35
- ore-tasks: ~> 0.4
33
+ rubygems-tasks: ~> 0.2
36
34
  rspec: ~> 2.4
37
- yard: ~> 0.7.0
35
+ yard: ~> 0.7
data/lib/ore.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'ore-core'
2
-
3
1
  require 'ore/config'
4
2
  require 'ore/generator'
5
3
  require 'ore/cli'
@@ -0,0 +1,85 @@
1
+ module Ore
2
+ #
3
+ # Additional actions for the {Generator}.
4
+ #
5
+ # @api semipublic
6
+ #
7
+ # @since 0.9.0
8
+ #
9
+ module Actions
10
+ protected
11
+
12
+ #
13
+ # Runs a command.
14
+ #
15
+ # @param [String] command
16
+ # The command to execute.
17
+ #
18
+ # @param [Hash] config
19
+ # Additional options.
20
+ #
21
+ # @see http://rubydoc.info/gems/thor/Thor/Actions#run-instance_method
22
+ #
23
+ def run(command,config={})
24
+ super(command,config.merge(:capture => true))
25
+ end
26
+
27
+ #
28
+ # Generates an empty directory.
29
+ #
30
+ # @param [String] dest
31
+ # The uninterpolated destination path.
32
+ #
33
+ # @return [String]
34
+ # The destination path of the directory.
35
+ #
36
+ # @since 0.7.1
37
+ #
38
+ def generate_dir(dest)
39
+ return if @generated_dirs.has_key?(dest)
40
+
41
+ path = interpolate(dest)
42
+ empty_directory path
43
+
44
+ @generated_dirs[dest] = path
45
+ return path
46
+ end
47
+
48
+ #
49
+ # Generates a file.
50
+ #
51
+ # @param [String] dest
52
+ # The uninterpolated destination path.
53
+ #
54
+ # @param [String] file
55
+ # The source file or template.
56
+ #
57
+ # @param [Hash] options
58
+ # Additional options.
59
+ #
60
+ # @option options [Boolean] :template
61
+ # Specifies that the file is a template, and should be rendered.
62
+ #
63
+ # @return [String]
64
+ # The destination path of the file.
65
+ #
66
+ # @since 0.7.1
67
+ #
68
+ def generate_file(dest,file,options={})
69
+ return if @generated_files.has_key?(dest)
70
+
71
+ path = interpolate(dest)
72
+
73
+ if options[:template]
74
+ @current_template_dir = File.dirname(dest)
75
+ template file, path
76
+ @current_template_dir = nil
77
+ else
78
+ copy_file file, path
79
+ end
80
+
81
+ @generated_files[dest] = path
82
+ return path
83
+ end
84
+ end
85
+ end
data/lib/ore/cli.rb CHANGED
@@ -7,10 +7,6 @@ require 'uri'
7
7
  module Ore
8
8
  class CLI < Thor
9
9
 
10
- include Config
11
-
12
- default_task :gem
13
-
14
10
  map '-l' => :list
15
11
  map '-u' => :update
16
12
  map '-r' => :remove
@@ -46,7 +42,7 @@ module Ore
46
42
  name = File.basename(url.path)
47
43
  name.gsub!(/\.git$/,'')
48
44
 
49
- path = File.join(@@templates_dir,name)
45
+ path = File.join(Config::TEMPLATES_DIR,name)
50
46
 
51
47
  if File.directory?(path)
52
48
  say "Template #{name} already installed.", :red
@@ -80,7 +76,7 @@ module Ore
80
76
  #
81
77
  def remove(name)
82
78
  name = File.basename(name)
83
- path = File.join(@@templates_dir,name)
79
+ path = File.join(Config::TEMPLATES_DIR,name)
84
80
 
85
81
  unless File.exists?(path)
86
82
  say "Unknown template: #{name}", :red
@@ -90,31 +86,5 @@ module Ore
90
86
  FileUtils.rm_rf(path)
91
87
  end
92
88
 
93
- desc 'gemspec', 'Dumps a Ruby gemspec for the project'
94
- method_option :ruby, :type => :boolean,
95
- :default => true,
96
- :aliases => '-R'
97
- method_option :yaml, :type => :boolean, :aliases => '-Y'
98
-
99
- def gemspec
100
- require 'ore/project'
101
-
102
- gemspec = Project.find.to_gemspec
103
-
104
- if options.yaml?
105
- print YAML.dump(gemspec)
106
- else
107
- print gemspec.to_ruby
108
- end
109
- end
110
-
111
- desc 'gem', 'Builds a RubyGem'
112
-
113
- def gem
114
- require 'ore/project'
115
-
116
- Project.find.build!
117
- end
118
-
119
89
  end
120
90
  end
data/lib/ore/config.rb CHANGED
@@ -1,25 +1,25 @@
1
+ require 'rubygems'
1
2
  require 'pathname'
2
- require 'env'
3
3
 
4
4
  module Ore
5
5
  module Config
6
- # Specifies whether user settings will be loaded
7
- @@enabled = true
8
-
9
6
  # The users home directory
10
- @@home = Env.home
7
+ HOME = Gem.user_home
11
8
 
12
9
  # Ore config directory
13
- @@path = File.join(@@home,'.ore')
10
+ PATH = File.join(HOME,'.ore')
14
11
 
15
12
  # Default options file.
16
- @@options_file = File.join(@@path,'options.yml')
13
+ OPTIONS_FILE = File.join(PATH,'options.yml')
17
14
 
18
15
  # Custom Ore Templates directory
19
- @@templates_dir = File.join(@@path,'templates')
16
+ TEMPLATES_DIR = File.join(PATH,'templates')
20
17
 
21
18
  # The `data/` directory for Ore
22
- @@data_dir = File.expand_path(File.join('..','..','data'),File.dirname(__FILE__))
19
+ DATA_DIR = File.expand_path(File.join('..','..','data'),File.dirname(__FILE__))
20
+
21
+ # Specifies whether user settings will be loaded
22
+ @@enabled = true
23
23
 
24
24
  #
25
25
  # Enables access to user settings.
@@ -48,17 +48,17 @@ module Ore
48
48
  # @raise [RuntimeError]
49
49
  # The `~/.ore/options.yml` did not contain a YAML encoded Hash.
50
50
  #
51
- # @since 0.5.0
51
+ # @since 0.9.0
52
52
  #
53
- def Config.default_options
53
+ def Config.options
54
54
  options = {}
55
55
 
56
- if (@@enabled && File.file?(@@options_file))
57
- new_options = YAML.load_file(@@options_file)
56
+ if (@@enabled && File.file?(OPTIONS_FILE))
57
+ new_options = YAML.load_file(OPTIONS_FILE)
58
58
 
59
59
  # default options must be a Hash
60
60
  unless new_options.kind_of?(Hash)
61
- raise("#{@@options_file} must contain a YAML encoded Hash")
61
+ raise("#{OPTIONS_FILE} must contain a YAML encoded Hash")
62
62
  end
63
63
 
64
64
  new_options.each do |name,value|
@@ -79,7 +79,7 @@ module Ore
79
79
  # The path of a Ore template directory.
80
80
  #
81
81
  def Config.builtin_templates
82
- path = File.join(@@data_dir,'ore','templates')
82
+ path = File.join(DATA_DIR,'ore','templates')
83
83
 
84
84
  if File.directory?(path)
85
85
  Dir.glob("#{path}/*") do |template|
@@ -98,11 +98,11 @@ module Ore
98
98
  # The path of a Ore template directory.
99
99
  #
100
100
  def Config.installed_templates
101
- return unless @@enabled
102
-
103
- if File.directory?(@@templates_dir)
104
- Dir.glob("#{@@templates_dir}/*") do |template|
105
- yield template if File.directory?(template)
101
+ if @@enabled
102
+ if File.directory?(TEMPLATES_DIR)
103
+ Dir.glob("#{TEMPLATES_DIR}/*") do |template|
104
+ yield template if File.directory?(template)
105
+ end
106
106
  end
107
107
  end
108
108
  end
data/lib/ore/generator.rb CHANGED
@@ -1,105 +1,24 @@
1
- require 'ore/template/directory'
2
- require 'ore/template/interpolations'
3
- require 'ore/template/helpers'
4
- require 'ore/naming'
5
1
  require 'ore/config'
2
+ require 'ore/options'
3
+ require 'ore/actions'
4
+ require 'ore/naming'
5
+ require 'ore/template'
6
6
 
7
7
  require 'thor/group'
8
8
  require 'date'
9
9
  require 'set'
10
- require 'env'
10
+ require 'uri'
11
11
 
12
12
  module Ore
13
13
  class Generator < Thor::Group
14
14
 
15
15
  include Thor::Actions
16
+ include Options
17
+ include Actions
16
18
  include Naming
17
19
  include Template::Interpolations
18
20
  include Template::Helpers
19
21
 
20
- #
21
- # The templates registered with the generator.
22
- #
23
- def self.templates
24
- @@templates ||= {}
25
- end
26
-
27
- #
28
- # Determines whether a template was registered.
29
- #
30
- # @param [Symbol, String] name
31
- # The name of the template.
32
- #
33
- # @return [Boolean]
34
- # Specifies whether the template was registered.
35
- #
36
- # @since 0.7.2
37
- #
38
- def self.template?(name)
39
- self.templates.has_key?(name.to_sym)
40
- end
41
-
42
- #
43
- # Registers a template with the generator.
44
- #
45
- # @param [String] path
46
- # The path to the template.
47
- #
48
- # @return [Symbol]
49
- # The name of the registered template.
50
- #
51
- # @raise [StandardError]
52
- # The given path was not a directory.
53
- #
54
- def self.register_template(path)
55
- unless File.directory?(path)
56
- raise(StandardError,"#{path.dump} is must be a directory")
57
- end
58
-
59
- name = File.basename(path).to_sym
60
-
61
- self.templates[name] = path
62
- return name
63
- end
64
-
65
- #
66
- # Default options for the generator.
67
- #
68
- # @return [Hash{Symbol => Object}]
69
- # The option names and default values.
70
- #
71
- # @since 0.5.0
72
- #
73
- def self.defaults
74
- @@defaults ||= {
75
- :templates => [],
76
- :version => '0.1.0',
77
- :summary => 'TODO: Summary',
78
- :description => 'TODO: Description',
79
- :license => 'MIT',
80
- :authors => [Env.user],
81
- :ore_tasks => true,
82
- :rdoc => true,
83
- :rspec => true,
84
- :git => true
85
- }
86
- end
87
-
88
- #
89
- # Defines a generator option.
90
- #
91
- # @param [Symbol] name
92
- # The name of the option.
93
- #
94
- # @param [Hash{Symbol => Object}] options
95
- # The Thor options of the option.
96
- #
97
- # @since 0.5.0
98
- #
99
- def self.generator_option(name,options={})
100
- class_option(name,options.merge(:default => defaults[name]))
101
- end
102
-
103
22
  # The enabled templates.
104
23
  attr_reader :enabled_templates
105
24
 
@@ -115,53 +34,16 @@ module Ore
115
34
  # The generated files.
116
35
  attr_reader :generated_files
117
36
 
118
- #
119
- # Generates a new project.
120
- #
121
- def generate
122
- self.destination_root = path
123
-
124
- enable_templates!
125
- initialize_variables!
126
-
127
- say "Generating #{self.destination_root}", :green
128
-
129
- generate_directories!
130
- generate_files!
131
-
132
- if options.git?
133
- in_root do
134
- unless File.directory?('.git')
135
- run 'git init'
136
- run 'git add .'
137
- run 'git commit -m "Initial commit."'
138
- end
139
- end
140
- end
141
- end
142
-
143
- protected
144
-
145
- # merge default options
146
- defaults.merge!(Config.default_options)
147
-
148
- # register builtin templates
149
- Config.builtin_templates { |path| register_template(path) }
150
- # register installed templates
151
- Config.installed_templates { |path| register_template(path) }
37
+ # disable the Thor namespace
38
+ namespace ''
152
39
 
153
- # define options for all templates
154
- templates.each_key do |name|
40
+ Template.templates.each_key do |name|
155
41
  # skip the `base` template
156
42
  next if name == :base
157
43
 
158
- class_option name, :type => :boolean,
159
- :default => defaults.fetch(name,false)
44
+ generator_option name, :type => :boolean
160
45
  end
161
46
 
162
- # disable the Thor namespace
163
- namespace ''
164
-
165
47
  # define the options
166
48
  generator_option :markdown, :type => :boolean
167
49
  generator_option :textile, :type => :boolean
@@ -177,69 +59,50 @@ module Ore
177
59
  :banner => 'NAME [...]'
178
60
  generator_option :email, :type => :string, :aliases => '-e'
179
61
  generator_option :homepage, :type => :string, :aliases => '-U'
62
+ generator_option :bug_tracker, :type => :string, :aliases => '-B'
180
63
  generator_option :license, :aliases => '-L'
181
- generator_option :git, :type => :boolean
182
64
 
183
65
  argument :path, :required => true
184
66
 
185
67
  #
186
- # Generates an empty directory.
187
- #
188
- # @param [String] dest
189
- # The uninterpolated destination path.
190
- #
191
- # @return [String]
192
- # The destination path of the directory.
193
- #
194
- # @since 0.7.1
68
+ # Generates a new project.
195
69
  #
196
- def generate_dir(dest)
197
- return if @generated_dirs.has_key?(dest)
70
+ def generate
71
+ self.destination_root = path
198
72
 
199
- path = interpolate(dest)
200
- empty_directory path
73
+ enable_templates!
74
+ initialize_variables!
201
75
 
202
- @generated_dirs[dest] = path
203
- return path
204
- end
76
+ unless options.quiet?
77
+ say "Generating #{self.destination_root}", :green
78
+ end
205
79
 
206
- #
207
- # Generates a file.
208
- #
209
- # @param [String] dest
210
- # The uninterpolated destination path.
211
- #
212
- # @param [String] file
213
- # The source file or template.
214
- #
215
- # @param [Hash] options
216
- # Additional options.
217
- #
218
- # @option options [Boolean] :template
219
- # Specifies that the file is a template, and should be rendered.
220
- #
221
- # @return [String]
222
- # The destination path of the file.
223
- #
224
- # @since 0.7.1
225
- #
226
- def generate_file(dest,file,options={})
227
- return if @generated_files.has_key?(dest)
80
+ generate_directories!
81
+ generate_files!
228
82
 
229
- path = interpolate(dest)
83
+ in_root do
84
+ case @scm
85
+ when :git
86
+ run 'git init' unless File.directory?('.git')
87
+ run 'git add .'
88
+ run 'git commit -m "Initial commit."'
89
+ when :hg
90
+ run 'hg init' unless File.directory?('.hg')
91
+ run 'hg add .'
92
+ run 'hg commit -m "Initial commit."'
93
+ when :svn
94
+ @ignore.each do |pattern|
95
+ run "svn propset svn:ignore #{pattern.dump}"
96
+ end
230
97
 
231
- if options[:template]
232
- @current_template_dir = File.dirname(dest)
233
- template file, path
234
- @current_template_dir = nil
235
- else
236
- copy_file file, path
98
+ run 'svn add .'
99
+ run 'svn commit -m "Initial commit."'
100
+ end
237
101
  end
238
-
239
- @generated_files[dest] = path
240
- return path
241
102
  end
242
103
 
104
+ protected
105
+
243
106
  #
244
107
  # Enables a template, adding it to the generator.
245
108
  #
@@ -253,7 +116,7 @@ module Ore
253
116
 
254
117
  return false if @enabled_templates.include?(name)
255
118
 
256
- unless (template_dir = self.class.templates[name])
119
+ unless (template_dir = Template.templates[name])
257
120
  say "Unknown template #{name}", :red
258
121
  exit -1
259
122
  end
@@ -290,7 +153,7 @@ module Ore
290
153
 
291
154
  return false if @disabled_templates.include?(name)
292
155
 
293
- unless (template_dir = self.class.templates[name])
156
+ unless (template_dir = Template.templates[name])
294
157
  say "Unknown template #{name}", :red
295
158
  exit -1
296
159
  end
@@ -307,22 +170,22 @@ module Ore
307
170
  # Enables templates.
308
171
  #
309
172
  def enable_templates!
310
- @templates = []
311
- @enabled_templates = Set[]
173
+ @templates = []
174
+ @enabled_templates = Set[]
312
175
  @disabled_templates = Set[]
313
176
 
314
177
  enable_template :base
315
178
 
316
179
  # enable the default templates first
317
- self.class.defaults.each_key do |name|
318
- if (self.class.template?(name) && options[name])
180
+ Options.defaults.each_key do |name|
181
+ if (Template.template?(name) && options[name])
319
182
  enable_template(name)
320
183
  end
321
184
  end
322
185
 
323
186
  # enable the templates specified by option
324
187
  options.each do |name,value|
325
- if (self.class.template?(name) && value)
188
+ if (Template.template?(name) && value)
326
189
  enable_template(name)
327
190
  end
328
191
  end
@@ -340,27 +203,42 @@ module Ore
340
203
  # Initializes variables for the templates.
341
204
  #
342
205
  def initialize_variables!
343
- @project_dir = File.basename(destination_root)
344
- @name = (options.name || @project_dir)
206
+ @root = destination_root
207
+ @project_dir = File.basename(@root)
208
+ @name = (options.name || @project_dir)
345
209
 
346
- @modules = modules_of(@name)
210
+ @modules = modules_of(@name)
347
211
  @module_depth = @modules.length
348
- @module = @modules.last
212
+ @module = @modules.last
349
213
 
350
- @namespace = namespace_of(@name)
214
+ @namespace = namespace_of(@name)
351
215
  @namespace_dirs = namespace_dirs_of(@name)
352
216
  @namespace_path = namespace_path_of(@name)
353
- @namespace_dir = @namespace_dirs.last
217
+ @namespace_dir = @namespace_dirs.last
354
218
 
355
- @version = options.version
356
- @summary = options.summary
219
+ @version = options.version
220
+ @summary = options.summary
357
221
  @description = options.description
358
- @license = options.license
359
- @email = options.email
360
- @safe_email = @email.sub('@',' at ') if @email
361
- @homepage = (options.homepage || "http://rubygems.org/gems/#{@name}")
362
- @authors = options.authors
363
- @author = options.authors.first
222
+ @license = options.license
223
+ @authors = options.authors
224
+ @author = @authors.first
225
+ @github_user = if options.git?
226
+ `git config github.user`.chomp
227
+ end
228
+
229
+ @email = options.email
230
+ @safe_email = @email.sub('@',' at ') if @email
231
+ @homepage = if options.homepage
232
+ URI(options.homepage)
233
+ elsif !(@github_user.nil? || @github_user.empty?)
234
+ URI("https://github.com/#{@github_user}/#{@name}#readme")
235
+ else
236
+ URI("https://rubygems.org/gems/#{@name}")
237
+ end
238
+ @bug_tracker = case @homepage.host
239
+ when 'github.com'
240
+ "https://#{@homepage.host}#{@homepage.path}/issues"
241
+ end
364
242
 
365
243
  @markup = if options.markdown?
366
244
  :markdown
@@ -370,18 +248,38 @@ module Ore
370
248
  :rdoc
371
249
  end
372
250
 
373
- @date = Date.today
374
- @year = @date.year
251
+ @scm = if File.directory?(File.join(@root,'.git'))
252
+ :git
253
+ elsif File.directory?(File.join(@root,'.hg'))
254
+ :hg
255
+ elsif File.directory?(File.join(@root,'.svn'))
256
+ :svn
257
+ elsif options.hg?
258
+ :hg
259
+ elsif options.git?
260
+ :git
261
+ end
262
+
263
+ @date = Date.today
264
+ @year = @date.year
375
265
  @month = @date.month
376
- @day = @date.day
266
+ @day = @date.day
267
+
268
+ @ignore = SortedSet[]
269
+ @dependencies = {}
270
+ @development_dependencies = {}
377
271
 
378
272
  @templates.each do |template|
273
+ @ignore.merge(template.ignore)
274
+ @dependencies.merge!(template.dependencies)
275
+ @development_dependencies.merge!(template.development_dependencies)
276
+
379
277
  template.variables.each do |name,value|
380
278
  instance_variable_set("@#{name}",value)
381
279
  end
382
280
  end
383
281
 
384
- @generated_dirs = {}
282
+ @generated_dirs = {}
385
283
  @generated_files = {}
386
284
  end
387
285