Class: Amiba::Create
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Amiba::Create
- Includes:
- Generator
- Defined in:
- lib/amiba.rb
Instance Method Summary collapse
- #commit_to_git ⇒ Object
- #create_assets_structure ⇒ Object
- #create_default_feeds ⇒ Object
- #create_default_page ⇒ Object
- #create_gemfile ⇒ Object
- #create_gitignore ⇒ Object
- #create_project_structure ⇒ Object
- #init_git ⇒ Object
Methods included from Generator
Instance Method Details
#commit_to_git ⇒ Object
78 79 80 81 82 83 |
# File 'lib/amiba.rb', line 78 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 |
#create_assets_structure ⇒ Object
59 60 61 62 63 |
# File 'lib/amiba.rb', line 59 def create_assets_structure %w{public/js public/css public/images}.each do |dirname| empty_directory File.join(target, dirname) end end |
#create_default_feeds ⇒ Object
65 66 67 |
# File 'lib/amiba.rb', line 65 def create_default_feeds directory File.join("templates", "feeds"), File.join(target, dirname) end |
#create_default_page ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/amiba.rb', line 69 def create_default_page inside(target, :verbose => true) do invoke(Amiba::Page::Create, [[:default_page]], :title => name.titleize, :description => "#{name.titleize} Homepage. Please change this to be more descriptive") end end |
#create_gemfile ⇒ Object
48 49 50 |
# File 'lib/amiba.rb', line 48 def create_gemfile copy_file 'Gemfile', File.join(target, 'Gemfile') end |
#create_gitignore ⇒ Object
44 45 46 |
# File 'lib/amiba.rb', line 44 def create_gitignore copy_file File.join("templates",'.gitignore'), File.join(target, '.gitignore') end |
#create_project_structure ⇒ Object
52 53 54 55 56 57 |
# File 'lib/amiba.rb', line 52 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 |
#init_git ⇒ Object
40 41 42 |
# File 'lib/amiba.rb', line 40 def init_git @repo = Grit::Repo.init(target) end |