vlad-version 0.0.1
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +81 -0
- data/Rakefile +1 -0
- data/lib/vlad/version/version.rb +5 -0
- data/lib/vlad/version.rb +34 -0
- data/vlad-version.gemspec +20 -0
- metadata +55 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 J. Andrew Marshall <http://johnandrewmarshall.com>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# Vlad Version
|
2
|
+
|
3
|
+
Vlad tasks for creating a version file and version tag upon deploy so it’s
|
4
|
+
seamless and easy to keep track of what is deployed where.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'vlad-version', :require => false
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install vlad-version
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Then add to your `config/deploy.rb`:
|
23
|
+
|
24
|
+
require 'vlad/version'
|
25
|
+
|
26
|
+
Two tasks are provided that you can add into your existing deploy task(s):
|
27
|
+
|
28
|
+
- `vlad:version:file` which creates a file in
|
29
|
+
`#{shared_path}/#{version_file_path}` with the date of the deploy and the Git
|
30
|
+
revision deployed.
|
31
|
+
- `vlad:version:tag` which creates a Git tag with the name
|
32
|
+
`#{environment}_#{release_time}` containing the environment deployed to, time
|
33
|
+
of deploy, and who deployed.
|
34
|
+
|
35
|
+
The following variables are available:
|
36
|
+
|
37
|
+
<table>
|
38
|
+
<thead>
|
39
|
+
<tr>
|
40
|
+
<th>Variable</th>
|
41
|
+
<th>Default value</th>
|
42
|
+
</tr>
|
43
|
+
</thead>
|
44
|
+
<tbody>
|
45
|
+
<tr>
|
46
|
+
<td><code>release_time</code></td>
|
47
|
+
<td><code>Time.now.utc</code></td>
|
48
|
+
</tr>
|
49
|
+
<tr>
|
50
|
+
<td><code>sign_version_tag</code></td>
|
51
|
+
<td><code>false</code></td>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<td><code>version_file_path</code></td>
|
55
|
+
<td><code>"/system/version.txt"</code></td>
|
56
|
+
</tr>
|
57
|
+
</tbody>
|
58
|
+
</table>
|
59
|
+
|
60
|
+
In order to ensure `release_time` is consistent with Vlad’s `release_name`,
|
61
|
+
`release_name` is set to `release_time.strftime('%Y%m%d%H%M%S')`, which
|
62
|
+
maintains the same format as Vlad’s default. If you override `release_name` to
|
63
|
+
another time-based format, you should use `release_time` as your source time to maintain consistency.
|
64
|
+
|
65
|
+
If the `environment` variable is set in your deploy configuration, it will be prefixed onto the Git tag name.
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
Contributions are welcome. Please be sure that your pull requests are atomic
|
70
|
+
so they can be considered and accepted separately.
|
71
|
+
|
72
|
+
1. Fork it
|
73
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
74
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
75
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
76
|
+
5. Create new Pull Request
|
77
|
+
|
78
|
+
## Credits & License
|
79
|
+
|
80
|
+
Copyright © 2012 J. Andrew Marshall. All rights reserved.
|
81
|
+
License is available in the LICENSE file.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/lib/vlad/version.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
set :release_time, Time.now.utc
|
2
|
+
set :sign_version_tag, false
|
3
|
+
set :version_file_path, '/system/version.txt'
|
4
|
+
|
5
|
+
set :release_name, release_time.strftime('%Y%m%d%H%M%S')
|
6
|
+
set :shared_paths, { 'system' => 'public/system' }.merge(shared_paths)
|
7
|
+
|
8
|
+
namespace :vlad do
|
9
|
+
namespace :version do
|
10
|
+
remote_task :file, roles: :app do
|
11
|
+
commit_cmd = "cd #{scm_path}/repo && git rev-parse HEAD"
|
12
|
+
run "echo '#{release_time.iso8601}': $(#{commit_cmd}) > #{shared_path}/#{version_file_path}"
|
13
|
+
end
|
14
|
+
|
15
|
+
task :tag do
|
16
|
+
defined? environment or environment = nil
|
17
|
+
time_str = release_time.iso8601.tr(':', '-')
|
18
|
+
tag_name = [environment, time_str].compact.join('_')
|
19
|
+
tag_message = [
|
20
|
+
'Tag auto-generated on deploy. About this deploy:',
|
21
|
+
"Environment: #{environment}",
|
22
|
+
"Time: #{time_str}",
|
23
|
+
"Deployer: #{`whoami`.strip}@#{`hostname`.strip}"
|
24
|
+
].join("\n")
|
25
|
+
|
26
|
+
system ['git tag',
|
27
|
+
('-s' if sign_version_tag),
|
28
|
+
"-m '#{tag_message}'",
|
29
|
+
tag_name,
|
30
|
+
revision,
|
31
|
+
'&& git push --tags'].compact.join(' ')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vlad/version/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = 'vlad-version'
|
8
|
+
gem.version = Vlad::Version::VERSION
|
9
|
+
gem.authors = ['Andrew Marshall']
|
10
|
+
gem.email = ['andrew@johnandrewmarshall.com']
|
11
|
+
gem.description = %q{Vlad tasks for creating a version file & tag}
|
12
|
+
gem.summary = %q{Vlad tasks for creating a version file & tag}
|
13
|
+
gem.homepage = 'http://johnandrewmarshall.com/projects/vlad-version'
|
14
|
+
gem.license = 'MIT'
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ['lib']
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vlad-version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andrew Marshall
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-24 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Vlad tasks for creating a version file & tag
|
15
|
+
email:
|
16
|
+
- andrew@johnandrewmarshall.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/vlad/version.rb
|
27
|
+
- lib/vlad/version/version.rb
|
28
|
+
- vlad-version.gemspec
|
29
|
+
homepage: http://johnandrewmarshall.com/projects/vlad-version
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.8.24
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: Vlad tasks for creating a version file & tag
|
54
|
+
test_files: []
|
55
|
+
has_rdoc:
|