Class: GitCloner::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/git_cloner_core.rb

Overview

GitCloner Core

Constant Summary collapse

GIT_CLONER_FILE =
'Gitclonerfile'
GIT_CLONER_TEMPLATE =
<<-EOS
# encoding: utf-8

# default_output place
# default_output allow only String
# default_output's default value => "./"
default_output "./"

# git repositries
# repos allow only Array(in Array, Hash[:place, :output, :copies])
# copies is option.
# copies must have Array[Hash{:from, :to}].
# you can copy files or directories.
# repos's default value => []
repos [
  {
place: 'https://github.com/tbpgr/rspec_piccolo.git',
output: './tmp',
copies: [
  {from: "./tmp/rspec_piccolo/lib/rspec_piccolo", to: "./"},
  {from: "./tmp/rspec_piccolo/spec", to: "./sample"}
]
  }
]
EOS

Instance Method Summary collapse

Instance Method Details

#cloneObject

clone git repositories



43
44
45
46
47
48
49
# File 'lib/git_cloner_core.rb', line 43

def clone
  settings = read_settings
  base_dir = Dir.pwd
  default_output = settings.default_output
  repos = settings.repos
  clone_repositories(default_output, repos, base_dir)
end

#initObject

generate Gitclonerfile to current directory.



38
39
40
# File 'lib/git_cloner_core.rb', line 38

def init
  File.open(GIT_CLONER_FILE, 'w') { |f|f.puts(GIT_CLONER_TEMPLATE) }
end