capistrano-nomad 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: decb45a7958cc1a3b2bc96d8d48e72ff6132d160eac93e81e995b59661dfc5ff
4
- data.tar.gz: adaf5bb0a848328cfd830f861b1f8ff744e46bba6eab66f9180fdd21f1bad57b
3
+ metadata.gz: 8e086bb0968563ebe8bc50d27aeae5fbf26c91c484e6bb4ff3774e06da3d013a
4
+ data.tar.gz: 190a466a7334240004d6e7ed7056555ad3872a331e22b2745124fb7394e166ec
5
5
  SHA512:
6
- metadata.gz: cac6624d0caceedcd3ac833d87a3a498d0a023b74d604b626413df62f15e107324a538035d93e9a39800eba57dddca4b6a70a8bd4825fed99a002411634254a5
7
- data.tar.gz: 3a622b2f506d8a3d98f5c97646fa6da662b8b6ea86e86c9e315c10a62ef4f88acd7befc7f22167f52b8de3b0d9ea9fc8dfccf5924da7da74a061f3b1ba450ea8
6
+ metadata.gz: 74a497827c062c431a59a9b102e4a1f6a3cb4a8c47a700c1acd2f6e6b3591c78aad734867dc649da9b0f616021949bdd9e69cc8031481086d29c7e0e9380d1b7
7
+ data.tar.gz: f765b3cf57ddf929bf1fb324218be5e093e9709f9bb56a3aef1c8ede338f33c5bbdcbe6c14b9a884fa046680164d9739c23c42fa2b27a843cf87f86b06e17fd6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-nomad (0.4.0)
4
+ capistrano-nomad (0.4.1)
5
5
  activesupport (<= 7.0.8)
6
6
  byebug
7
7
  capistrano (~> 3.0)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "capistrano-nomad"
5
- spec.version = "0.4.0"
5
+ spec.version = "0.4.1"
6
6
  spec.authors = ["James Hu"]
7
7
 
8
8
  spec.summary = "Capistrano plugin for deploying and managing Nomad jobs"
@@ -76,19 +76,13 @@ def capistrano_nomad_build_docker_image_for_type(image_type)
76
76
  "--platform linux/amd64",
77
77
  ]
78
78
 
79
- build_args =
80
- if attributes[:build_args].is_a?(Proc)
81
- proc_args = attributes[:build_args].arity == 1 ? [capistrano_nomad_fetch_git_commit_id] : []
82
-
83
- attributes[:build_args].call(*proc_args)
84
- else
85
- attributes[:build_args]
86
- end
87
-
88
79
  if (target = attributes[:target])
89
80
  args << "--target #{target}"
90
81
  end
91
82
 
83
+ build_args = attributes[:build_args]
84
+ build_args = build_args.call if build_args&.is_a?(Proc)
85
+
92
86
  (build_args || []).each do |key, value|
93
87
  args << "--build-arg #{key}=#{value}"
94
88
  end
@@ -4,6 +4,6 @@ def capistrano_nomad_git
4
4
  @capistrano_nomad_git ||= Git.open(".")
5
5
  end
6
6
 
7
- def capistrano_nomad_fetch_git_commit_id
8
- capistrano_nomad_git.log.first.sha
7
+ def capistrano_nomad_git_commit_id
8
+ @capistrano_nomad_git_commit_id ||= capistrano_nomad_git.log.first.sha
9
9
  end
@@ -106,7 +106,7 @@ def capistrano_nomad_execute_nomad_command(*args)
106
106
  end
107
107
 
108
108
  def capistrano_nomad_exec_within_job(name, command, namespace: nil)
109
- capistrano_nomad_execute_nomad_command(:alloc, :exec, { namespace: namespace, task: name, job: name }, command)
109
+ capistrano_nomad_execute_nomad_command(:alloc, :exec, { namespace: namespace, task: name, job: true }, name, command)
110
110
  end
111
111
 
112
112
  def capistrano_nomad_upload_file(local_path:, remote_path:, erb_vars: {})
@@ -122,7 +122,7 @@ def capistrano_nomad_upload_file(local_path:, remote_path:, erb_vars: {})
122
122
  erb = ERB.new(File.open(local_path).read, trim_mode: "-")
123
123
 
124
124
  final_erb_vars = {
125
- git_commit_id: fetch(:current_revision) || capistrano_nomad_fetch_git_commit_id,
125
+ git_commit_id: fetch(:current_revision) || capistrano_nomad_git_commit_id,
126
126
  docker_image_types: docker_image_types,
127
127
  }
128
128
 
@@ -6,7 +6,7 @@ class Capistrano::SCM::GitLocal < Capistrano::SCM::Plugin
6
6
  namespace :git_local do
7
7
  task :set_current_revision do
8
8
  on release_roles :manager do
9
- set :current_revision, capistrano_nomad_fetch_git_commit_id
9
+ set :current_revision, capistrano_nomad_git_commit_id
10
10
  end
11
11
  end
12
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-nomad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hu