Permalink
Browse files

Add generator and rake

  • Loading branch information...
1 parent 1bc302c commit 325b17a68c325276407cb2ef2e768e20a956a210 @zires committed Mar 14, 2012
View
@@ -1,6 +1,6 @@
= theme_park
-Description goes here.
+Coming soon.
== Contributing to theme_park
@@ -0,0 +1,27 @@
+# Convention over configuration.
+#
+# app/
+# - themes
+# - [theme_name]
+# |- assets
+# |- images
+# |- javascripts
+# |- stylesheets
+# |- compiled -> Compiled static files
+# |- views
+# |- layouts
+#
+# Uncomment below lines if you really need to.
+# ===
+# ThemePark.setup do |config|
+#
+# config.root = "#{::Rails.root}/themes/"
+# config.prefix = 'themes'
+# config.images_path = ':root/:name/assets/images'
+# config.javascripts_path = ':root/:name/assets/javascripts'
+# config.stylesheets_path = ':root/:name/assets/stylesheets'
+# config.compiled_path = ':root/:name/assets/compiled'
+# config.views_path = ':root/:name/views'
+#
+# end
+# ===
@@ -0,0 +1,21 @@
+# encoding: utf-8
+require 'fileutils'
+
+module ThemePark
+ module Generators
+ class CreateGenerator < ::Rails::Generators::Base
+ # Create a new theme under theme_park root path.
+ argument :name, :type => :string
+
+ class_option :force, :type => :boolean, :default => false, :alias => :f, :description => "Will cover exist files."
+
+ desc "Create an empty theme under theme_park root path."
+ def create_theme
+ ThemePark.theme_assets_path(name).each do |path|
+ FileUtils.mkdir_p path
+ end
+ end
+
+ end
+ end
+end
@@ -0,0 +1,16 @@
+# encoding: utf-8
+module ThemePark
+ module Generators
+ class InstallGenerator < ::Rails::Generators::Base
+ # Create theme_park.rb under config/initializers/
+ source_root File.expand_path("../../templates", __FILE__)
+
+ desc "Creates a ThemePark initializer file."
+ def copy_initializer
+ template "theme_park.rb", "config/initializers/theme_park.rb"
+ end
+
+ end
+ end
+end
+
@@ -0,0 +1,2 @@
+# TODO
+# Add rake themes:precompile
@@ -1,8 +1,14 @@
# encoding: utf-8
module ThemePark
class Railtie < ::Rails::Railtie
+
rake_tasks do
- #load "sprockets/assets.rake"
+ load "tasks/theme_park.rake"
+ end
+
+ generators do
+ require "generators/theme_park/install_generator"
+ require "generators/theme_park/create_generator"
end
initializer "ThemePark.environment", :group => :all do |app|

0 comments on commit 325b17a

Please sign in to comment.