Sha256: ac645eddd3856d65b107d3dc2b128eaa147007cb5a5195c9db32b1b8017bc733
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
module Amiba class Util def self.in_amiba_application? File.exist? ".amiba" end end module Generator def self.included(base) base.send :include, Thor::Actions base.send :extend, ClassMethods end module ClassMethods def source_root(path = nil) default_source_root end def default_source_root File.dirname(File.expand_path(File.join(__FILE__, ".."))) end end end class Create < Thor::Group include Generator namespace :create argument :name class_option :path class_option :default_page, :default => "index" def init_git @repo = Grit::Repo.init(target) end def create_gitignore copy_file File.join("templates",'.gitignore'), File.join(target, '.gitignore') end def create_gemfile copy_file 'Gemfile', File.join(target, 'Gemfile') end def create_project_structure copy_file File.join('templates', '.amiba'), File.join(target, ".amiba") %w{entries pages layouts}.each {|dirname| directory File.join("templates", dirname), File.join(target, dirname) } end def create_assets_structure %w{public/js public/css public/images}.each do |dirname| empty_directory File.join(target, dirname) end end def create_default_page inside(target, :verbose => true) do invoke(Amiba::Page::Create, [options[:default_page]], :title => name.titleize, :description => "#{name.titleize} Homepage. Please change this to be more descriptive") end end def commit_to_git Dir.chdir(@repo.working_dir) do @repo.add %w{.amiba Gemfile layouts pages} @repo.commit_all("Initial commit of #{name} project.") end end private def target if options[:path] File.expand_path(File.join(options[:path], name)) else name end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amiba-0.0.2 | lib/amiba.rb |