git-runner-deploy 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/git-runner-deploy.rb +16 -9
  2. metadata +1 -1
@@ -7,7 +7,7 @@ module GitRunner
7
7
 
8
8
  # Performs deployments using capistrano (cap deploy)
9
9
  class Deploy < Base
10
- VERSION = '0.1.2'
10
+ VERSION = '0.1.3'
11
11
 
12
12
  attr_accessor :clone_directory
13
13
 
@@ -61,25 +61,29 @@ module GitRunner
61
61
  end
62
62
 
63
63
  def checkout_branch
64
- timestamp = Time.now.strftime("%Y%m%d%H%M%S")
65
64
  self.clone_directory = File.join(Configuration.tmp_directory, "#{branch.repository_name}")
65
+ revision = execute("git ls-remote file://#{branch.repository_path} #{branch.name}").split("\t")[0]
66
66
 
67
67
  if File.exist?(clone_directory)
68
68
  Text.out("Checking out #{branch.name} to #{clone_directory}")
69
+
70
+ execute(
71
+ "cd #{clone_directory}",
72
+ "git fetch origin",
73
+ "git fetch --tags origin",
74
+ "git reset --hard #{revision}",
75
+ "git clean -d -x -f"
76
+ )
69
77
  else
70
78
  Text.out("Checking out #{branch.name} to #{clone_directory} (fresh clone)")
71
79
 
72
80
  execute(
73
81
  "mkdir -p #{clone_directory}",
74
- "git clone file://#{branch.repository_path} #{clone_directory}"
82
+ "git clone file://#{branch.repository_path} #{clone_directory}",
83
+ "cd #{clone_directory}",
84
+ "git checkout -b git-runner-deploy #{revision}"
75
85
  )
76
86
  end
77
-
78
- execute(
79
- "cd #{clone_directory}",
80
- "git checkout #{branch.name}",
81
- "git pull"
82
- )
83
87
  end
84
88
 
85
89
  def prepare_deploy_environment
@@ -119,6 +123,9 @@ module GitRunner
119
123
  when 'bundle:install'
120
124
  Text.out('* Installing gems')
121
125
 
126
+ when 'assets:precompile'
127
+ Text.out('* Precompilng assets')
128
+
122
129
  when 'deploy:restart'
123
130
  Text.out('* Restarting application')
124
131
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-runner-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: