cloudspin-stack-artefact 0.1.7 → 0.1.8

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
  SHA1:
3
- metadata.gz: 919593bd5c77587b969f61b69b25f4b96603891e
4
- data.tar.gz: e3169cf4155d409f8548bd3d7d2741c8cf40b703
3
+ metadata.gz: 0e6a01f28c6e8536dbae8f824101a524e4568094
4
+ data.tar.gz: a9117c666bff1708851f33fb474454cff32e8b4f
5
5
  SHA512:
6
- metadata.gz: f3535fc216a2509a36cbd93f3b147834ab9ac535c39e2aacbefef5d4651c50f38d767a8bc2af47bac0c3728fc26010a925852a57578d765b79c7a7312cf33eac
7
- data.tar.gz: d73b482ffa552e9d8ee77a07d1a44556cbf4bb8225e67e6e83aca40100f474a92e92a404f85b92a144db63d7037defc114fbe9d9c5b1b51ddc7dbd82e14be71b
6
+ metadata.gz: 2759df12d9dd59f4c81180212ac5bff24906ee0161e3549d1144db1169c81ba2991b3eb7d349ac0bce2f18e78472613399ec62cb7c603ed7b89232e58878719f
7
+ data.tar.gz: 20171812a3cbd8761c2800650385da514b61bd3eb022b67eedcb20d06bb3d8cf515c52b74d680f1aa368310540b28f4b40de318c2c4f224fa76c60a66f5cb001
@@ -35,6 +35,7 @@ module Cloudspin
35
35
  add_folder(options[:test_folder])
36
36
  add_folder(options[:environments_folder])
37
37
  add_file(options[:instance_defaults_file])
38
+ add_file('Rakefile') if File.exists? 'Rakefile'
38
39
  builder.build
39
40
  end
40
41
 
@@ -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
+
@@ -1,7 +1,7 @@
1
1
  module Cloudspin
2
2
  module Stack
3
3
  module Artefact
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.8'
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,6 @@
1
1
  require 'cloudspin/stack'
2
2
  require 'cloudspin/stack/artefact/version'
3
3
  require 'cloudspin/stack/artefact/builder'
4
+ require 'cloudspin/stack/artefact/release'
4
5
  require 'rake/tasklib'
5
6
  require 'cloudspin/stack/rake/artefact_task'
@@ -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.7
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-13 00:00:00.000000000 Z
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