Class: Amiba::Create

Inherits:
Thor::Group
  • Object
show all
Includes:
Generator
Defined in:
lib/amiba.rb

Instance Method Summary collapse

Methods included from Generator

included

Instance Method Details

#commit_to_gitObject



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_structureObject



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_feedsObject



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_pageObject



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,
           [options[:default_page]],
           :title => name.titleize,
           :description => "#{name.titleize} Homepage. Please change this to be more descriptive")
  end
end

#create_gemfileObject



48
49
50
# File 'lib/amiba.rb', line 48

def create_gemfile
  copy_file 'Gemfile', File.join(target, 'Gemfile')
end

#create_gitignoreObject



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_structureObject



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_gitObject



40
41
42
# File 'lib/amiba.rb', line 40

def init_git
  @repo = Grit::Repo.init(target)
end