Skip to content

Commit

Permalink
WIP: New clone command
Browse files Browse the repository at this point in the history
  • Loading branch information
neomilium committed Oct 18, 2021
1 parent 95ae7ab commit d67be72
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions features/update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ Feature: update

Scenario: Setting a directory to unmanaged
Given a basic setup with a puppet module "puppet-apache" from "puppetlabs"
And I successfully run `msync clone`
And a file named "config_defaults.yml" with:
"""
---
Expand Down Expand Up @@ -395,6 +396,7 @@ Feature: update

Scenario: Updating offline
Given a basic setup with a puppet module "puppet-test" from "fakenamespace"
And I successfully run `msync clone`
And a file named "config_defaults.yml" with:
"""
---
Expand Down
8 changes: 8 additions & 0 deletions lib/modulesync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ def self.update(cli_options)
exit 1 if errors && options[:fail_on_warnings]
end

def self.clone(cli_options)
@options = config_defaults.merge(cli_options)

managed_modules.each do |puppet_module|
puppet_module.repository.clone unless puppet_module.repository.cloned?
end
end

def self.execute(cli_options)
@options = config_defaults.merge(cli_options)

Expand Down
9 changes: 9 additions & 0 deletions lib/modulesync/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ def push
ModuleSync.push(config)
end

desc 'clone', 'Clone repositories that need to'
def clone
config = {
:command => 'clone',
}.merge(options)
config = Util.symbolize_keys(config)
ModuleSync.clone(config)
end

desc 'hook', 'Activate or deactivate a git hook.'
subcommand 'hook', ModuleSync::CLI::Hook
end
Expand Down

0 comments on commit d67be72

Please sign in to comment.