cloudspin-stack-artefact 0.1.7 → 0.1.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e6a01f28c6e8536dbae8f824101a524e4568094
|
4
|
+
data.tar.gz: a9117c666bff1708851f33fb474454cff32e8b4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2759df12d9dd59f4c81180212ac5bff24906ee0161e3549d1144db1169c81ba2991b3eb7d349ac0bce2f18e78472613399ec62cb7c603ed7b89232e58878719f
|
7
|
+
data.tar.gz: 20171812a3cbd8761c2800650385da514b61bd3eb022b67eedcb20d06bb3d8cf515c52b74d680f1aa368310540b28f4b40de318c2c4f224fa76c60a66f5cb001
|
@@ -0,0 +1,81 @@
|
|
1
|
+
|
2
|
+
# Based heavily on bundler source code
|
3
|
+
|
4
|
+
module Cloudspin
|
5
|
+
module Stack
|
6
|
+
module Artefact
|
7
|
+
|
8
|
+
class Release
|
9
|
+
|
10
|
+
attr_reader :version
|
11
|
+
|
12
|
+
def initialize(version)
|
13
|
+
@version = version
|
14
|
+
end
|
15
|
+
|
16
|
+
def tag_version
|
17
|
+
cmd_sh %W[git tag -m Version\ #{version} #{version_tag}]
|
18
|
+
puts "Tagged #{version_tag}."
|
19
|
+
yield if block_given?
|
20
|
+
rescue RuntimeError
|
21
|
+
puts "Untagging #{version_tag} due to error."
|
22
|
+
sh_with_status %W[git tag -d #{version_tag}]
|
23
|
+
raise
|
24
|
+
end
|
25
|
+
|
26
|
+
def version_tag
|
27
|
+
"v#{version}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def chdir(dir, &blk)
|
31
|
+
Dir.chdir dir, &blk
|
32
|
+
end
|
33
|
+
|
34
|
+
def base
|
35
|
+
'.'
|
36
|
+
end
|
37
|
+
|
38
|
+
def cmd_sh(cmd, &block)
|
39
|
+
out, status = sh_with_status(cmd, &block)
|
40
|
+
unless status.success?
|
41
|
+
cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
|
42
|
+
raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
|
43
|
+
end
|
44
|
+
out
|
45
|
+
end
|
46
|
+
|
47
|
+
def sh_with_status(cmd, &block)
|
48
|
+
puts "cd #{base} && #{cmd}"
|
49
|
+
chdir(base) do
|
50
|
+
outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
|
51
|
+
status = $?
|
52
|
+
block.call(outbuf) if status.success? && block
|
53
|
+
return [outbuf, status]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def git_push(remote = "")
|
58
|
+
perform_git_push remote
|
59
|
+
perform_git_push "#{remote} --tags"
|
60
|
+
puts "Pushed git commits and tags."
|
61
|
+
end
|
62
|
+
|
63
|
+
def perform_git_push(options = "")
|
64
|
+
cmd = "git push #{options}"
|
65
|
+
out, status = sh_with_status(cmd)
|
66
|
+
return if status.success?
|
67
|
+
cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
|
68
|
+
raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
|
69
|
+
end
|
70
|
+
|
71
|
+
def already_tagged?
|
72
|
+
return false unless cmd_sh(%w[git tag]).split(/\n/).include?(version_tag)
|
73
|
+
puts "Tag #{version_tag} has already been created."
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
@@ -16,6 +16,7 @@ module Cloudspin
|
|
16
16
|
add_folder(args[:test_folder] || './test')
|
17
17
|
add_folder(args[:environments_folder] || './environments')
|
18
18
|
add_file(args[:instance_defaults_file] || './stack-instance-defaults.yaml')
|
19
|
+
add_file('Rakefile') if File.exists? 'Rakefile'
|
19
20
|
builder.build
|
20
21
|
end
|
21
22
|
|
@@ -23,6 +24,13 @@ module Cloudspin
|
|
23
24
|
task :package do |t, args|
|
24
25
|
builder.package
|
25
26
|
end
|
27
|
+
|
28
|
+
if stack_definition.github_tag?
|
29
|
+
desc "Tag the release version #{@definition.version} in github"
|
30
|
+
task :release do |t, args|
|
31
|
+
Cloudspin::Stack::Artefact::Release.new(@definition.version).tag_version
|
32
|
+
end
|
33
|
+
end
|
26
34
|
end
|
27
35
|
|
28
36
|
def add_folder(folder)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudspin-stack-artefact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 'kief '
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cloudspin-stack
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/cloudspin/stack/artefact.rb
|
104
104
|
- lib/cloudspin/stack/artefact/builder.rb
|
105
105
|
- lib/cloudspin/stack/artefact/cli.rb
|
106
|
+
- lib/cloudspin/stack/artefact/release.rb
|
106
107
|
- lib/cloudspin/stack/artefact/version.rb
|
107
108
|
- lib/cloudspin/stack/rake/artefact_task.rb
|
108
109
|
- lib/util/tar.rb
|