lib/generators/bootstrapped.rb in bootstrapped-0.0.6 vs lib/generators/bootstrapped.rb in bootstrapped-0.9.0
- old
+ new
@@ -2,11 +2,11 @@
module Bootstrapped
module Generators
class Base < ::Rails::Generators::Base
def self.source_root
- @_bootstrapped_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'bootstrapped', generator_name, 'templates'))
+ @source ||= File.expand_path(File.join(File.dirname(__FILE__), 'bootstrapped', generator_name, 'templates'))
end
def self.banner
"rails generate bootstrap:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
end
@@ -16,10 +16,14 @@
def add_gem(name, options = {})
gemfile_content = File.read(destination_path("Gemfile"))
File.open(destination_path("Gemfile"), 'a') { |f| f.write("\n") } unless gemfile_content =~ /\n\Z/
gem name, options unless gemfile_content.include? name
end
-
+
+ def destination_path(path)
+ File.join(destination_root, path)
+ end
+
def print_usage
self.class.help(Thor::Base.shell.new)
exit
end
end
\ No newline at end of file