Class: Monolith::Command
- Inherits:
-
Thor
- Object
- Thor
- Monolith::Command
- Defined in:
- lib/monolith/commands.rb
Instance Method Summary collapse
- #clean(path = File.join(Dir.pwd, "cookbooks")) ⇒ Object
-
#initialize(*args) ⇒ Command
constructor
A new instance of Command.
- #install(path = File.join(Dir.pwd, "cookbooks")) ⇒ Object
- #update(path = File.join(Dir.pwd, "cookbooks")) ⇒ Object
- #version ⇒ Object
Constructor Details
Instance Method Details
#clean(path = File.join(Dir.pwd, "cookbooks")) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/monolith/commands.rb', line 63 def clean(path = File.join(Dir.pwd, "cookbooks")) berksfile = Monolith::Berksfile.new(.dup) # This is counter-intuitive given we're actually getting rid of the # cookbooks. This performs the dependency resolution needed to work out # what we need to remove. berksfile.install gitpath = File.('../.git', berksfile.berksfile.filepath) gitexclude = GitExclude.new(gitpath, ) berksfile.cookbooks(path) do |cookbook, dep, destination| changed = berksfile.monolith_action(:clean, cookbook, dep, destination) gitexclude.remove(destination) if changed end gitexclude.update end |
#install(path = File.join(Dir.pwd, "cookbooks")) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/monolith/commands.rb', line 40 def install(path = File.join(Dir.pwd, "cookbooks")) berksfile = Monolith::Berksfile.new(.dup) berksfile.install # We need to run berks install first gitpath = File.('../.git', berksfile.berksfile.filepath) gitexclude = GitExclude.new(gitpath, ) berksfile.cookbooks(path) do |cookbook, dep, destination| changed = berksfile.monolith_action(:install, cookbook, dep, destination) gitexclude.add(destination) if changed end gitexclude.update end |
#update(path = File.join(Dir.pwd, "cookbooks")) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/monolith/commands.rb', line 54 def update(path = File.join(Dir.pwd, "cookbooks")) berksfile = Monolith::Berksfile.new(.dup) berksfile.install # We need to run berks install first berksfile.cookbooks(path) do |cookbook, dep, destination| berksfile.monolith_action(:update, cookbook, dep, destination) end end |