Class: AmoebaDeployTools::Amoeba
- Inherits:
-
Command
- Object
- Thor
- Command
- AmoebaDeployTools::Amoeba
show all
- Defined in:
- lib/amoeba_deploy_tools/commands/amoeba.rb
Instance Method Summary
collapse
included, #invoke_command
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ Amoeba
Any “global” setup can be done here, as the “amoeba” command will always be initialized
8
9
10
11
12
13
14
15
16
|
# File 'lib/amoeba_deploy_tools/commands/amoeba.rb', line 8
def initialize(args=[], options={}, config={})
super
setup_logger
setup_cocaine
JSON.create_id = ''
end
|
Instance Method Details
#init(url = nil) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/amoeba_deploy_tools/commands/amoeba.rb', line 20
def init(url=nil)
user_url = url if url
if system('git rev-parse > /dev/null 2>&1')
project_dir = %x{git rev-parse --show-toplevel}
default_kitchen_dir = File.expand_path("#{File.basename(project_dir).chop}-kitchen",
File.expand_path('..', project_dir))
else
default_kitchen_dir = File.expand_path('.', 'kitchen')
end
kitchen_dir = ask "Where should the new kitchen be located? (default: #{default_kitchen_dir})"
kitchen_dir = default_kitchen_dir if kitchen_dir.empty?
if File.exist?(kitchen_dir)
say 'Existing kitchen found! Will not overwrite.', :yellow
else
copy = url ? options[:skeleton] : true
url ||= DEFAULT_SKELETON_REPO
git_opts = copy ? '--depth 1' : ''
if system("git clone #{git_opts} #{url} #{kitchen_dir}")
if copy
git_dir = File.expand_path('.git', kitchen_dir)
if File.directory?(git_dir)
FileUtils.rm_rf(git_dir)
end
say_bold "New kitchen created at: #{kitchen_dir}. Please add it to version control"
else
say_bold "Kitchen from #{url} has been 'git clone'-ed into your kitchen directory"
end
else
say_fatal "ERROR: Kitchen directory cannot be cloned from URL #{url}"
end
end
config.kitchen!.url = user_url if user_url && !options[:skeleton]
config.kitchen!.path = kitchen_dir.to_s
config.save
say_bold 'Saving ./amoeba.yml config file. We suggest you `git ignore` this (contains local settings).'
end
|
#sync ⇒ Object
72
73
|
# File 'lib/amoeba_deploy_tools/commands/amoeba.rb', line 72
def sync
end
|
#update ⇒ Object
76
77
|
# File 'lib/amoeba_deploy_tools/commands/amoeba.rb', line 76
def update
end
|