capistrano-deployinfo 0.0.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dcb10ef67641c7f288c866c637832c093b005ed3
4
+ data.tar.gz: 3d382dbe35e0e5367f2cfe9da034d9456ccdda12
5
+ SHA512:
6
+ metadata.gz: f447703469d7395df57058fb40fbbc1bac75b586559ab5a66dd09d0fff4a5ca98c7b7ce3bcc1696d4ac38e34fed9b44c54ff939b397696089a1a5cee292e0ba7
7
+ data.tar.gz: 0c4c9b39629c3dd15af02517c0b5a7dc53052abe75641572afd45ec298d08a9e0f9976ca46f9b1e00070b85116cfba78f6c28f355f78a43e24361854282e7968
data/README.md CHANGED
@@ -1,24 +1,48 @@
1
1
  # Capistrano::Deployinfo
2
2
 
3
- TODO: Write a gem description
3
+ A Capistrano extension that writes information about the deploy to a JSON file in a public spot. This is intended to quickly answer the question "What's on production?"
4
+
4
5
 
5
6
  ## Installation
6
7
 
7
8
  Add this line to your application's Gemfile:
8
9
 
9
- gem 'capistrano-deployinfo'
10
+ gem 'capistrano', '~> 3.1'
11
+ gem 'capistrano-deployinfo', '~> 1.0'
10
12
 
11
13
  And then execute:
12
14
 
13
- $ bundle
15
+ $ bundle install
16
+
17
+ ## Usage
14
18
 
15
- Or install it yourself as:
19
+ # Capfile
20
+ require 'capistrano/deployinfo'
16
21
 
17
- $ gem install capistrano-deployinfo
18
22
 
19
- ## Usage
23
+ # config/deploy.rb
24
+ set :deployinfo_roles, :all # default value
25
+ set :deployinfo_dir, 'public' # default value
26
+ set :deployinfo_filename, 'deploy.json' # default value
27
+
28
+ ## Configs
29
+
30
+ * `deployinfo_roles` which roles to generate the deploy info file
31
+ * `deployinfo_dir` the directory to place the deploy info file
32
+ * `deployinfo_filename` what to name the deploy info file
33
+
34
+ ## Example deploy.json
20
35
 
21
- TODO: Write usage instructions here
36
+ ```json
37
+ {
38
+ app: "my-app",
39
+ deployed_at: "2014-02-26 00:25:33 -0500",
40
+ branch: "master",
41
+ user: "bob",
42
+ sha: "7cf044f",
43
+ release: "20140226052444"
44
+ }
45
+ ```
22
46
 
23
47
  ## Contributing
24
48
 
@@ -1,11 +1,10 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'capistrano-deployinfo/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "capistrano-deployinfo"
8
- spec.version = CapistranoDeployInfo::VERSION
7
+ spec.version = '1.0.0'
9
8
  spec.authors = ["Bob Breznak"]
10
9
  spec.email = ["bob.breznak@gmail.com"]
11
10
  spec.description = %q{Capistrano tasks that write information about deploy into a project for quick referenceCapistrano tasks that write information about deploy into a project for quick reference.}
@@ -17,8 +16,8 @@ Gem::Specification.new do |spec|
17
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
17
  spec.require_paths = ["lib"]
19
18
 
20
- spec.add_development_dependency "bundler", "~> 1.3"
21
- spec.add_development_dependency "rake"
19
+ spec.add_development_dependency 'bundler', '~> 1.3'
20
+ spec.add_development_dependency 'rake'
22
21
 
23
- spec.add_runtime_dependency 'capistrano'
22
+ spec.add_dependency 'capistrano', '~> 3.1'
24
23
  end
