Sha256: 22a2c187e29611dc3accb719e78714889181371d798c2767274de7439787cb49
Contents?: true
Size: 1.3 KB
Versions: 16
Compression:
Stored size: 1.3 KB
Contents
require 'thor' require 'fwtoolkit/cli/fw_actions' require 'fwtoolkit/git_client' require 'fwtoolkit/cli/thorutils' module FWToolkit class Git < Thor include Thor::Actions include FWToolkit::ThorUtils source_root_templates! desc 'new', 'Creates a git repository and commits to master all the files in project_dir' 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 desc 'update', 'Updates submodules for the repository in project_dir' 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 end end
Version data entries
16 entries across 16 versions & 1 rubygems