Class: GitChange::Author
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- GitChange::Author
- Includes:
- Thor::Actions
- Defined in:
- lib/git_change/author.rb
Class Method Summary collapse
Instance Method Summary collapse
- #clone_repo_bare ⇒ Object
- #puts_command_to_finish ⇒ Object
- #run_change_author_script ⇒ Object
- #set_local_config ⇒ Object
Class Method Details
.source_root ⇒ Object
13 14 15 |
# File 'lib/git_change/author.rb', line 13 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#clone_repo_bare ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/git_change/author.rb', line 17 def # get remote url for current repo remote_url = GitChange::Util.git_remote_url if remote_url.empty? puts "You need to have remote repository to work on".colorize(:red) return end if File.directory? "temp_repo" puts "temp_repo directory already exists".colorize(:red) return end # git clone bare to temp_repo to work on system "git clone --bare #{remote_url} temp_repo" puts "First step: clone the bare repository is done".colorize(:green) end |
#puts_command_to_finish ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/git_change/author.rb', line 53 def puts_command_to_finish puts "After you review the change, you can run the command below" puts "inside temp_repo, after that remove the temp_repo" puts "============================================================" puts "git push --force --tags origin 'refs/heads/*'" puts "============================================================" end |
#run_change_author_script ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/git_change/author.rb', line 33 def # create script template "templates/change_author.tt", "temp_repo/change_author.sh" inside "temp_repo" do # run the script run "sh ./change_author.sh" end end |
#set_local_config ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/git_change/author.rb', line 42 def set_local_config old_name = GitChange::Util.user_name old_email = [:old_email] puts "change local config user.name from #{old_name} to #{name}". colorize(:green) puts "change local config user.email from #{old_email} to #{email}". colorize(:green) `git config user.name #{name}` `git config user.email #{email}` end |