Class: DockerComposeDeploy::Actions::Skeleton
- Inherits:
-
Struct
- Object
- Struct
- DockerComposeDeploy::Actions::Skeleton
- Defined in:
- lib/docker_compose_deploy/actions/skeleton.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#shell ⇒ Object
Returns the value of attribute shell.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
3 4 5 |
# File 'lib/docker_compose_deploy/actions/skeleton.rb', line 3 def name @name end |
#shell ⇒ Object
Returns the value of attribute shell
3 4 5 |
# File 'lib/docker_compose_deploy/actions/skeleton.rb', line 3 def shell @shell end |
Instance Method Details
#create ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/docker_compose_deploy/actions/skeleton.rb', line 5 def create shell.notify("Creating new skeleton") if File.exist?(name) shell.warn("Directory or file: '#{name}' already exists. Exiting.") exit(1) end begin Dir.mkdir(name) Dir.rmdir(name) rescue shell.warn("Unable to make directory '#{name}'. Is it a valid directory name? Exiting.") end template_path = File.(File.join(__dir__, "../../../template")) FileUtils.cp_r(template_path, name) shell.notify("Created skeleton app in '#{name}'.") shell.puts <<-MESSAGE To see the skeleton app in action, run the following commands # Move into the directory 1. cd #{name} # Use vagrant to create the virtual machine for testing (it will open a window and will display Ubuntu's desktop) 2. vagrant up # Install docker and docker-compose on the vagrant machine 3. dcd provision # Deploy the skeleton app to the vagrant machine 4. dcd deploy # See the server in action: 5. Open firefox on the vagrant machine and visit http://www.test MESSAGE end |