lib/repositories.rb in forj-0.0.11 vs lib/repositories.rb in forj-0.0.12
- old
+ new
@@ -13,10 +13,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'git'
+require 'fileutils'
+require 'require_relative'
require_relative 'yaml_parse.rb'
include YamlParse
module Repositories
@@ -27,12 +29,14 @@
home = File.expand_path('~')
path = home + '/.hpcloud/'
begin
- unless File.directory?(path) do
- Git.clone(maestro_url, 'maestro', :path => path)
+ if File.directory?(path)
+ if File.directory?(path + 'maestro')
+ FileUtils.rm_r path + 'maestro'
end
+ Git.clone(maestro_url, 'maestro', :path => path)
end
rescue
puts 'Error while cloning the repo from %s' % [maestro_url]
puts 'If this error persist you could clone the repo manually in ~/.hpcloud/'
end
\ No newline at end of file