Class: FWToolkit::Git
Instance Method Summary
collapse
Methods included from ThorUtils
included
#run, #run!, #run_base, #template_directory
Instance Method Details
#new(project_root) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# 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')
rescue GitClient::GitError => e
raise Thor::Error, e.message + "\n#{e.git_output}"
end
end
|
#update(project_root) ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/fwtoolkit/cli/git.rb', line 31
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
|