harrison 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbd178c641c35846dfc9376babcf2af16ae15bbe
4
- data.tar.gz: e27ddc623943e272a38f0fb72f69b1e312a4618e
3
+ metadata.gz: 760f8c56d329abf35ed7cd9c77796ec77dc783d5
4
+ data.tar.gz: 30481788ad2ea5bf4220e55cf5b88aa61537550f
5
5
  SHA512:
6
- metadata.gz: ddabbccb099cf66d35df61f1b58589cff24eed24906f238b0785d3a4609cc165d6f91fe3eea1f51cb41c0d92f704d9424cacd4f7b03f641f71c9f4fa47103d47
7
- data.tar.gz: 81cbf3d1f671f8fcd952756b81baecd9136dd694cdb33a3d3fdc1a6ab12029fa49cfbfd75cdf17d42c156f0bfba5de448dbca7a60e51346bc79e1832a37af384
6
+ metadata.gz: a518dc8a366adcf5c6ef5136d4d259f1b83a0fe1ea3894cc3e5ffd8696e996d9c34a237654fd0f43b7f769b5e291748d90af086ecebcf419aab734c4e7f1e445
7
+ data.tar.gz: e2eab336ca70464544ebf239f8d48796aab72bbb4c13a342b5cb609ba12cee4ebcb61e32ca80b7722ce6a5582704ac32f53b195f1dfd03c39733ab83fed3338e
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.7.0
2
+ -------------------
3
+ - Added ability to calculate build host dynamically in package task.
4
+
1
5
  0.6.0
2
6
  -------------------
3
7
  - Added ability to package from forks. When packaging from HEAD or a branch,
data/lib/harrison/base.rb CHANGED
@@ -6,9 +6,11 @@ module Harrison
6
6
  def initialize(arg_opts=[], opts={})
7
7
  # Config helpers for Harrisonfile.
8
8
  self.class.option_helper(:user)
9
+ self.class.option_helper(:env)
9
10
 
10
11
  @arg_opts = arg_opts
11
12
  @arg_opts << [ :debug, "Output debug messages.", :type => :boolean, :default => false ]
13
+ @arg_opts << [ :env, "Environment to package for or deploy to. This can be examined in your Harrisonfile to calculate target hosts.", :type => :string ]
12
14
 
13
15
  @options = opts
14
16
  end
@@ -15,7 +15,6 @@ module Harrison
15
15
  def initialize(opts={})
16
16
  # Config helpers for Harrisonfile.
17
17
  self.class.option_helper(:hosts)
18
- self.class.option_helper(:env)
19
18
  self.class.option_helper(:base_dir)
20
19
  self.class.option_helper(:deploy_via)
21
20
  self.class.option_helper(:keep)
@@ -24,7 +23,6 @@ module Harrison
24
23
  # Command line opts for this action. Will be merged with common opts.
25
24
  arg_opts = [
26
25
  [ :hosts, "List of remote hosts to deploy to. Can also be specified in Harrisonfile.", :type => :strings ],
27
- [ :env, "Environment to deploy to. This can be examined in your Harrisonfile to calculate target hosts.", :type => :string ],
28
26
  [ :keep, "Number of recent deploys to keep after a successful deploy. (Including the most recent deploy.) Defaults to keeping all deploys forever.", :type => :integer ],
29
27
  [ :confirm, "Whether to interactively confirm the list of target hosts for deployment.", :type => :flag, :default => true ],
30
28
  ]
@@ -39,6 +39,16 @@ module Harrison
39
39
  # Resolve commit ref to an actual short SHA.
40
40
  resolve_commit!
41
41
 
42
+ if self.host.respond_to?(:call)
43
+ resolved_host = self.host.call(self)
44
+ self.host = resolved_host
45
+ end
46
+
47
+ # Require at least one host.
48
+ if !self.host || self.host.empty?
49
+ abort("ERROR: Unable to resolve build host.")
50
+ end
51
+
42
52
  puts "Packaging #{commit} from #{remote_url} for \"#{project}\" on #{host}..."
43
53
 
44
54
  # Make sure the folder to save the artifact to locally exists.
@@ -69,7 +79,16 @@ module Harrison
69
79
  remote_exec("rm -rf #{build_dir} && mkdir -p #{build_dir}")
70
80
 
71
81
  # Check out target commit into the build_dir.
72
- remote_exec("cd cached && GIT_WORK_TREE=../#{build_dir} git checkout --detach -f #{commit} && git checkout -f -") # TODO: When git is upgraded: --ignore-other-worktrees
82
+ checkout_failure = catch :failure do
83
+ remote_exec("cd cached && GIT_WORK_TREE=../#{build_dir} git checkout --detach -f #{commit} && git checkout -f -") # TODO: When git is upgraded: --ignore-other-worktrees
84
+
85
+ # We want "checkout_failure" to be false if nothing was caught.
86
+ false
87
+ end
88
+
89
+ if checkout_failure
90
+ abort("ERROR: Unable to checkout requested git reference '#{commit}' on build server, ensure you have pushed the requested branch or tag to the remote repo.")
91
+ end
73
92
 
74
93
  # Run user supplied build code in the context of the checked out code.
75
94
  begin
@@ -1,3 +1,3 @@
1
1
  module Harrison
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harrison
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Scott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-19 00:00:00.000000000 Z
11
+ date: 2018-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  version: '0'
208
208
  requirements: []
209
209
  rubyforge_project:
210
- rubygems_version: 2.5.1
210
+ rubygems_version: 2.6.8
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: Simple artifact-based deployment for web applications.