capistrano-commit 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 174b330b4b204a0afeae1709b32ff9817bcf6ef7
4
+ data.tar.gz: 771b26f1b266d1760541ea520e663bc850ef2411
5
+ SHA512:
6
+ metadata.gz: 367cf5fc2a01af0d1f7085046163617b53d63fc89bb5137725c0cac3d02f1025921cf0c38ae006f059206f7d6b4b32b2bb52ac312c0b1d03143b6822b0cd708b
7
+ data.tar.gz: 4b3f8fd0ddbaddd83659ece8836d3c0527da81c6976d22a45e9e3cac2a9ea0e73b07af66c0f291ffd6a72bad77a026a031d344860c2830504a1b2c69b3e8ce40
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-pending.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Igor Gonchar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # capistrano-commit
2
+
3
+ Save information about deployed revisions into database.
4
+
5
+ Each time after deploying of your application through capistrano (3+) - [host, revision, timestamps] will be stored
6
+ into table capistrano_commits.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'capistrano-commit'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install capistrano-commit
21
+
22
+ ## Usage
23
+
24
+ Add below to Capfile:
25
+
26
+ require 'capistrano/commit/caps'
27
+
28
+ and to deploy.rb:
29
+
30
+ after 'deploy:publishing', 'deploy:commit:save'
31
+
32
+ ## TODO
33
+
34
+ 1. Current version control branch
35
+ 2. Config files
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( https://github.com/gigorok/capistrano-commit/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/commit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-commit"
8
+ spec.version = Capistrano::Commit::VERSION
9
+ spec.authors = ["Igor Gonchar"]
10
+ spec.email = ["igor.gonchar@gmail.com"]
11
+ spec.summary = %q{Save information about deployed revisions into database.}
12
+ spec.homepage = "https://github.com/gigorok/capistrano-commit"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "capistrano", ">= 3.2.0"
21
+ spec.add_dependency "activerecord"
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,38 @@
1
+ namespace :deploy do
2
+ namespace :commit do
3
+
4
+ desc <<-DESC
5
+ Save information about deployed revisions into database.
6
+ DESC
7
+ task :save do
8
+ on roles(fetch(:capistrano_commit_role, :app)) do |host|
9
+
10
+ invoke 'deploy:set_current_revision'
11
+ rev = fetch(:current_revision)
12
+
13
+ info "Host: #{host}, Revision: #{rev}"
14
+
15
+ within current_path do
16
+ with rails_env: fetch(:rails_env) do
17
+ execute :rake, 'capistrano:commit:save', "HOST=#{host}", "REVISION=#{rev}"
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+
24
+ desc <<-DESC
25
+ Show information about deployed revisions.
26
+ DESC
27
+ task :show do
28
+ on roles(fetch(:capistrano_commit_role, :app)) do |host|
29
+
30
+ invoke 'deploy:set_current_revision'
31
+ rev = fetch(:current_revision)
32
+
33
+ info "Host: #{host}, Revision: #{rev}"
34
+ end
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1 @@
1
+ load 'capistrano/commit/caps/commit.cap'
@@ -0,0 +1,9 @@
1
+ module Capistrano
2
+ module Commit
3
+ class Railtie < Rails::Railtie
4
+ rake_tasks do
5
+ load 'tasks/commit.rake'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Commit
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ module Capistrano
2
+ module Commit
3
+ require 'capistrano/commit/version'
4
+ require 'capistrano/commit/railtie' if defined?(Rails)
5
+ end
6
+ end
7
+
8
+
@@ -0,0 +1 @@
1
+ require "capistrano/commit"
@@ -0,0 +1,26 @@
1
+ namespace :capistrano do
2
+
3
+ namespace :commit do
4
+ desc 'Save current host revision'
5
+ task :save => :environment do
6
+
7
+ m = ActiveRecord::Migration.new
8
+ unless m.table_exists?(:capistrano_commits)
9
+ m.create_table :capistrano_commits do |t|
10
+ t.string :host
11
+ t.string :revision
12
+ t.timestamps
13
+ end
14
+ end
15
+
16
+ class CapistranoCommit < ActiveRecord::Base
17
+ self.table_name = :capistrano_commits
18
+ end
19
+
20
+ CapistranoCommit.create(host: ENV['HOST'], revision: ENV['REVISION'])
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-commit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Igor Gonchar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: activerecord
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - igor.gonchar@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - capistrano-commit.gemspec
82
+ - lib/capistrano-commit.rb
83
+ - lib/capistrano/commit.rb
84
+ - lib/capistrano/commit/caps.rb
85
+ - lib/capistrano/commit/caps/commit.cap
86
+ - lib/capistrano/commit/railtie.rb
87
+ - lib/capistrano/commit/version.rb
88
+ - lib/tasks/commit.rake
89
+ homepage: https://github.com/gigorok/capistrano-commit
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.4.7
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Save information about deployed revisions into database.
113
+ test_files: []