class FWToolkit::Git

Public Instance Methods

new(project_root) click to toggle source
# File lib/fwtoolkit/cli/git.rb, line 14
def new(project_root)
  destination_root = project_root
  repository = GitClient::Repository.new(project_root)
  raise Thor::Error, "There's already a repository at path: \"#{project_root}\"" if repository.initialized?

  template_directory 'templates/default_project/git', destination_root
  begin
    repository.init
    repository.add_files_to_index
    repository.commit('First commit')
    repository.switch_branch('dev')
  rescue GitClient::GitError => e
    raise Thor::Error, e.message + "\n#{e.git_output}"
  end

end
update(project_root) click to toggle source
# File lib/fwtoolkit/cli/git.rb, line 32
def update(project_root)
  repository = GitClient::Repository.new(project_root)
  raise Thor::Error, "There's no initialized repository at path: #{project_root}" unless git_repo.initialized?

  begin
    repository.submodule_update :init => true
  rescue GitError => e
    raise Thor::Error, e.message + "\n#{e.git_output}"
  end
end