cap-git-tags 0.1.1 → 0.1.2

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: 03a2fccb8c27cf0e3ce1dc5ab499ca6af3f4294f
4
- data.tar.gz: cd65f94fd899a9ddc1b6c7c0819b23c8f6ececd6
3
+ metadata.gz: 5d7d76ebe01d406cd1fbe759d1ffa1ccccf090de
4
+ data.tar.gz: 072f87a32fb08c248e48cfd1171d8b85df153ce2
5
5
  SHA512:
6
- metadata.gz: 4cc90cc3e5b908b9159f76885a6a8170aae062c6b6a3b57b0ac326d7b965cc40fe26644f45c7c306f51744f2c5072ef046df5c3b8be5a02f0d005999b8c01a24
7
- data.tar.gz: 02903ea26865b2ac9ab0bafc3044933348a8831b091fa9cc70981e79841e8aee2511d4ab567a995ab32c5ca37f1d128eb0faf98a11d7037863fba8e8a707ff33
6
+ metadata.gz: 6d1b3b7c573f659e64ee4fb5da826f91dfc4b4ae505674524652ffa4a5064f6e1d951578769c0c9f69f4023e4066c5179b3e4e6aa125176045508bb523866329
7
+ data.tar.gz: 5e43823eb2422f36b350e81661568e004232ead9f4fbc48caa7864f7eada9d9cb6ec4c1ed654e06af04d3aa5655d1cf49fe85a74c9919a43a365786d52ccfbc7
data/changelog.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ # v 0.1.2
4
+
5
+ * Propper fix for rollback issue
6
+
7
+ # v 0.1.1
8
+
9
+ * Fixed rollback issue, changed hook to `before :updating`
10
+
11
+ # v 0.1.0
12
+
13
+ * Initial release
@@ -1,52 +1,55 @@
1
- namespace :deploy do
2
-
3
- task :create_tag do
4
- run_locally do
5
- current_stage = fetch(:stage)
6
-
7
- if current_stage == :production
8
- # Production deploys use the latest staging tag or passed in ENV['TAG']
9
- if ENV['TAG']
10
- latest_staging_tag = production_tag = ENV['TAG']
1
+ namespace :gittags do
2
+
3
+ task :create_tag do |t, args|
4
+ # Don't run any of this for rollbacks etc
5
+ if fetch(:deploying)
6
+ run_locally do
7
+ current_stage = fetch(:stage)
8
+
9
+ if current_stage == :production
10
+ # Production deploys use the latest staging tag or passed in ENV['TAG']
11
+ if ENV['TAG']
12
+ latest_staging_tag = production_tag = ENV['TAG']
13
+ else
14
+ latest_staging_tag = `git describe --match "staging*" --abbrev=4 HEAD`.chomp
15
+ production_tag = latest_staging_tag.sub(/^staging/, "production")
16
+ end
17
+
18
+ info "You are about to deploy: #{latest_staging_tag} to production"
19
+ ask :yes_to_confirm_deploy, "n"
20
+
21
+ if fetch(:yes_to_confirm_deploy)[0].downcase != "y"
22
+ abort "You didn't confirm the deployment"
23
+ end
24
+
25
+ unless ENV['TAG']
26
+ info "Publishing tag: #{production_tag}"
27
+ CapGitTags::Helper.publish_tag production_tag
28
+ end
29
+
30
+ set :branch, production_tag
31
+ elsif current_stage == :staging
32
+ # Staging deploys create a new tag based on user input
33
+ time = Time.new
34
+
35
+ ask :a_description_of_what_you_are_deploying, "latest changes"
36
+
37
+ safe_tag = fetch(:a_description_of_what_you_are_deploying).downcase.gsub(/[^a-z0-9]/, "-")
38
+ staging_tag = "staging-#{time.year}-#{time.month}-#{time.day}-#{time.hour}-#{time.min}-#{safe_tag}"
39
+
40
+ info "Publishing tag: #{staging_tag}"
41
+ CapGitTags::Helper.publish_tag staging_tag
42
+
43
+ info "Deploying: #{staging_tag} to staging"
44
+ set :branch, staging_tag
11
45
  else
12
- latest_staging_tag = `git describe --match "staging*" --abbrev=4 HEAD`.chomp
13
- production_tag = latest_staging_tag.sub(/^staging/, "production")
14
- end
15
-
16
- info "You are about to deploy: #{latest_staging_tag} to production"
17
- ask :yes_to_confirm_deploy, "n"
18
-
19
- if fetch(:yes_to_confirm_deploy)[0].downcase != "y"
20
- abort "You didn't confirm the deployment"
21
- end
22
-
23
- unless ENV['TAG']
24
- info "Publishing tag: #{production_tag}"
25
- CapGitTags::Helper.publish_tag production_tag
46
+ # dev environments allow any branch to be pushed and don't create a tag
47
+ info "About to deploy your current branch, enter a different branch name to override"
48
+ ask :branch, proc { CapGitTags::Helper.current_branch }
26
49
  end
27
-
28
- set :branch, production_tag
29
- elsif current_stage == :staging
30
- # Staging deploys create a new tag based on user input
31
- time = Time.new
32
-
33
- ask :a_description_of_what_you_are_deploying, "latest changes"
34
-
35
- safe_tag = fetch(:a_description_of_what_you_are_deploying).downcase.gsub(/[^a-z0-9]/, "-")
36
- staging_tag = "staging-#{time.year}-#{time.month}-#{time.day}-#{time.hour}-#{time.min}-#{safe_tag}"
37
-
38
- info "Publishing tag: #{staging_tag}"
39
- CapGitTags::Helper.publish_tag staging_tag
40
-
41
- info "Deploying: #{staging_tag} to staging"
42
- set :branch, staging_tag
43
- else
44
- # dev environments allow any branch to be pushed and don't create a tag
45
- info "About to deploy your current branch, enter a different branch name to override"
46
- ask :branch, proc { CapGitTags::Helper.current_branch }
47
50
  end
48
51
  end
49
52
  end
50
53
 
51
- before :updating, :create_tag
54
+ before 'deploy:starting', 'gittags:create_tag'
52
55
  end
@@ -1,3 +1,3 @@
1
1
  module CapGitTags
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-git-tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Hawkins
@@ -15,28 +15,28 @@ dependencies:
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.3'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.3'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  description: This is a capistrano 3 plugin for auto tagging your git deploys.
@@ -47,12 +47,13 @@ executables: []
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
- - .gitignore
50
+ - ".gitignore"
51
51
  - Gemfile
52
52
  - LICENSE.txt
53
53
  - README.md
54
54
  - Rakefile
55
55
  - cap-git-tags.gemspec
56
+ - changelog.md
56
57
  - lib/cap-git-tags.rb
57
58
  - lib/cap-git-tags/tasks/git_tags.rake
58
59
  - lib/cap-git-tags/version.rb
@@ -66,17 +67,17 @@ require_paths:
66
67
  - lib
67
68
  required_ruby_version: !ruby/object:Gem::Requirement
68
69
  requirements:
69
- - - '>='
70
+ - - ">="
70
71
  - !ruby/object:Gem::Version
71
72
  version: '0'
72
73
  required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  requirements:
74
- - - '>='
75
+ - - ">="
75
76
  - !ruby/object:Gem::Version
76
77
  version: '0'
77
78
  requirements: []
78
79
  rubyforge_project:
79
- rubygems_version: 2.0.3
80
+ rubygems_version: 2.2.2
80
81
  signing_key:
81
82
  specification_version: 4
82
83
  summary: Auto tags staging and production deploys for git projects