Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a init command #172

Merged
merged 1 commit into from
Oct 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/itamae.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
require "itamae/config"
require "itamae/ext"

require "itamae/generators"
require "itamae/generators/project"

module Itamae
# Your code goes here...
end

8 changes: 8 additions & 0 deletions lib/itamae/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,13 @@ def docker(*recipe_files)
def version
puts "Itamae v#{Itamae::VERSION}"
end

desc "init NAME", "Create a new project"
def init(name)
generator = Generators::Project.new
generator.destination_root = name
generator.invoke_all
end

end
end
4 changes: 4 additions & 0 deletions lib/itamae/generators.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Itamae
module Generators
end
end
22 changes: 22 additions & 0 deletions lib/itamae/generators/project.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'thor'
require 'thor/group'

module Itamae
module Generators
class Project < Thor::Group
include Thor::Actions

def self.source_root
File.dirname(__FILE__) + '/templates/project'
end

def copy_files
directory '.'
end

def bundle
run 'bundle install'
end
end
end
end
4 changes: 4 additions & 0 deletions lib/itamae/generators/templates/project/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'itamae'
# gem 'serverspec'
Empty file.
Empty file.