Class: StashCloneTool::StashCloner
- Inherits:
-
Object
- Object
- StashCloneTool::StashCloner
- Includes:
- StashCloneTool
- Defined in:
- lib/stash_clone_tool/stash_cloner.rb
Constant Summary
Constants included from StashCloneTool
Instance Method Summary collapse
- #clone_stash(clone_options) {|wrapper| ... } ⇒ Object
-
#initialize(stash_url, username, password, directory) ⇒ StashCloner
constructor
A new instance of StashCloner.
Constructor Details
#initialize(stash_url, username, password, directory) ⇒ StashCloner
Returns a new instance of StashCloner.
13 14 15 16 |
# File 'lib/stash_clone_tool/stash_cloner.rb', line 13 def initialize(stash_url, username, password, directory) @stash = StashApiClient.new(stash_url, username, password) @directory = directory end |
Instance Method Details
#clone_stash(clone_options) {|wrapper| ... } ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/stash_clone_tool/stash_cloner.rb', line 18 def clone_stash() wrapper = Multiblock.wrapper yield(wrapper) @stash.projects.each do |project| project.repositories.each do |repository| folder = File.join(@directory, project.key, repository.slug) wrapper.call(:initialize_repository, repository, folder) clone_link = repository.clone_link(:ssh) if Dir.exists?(folder) wrapper.call(:failure, repository, 'Target already exists') else Git.clone(clone_link, folder, ) wrapper.call(:success, repository) end end end end |