@@ -1,2 +1 @@
1
- require 'capistrano-deployinfo/version'
2
- require 'capistrano-deployinfo/capistrano_integration'
1
+
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/deployinfo.rake", __FILE__)
@@ -0,0 +1,29 @@
1
+ namespace :deploy do
2
+ task :write_info do
3
+ on roles(fetch(:deployinfo_roles)) do
4
+ within fetch(:deployinfo_path) do
5
+
6
+ tag = { app: fetch(:application),
7
+ deployed_at: Time.now,
8
+ branch: fetch(:branch),
9
+ user: local_user.strip,
10
+ sha: fetch(:current_revision),
11
+ release: release_timestamp }
12
+
13
+ tag_path = current_path.join(fetch(:deployinfo_dir), fetch(:deployinfo_filename))
14
+
15
+ execute %{echo '#{tag.to_json}' > #{tag_path}}
16
+ end
17
+ end
18
+ end
19
+
20
+ after 'deploy:published', 'deploy:write_info'
21
+ end
22
+
23
+ namespace :load do
24
+ task :defaults do
25
+ set :deployinfo_roles, :all
26
+ set :deployinfo_dir, 'public'
27
+ set :deployinfo_filename, 'deploy.json'
28
+ end
29
+ end
metadata CHANGED
@@ -1,64 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-deployinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bob Breznak
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2014-02-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: capistrano
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '0'
47
+ version: '3.1'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: '0'
54
+ version: '3.1'
62
55
  description: Capistrano tasks that write information about deploy into a project for
63
56
  quick referenceCapistrano tasks that write information about deploy into a project
64
57
  for quick reference.
@@ -68,7 +61,7 @@ executables: []
68
61
  extensions: []
69
62
  extra_rdoc_files: []
70
63
  files:
71
- - .gitignore
64
+ - ".gitignore"
72
65
  - Gemfile
73
66
  - LICENSE.txt
74
67
  - README.md
@@ -76,31 +69,31 @@ files:
76
69
  - capistrano-deployinfo.gemspec
77
70
  - lib/.ruby-version
78
71
  - lib/capistrano-deployinfo.rb
79
- - lib/capistrano-deployinfo/capistrano_integration.rb
80
- - lib/capistrano-deployinfo/version.rb
72
+ - lib/capistrano/deployinfo.rb
73
+ - lib/capistrano/tasks/deployinfo.rake
81
74
  homepage: ''
82
75
  licenses:
83
76
  - MIT
77
+ metadata: {}
84
78
  post_install_message:
85
79
  rdoc_options: []
86
80
  require_paths:
87
81
  - lib
88
82
  required_ruby_version: !ruby/object:Gem::Requirement
89
- none: false
90
83
  requirements:
91
- - - ! '>='
84
+ - - ">="
92
85
  - !ruby/object:Gem::Version
93
86
  version: '0'
94
87
  required_rubygems_version: !ruby/object:Gem::Requirement
95
- none: false
96
88
  requirements:
97
- - - ! '>='
89
+ - - ">="
98
90
  - !ruby/object:Gem::Version
99
91
  version: '0'
100
92
  requirements: []
101
93
  rubyforge_project:
102
- rubygems_version: 1.8.23
94
+ rubygems_version: 2.2.0
103
95
  signing_key:
104
- specification_version: 3
96
+ specification_version: 4
105
97
  summary: Cap tasks to generate static deploy info files.
106
98
  test_files: []
99
+ has_rdoc:
@@ -1,46 +0,0 @@
1
- require 'capistrano'
2
- require 'rubygems'
3
- require 'json'
4
- require 'capistrano/version'
5
-
6
- module CapistranoDeployInfo
7
- class CapistranoIntegration
8
- def self.load_into(capistrano_config)
9
-
10
- capistrano_config.load do
11
- def setup_current_ref
12
- sha = ''
13
- run "cat #{latest_release}/REVISION" do |c, s, d|
14
- sha = d.strip
15
- end
16
- set :ref, sha
17
- end
18
-
19
- namespace :deploy do
20
- task :writeinfo do
21
- setup_current_ref
22
-
23
- cache_path = "#{shared_path}/cached-copy"
24
-
25
- tag = { :app => application,
26
- :user => ENV['USER'],
27
- :deployed_at => Time.now,
28
- :branch => branch,
29
- :ruby => capture("ruby -v").strip,
30
- :ref => ref }
31
- from = source.next_revision(previous_revision)
32
- log = capture("cd #{cache_path} && #{source.local.log(from)} --pretty=oneline | grep 'Merge pull'; true").gsub("'", "''")
33
- log = '<< NO RELEASE NOTES AVAILABLE >>' if log.empty?
34
- run "echo '#{log}' > #{release_path}/public/release_notes.txt"
35
- run "echo '#{tag.to_json}' > #{latest_release}/public/deploy.json"
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
42
-
43
-
44
- if Capistrano::Configuration.instance
45
- CapistranoDeployInfo::CapistranoIntegration.load_into(Capistrano::Configuration.instance)
46
- end
@@ -1,3 +0,0 @@
1
- module CapistranoDeployInfo
2
- VERSION = "0.0.2"
3
- end