Permalink
Browse files

Fix generator bug

  • Loading branch information...
1 parent 742bb51 commit 0b434f7b236d372ff4d1fa39bc6823816295d489 @zires committed Mar 15, 2012
Showing with 13 additions and 12 deletions.
  1. +10 −10 lib/generators/theme_park/create_generator.rb
  2. +3 −2 theme_park.gemspec
View
20 lib/generators/theme_park/create_generator.rb
@@ -1,6 +1,11 @@
# encoding: utf-8
require 'fileutils'
+begin
+ require File.join(::Rails.root, 'config', 'initializers', 'theme_park.rb')
+rescue Exception => e
+end
+
module ThemePark
module Generators
class CreateGenerator < ::Rails::Generators::Base
@@ -15,17 +20,12 @@ def create_theme
ThemePark.theme_assets_path(name).each do |path|
FileUtils.mkdir_p path
end
- copy_file "application.css", File.join( relative_path(ThemePark.stylesheets_path(name)), "#{name}.css" )
- copy_file "application.js", File.join( relative_path(ThemePark.javascripts_path(name)), "#{name}.js" )
- directory "layout", relative_path( ThemePark.views_path(name) )
- end
+ FileUtils.mkdir_p ThemePark.views_path(name)
+ FileUtils.mkdir_p ThemePark.compiled_path(name)
- private
- ##
- # '/var/www/{Your-app}/themes/...' #=> '/themes/...'
- def relative_path(path)
- path =~ /#{Rails.root}(.*)/
- $1
+ copy_file "application.css", File.join( ThemePark.stylesheets_path(name), "#{name}.css" )
+ copy_file "application.js", File.join( ThemePark.javascripts_path(name), "#{name}.js" )
+ directory "layouts", File.join( ThemePark.views_path(name), "layouts" )
end
end
View
5 theme_park.gemspec
@@ -14,8 +14,9 @@ Gem::Specification.new do |s|
s.summary = "Multiple theme plugin for rails3, sinatra, and more..."
s.description = "Multiple theme plugin for rails3, sinatra, and more..."
s.date = %q{2012-03-15}
-
- s.files = `git ls-files`.split("\n")
+ s.extra_rdoc_files = ["LICENSE.txt", "README.rdoc"]
+
+ s.files = Dir["{app,config,db,lib}/**/*"] + ["LICENSE.txt", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
s.require_paths = [%q{lib}]
s.licenses = [%q{MIT}]

0 comments on commit 0b434f7

Please sign in to comment.