Class: Tomo::Plugin::Git::Tasks

Inherits:
TaskLibrary show all
Defined in:
lib/tomo/plugin/git/tasks.rb

Instance Method Summary collapse

Methods inherited from TaskLibrary

#initialize

Constructor Details

This class inherits a constructor from Tomo::TaskLibrary

Instance Method Details

#cloneObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/tomo/plugin/git/tasks.rb', line 16

def clone
  require_setting :git_url

  if remote.directory?(paths.git_repo) && !dry_run?
    set_origin_url
  else
    remote.mkdir_p(paths.git_repo.dirname)
    remote.git("clone", "--mirror", settings[:git_url], paths.git_repo)
  end
end

#configObject



8
9
10
11
12
13
14
# File 'lib/tomo/plugin/git/tasks.rb', line 8

def config
  user_name = settings[:git_user_name] || remote.host.user
  user_email = settings[:git_user_email] || "#{remote.host.user}@example.com"

  remote.git("config", "--global", "user.name", user_name)
  remote.git("config", "--global", "user.email", user_email)
end

#create_releaseObject

rubocop:disable Metrics/AbcSize



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tomo/plugin/git/tasks.rb', line 27

def create_release # rubocop:disable Metrics/AbcSize
  remote.chdir(paths.git_repo) do
    remote.git("remote update --prune")
  end

  store_release_info
  configure_git_attributes
  remote.mkdir_p(paths.release)

  remote.chdir(paths.git_repo) do
    remote.git("archive #{ref.shellescape} | tar -x -f - -C #{paths.release.shellescape}")
  end
end