Class: FigNewton::App
- Inherits:
-
Object
- Object
- FigNewton::App
- Defined in:
- lib/fig-newton/app.rb
Instance Method Summary collapse
- #clean(parent_directory = ".") ⇒ Object
- #clone(parent_directory = ".") ⇒ Object
- #down(parent_directory) ⇒ Object
-
#initialize(name, config) ⇒ App
constructor
A new instance of App.
- #pull(parent_directory = ".") ⇒ Object
- #up(parent_directory) ⇒ Object
Constructor Details
#initialize(name, config) ⇒ App
Returns a new instance of App.
3 4 5 6 7 |
# File 'lib/fig-newton/app.rb', line 3 def initialize(name, config) @name = name @repo = config["repo"] @dir = config["dir"] || dir_from_repo end |
Instance Method Details
#clean(parent_directory = ".") ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/fig-newton/app.rb', line 23 def clean(parent_directory = ".") source_directory = full_dir(parent_directory) down(parent_directory) puts "-- Cleaning killed containers in '#{source_directory}'" `cd #{source_directory} && fig rm --force` end |
#clone(parent_directory = ".") ⇒ Object
9 10 11 12 13 14 |
# File 'lib/fig-newton/app.rb', line 9 def clone(parent_directory = ".") clone_directory = full_dir(parent_directory) puts "-- Cloning #{full_repo} to '#{clone_directory}'" `git clone #{full_repo} #{clone_directory} &>/dev/null` end |
#down(parent_directory) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/fig-newton/app.rb', line 39 def down(parent_directory) source_directory = full_dir(parent_directory) puts "-- Bringing down #{@name} in '#{source_directory}'" `cd #{source_directory} && fig kill` end |
#pull(parent_directory = ".") ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fig-newton/app.rb', line 16 def pull(parent_directory = ".") source_directory = full_dir(parent_directory) puts "-- Pulling latest upstream in '#{source_directory}'" `cd #{source_directory} && git pull` end |
#up(parent_directory) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/fig-newton/app.rb', line 32 def up(parent_directory) source_directory = full_dir(parent_directory) puts "-- Bringing up #{@name} in '#{source_directory}'" `cd #{source_directory} && fig up -d` end |