capistrano-maintenance 1.1.0 → 1.2.0

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: 25477cc88ca901a2e817c8af7a006b16a1f33b3d
4
- data.tar.gz: bbd59d8cfb1b4e27ca887ee44b3cb5bf6df3a16a
3
+ metadata.gz: 6715cb21f27cd1be81fc54884fc95c01ba678a42
4
+ data.tar.gz: 2ef524d1e52972161859d263c89bb30babd60731
5
5
  SHA512:
6
- metadata.gz: 5aa9f2219c5bedad52d41a5f89809335e4da43037cc2a14113a92d1588c390dca0fab6915b8ec33b8caaa5062cc3a9e0ef980d37a2261489522235f015882111
7
- data.tar.gz: 608e2fcb177320e6bf7be54a8e8307afc26fac11e6d14f48fd4328b7ef35228fe09002c75c0e66a2d89f8063375e7f34c0908914538a243b36b7d68b7ebd4116
6
+ metadata.gz: 0645b1a1bac92fb1be978303183b67d5040ce6e6a69bc273766cdb63bbf2407d7c17ad74f5d67dfe541b779c986ab8ca67b79a0933be48746c7f2f52a8077f1c
7
+ data.tar.gz: acf2b89d61e45f500c6dd709a9292583e38633d529e32e152b14d416f7743d9ec3929f5c808623ae048279282563b60bbc08e1d1c21d3bc9ad8670eba596406e
@@ -0,0 +1,6 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v '~> 1.14' --conservative
6
+ before_script: bundle exec danger
@@ -4,10 +4,16 @@ Reverse chronological order:
4
4
 
5
5
  ## master
6
6
 
7
- https://github.com/capistrano/capistrano-maintenance/compare/v1.1.0...HEAD
7
+ https://github.com/capistrano/capistrano-maintenance/compare/v1.2.0...HEAD
8
8
 
9
9
  * Your contribution here!
10
10
 
11
+ ## `1.2.0` (2017-03-10)
12
+
13
+ https://github.com/capistrano/capistrano-maintenance/compare/v1.1.0...v1.2.0
14
+
15
+ * [#40](https://github.com/capistrano/maintenance/pull/40): Allow directory of maintenance page to be customized - [@tjwallace](https://github.com/tjwallace)
16
+
11
17
  ## `1.1.0` (2017-01-26)
12
18
 
13
19
  https://github.com/capistrano/capistrano-maintenance/compare/v1.0.0...v1.1.0
@@ -0,0 +1 @@
1
+ danger.import_dangerfile(github: "capistrano/danger")
data/README.md CHANGED
@@ -89,7 +89,7 @@ cap maintenance:enable REASON="hardware upgrade" UNTIL="12pm Central Time"
89
89
  ```
90
90
 
91
91
  You can use a different template for the maintenance page by setting the
92
- `:maintenance_template_path` variable in your deploy.rb file with an absolute path.
92
+ `:maintenance_template_path` variable in your deploy.rb file with an absolute path.
93
93
 
94
94
  ```
95
95
  set :maintenance_template_path, File.expand_path("../../app/path/to/maintenance.erb.html", __FILE__)
@@ -125,6 +125,14 @@ The template file should either be a plaintext or an erb file. For example:
125
125
  </html>
126
126
  ```
127
127
 
128
+ You can customize which folder the maintenance page template is rendered to by
129
+ setting the `:maintenance_dirname` variable. By default it renders to
130
+ `"#{shared_path}/public/system"`.
131
+
132
+ ```
133
+ set :maintenance_dirname, -> { "#{current_path}/dist" }
134
+ ```
135
+
128
136
  By default, the maintenance page will be uploaded to all servers with the `web` role,
129
137
  but if your application has different needs, you can customize this using the
130
138
  `maintenance_roles` variable:
data/Rakefile CHANGED
@@ -1 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ # Do nothing by default
4
+ task :default
@@ -21,5 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "capistrano", ">= 3.0"
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "danger"
24
25
  spec.add_development_dependency "rake"
25
26
  end
@@ -1,3 +1,3 @@
1
1
  module CapistranoMaintenance
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -1,33 +1,42 @@
1
1
  namespace :maintenance do
2
2
  desc "Turn on maintenance mode"
3
3
  task :enable do
4
- on fetch(:maintenance_roles, roles(:web)) do
4
+ on fetch(:maintenance_roles) do
5
5
  require 'erb'
6
6
 
7
7
  reason = ENV['REASON']
8
8
  deadline = ENV['UNTIL']
9
9
 
10
- default_template = File.join(File.expand_path('../../templates', __FILE__), 'maintenance.html.erb')
11
- template = fetch(:maintenance_template_path, default_template)
12
- result = ERB.new(File.read(template)).result(binding)
10
+ result = ERB.new(File.read(fetch(:maintenance_template_path))).result(binding)
13
11
 
14
- rendered_path = "#{shared_path}/public/system/"
15
- rendered_name = "#{fetch(:maintenance_basename, 'maintenance')}.html"
12
+ rendered_path = fetch(:maintenance_dirname)
13
+ rendered_name = "#{fetch(:maintenance_basename)}.html"
16
14
 
17
15
  if test "[ ! -d #{rendered_path} ]"
18
16
  info 'Creating missing directories.'
19
17
  execute :mkdir, '-pv', rendered_path
20
18
  end
21
19
 
22
- upload!(StringIO.new(result), rendered_path + rendered_name)
23
- execute "chmod 644 #{rendered_path + rendered_name}"
20
+ rendered_fullpath = "#{rendered_path}/#{rendered_name}"
21
+ upload! StringIO.new(result), rendered_fullpath
22
+ execute "chmod 644 #{rendered_fullpath}"
24
23
  end
25
24
  end
26
25
 
27
26
  desc "Turn off maintenance mode"
28
27
  task :disable do
29
- on fetch(:maintenance_roles, roles(:web)) do
30
- execute "rm -f #{shared_path}/public/system/#{fetch(:maintenance_basename, 'maintenance')}.html"
28
+ on fetch(:maintenance_roles) do
29
+ execute "rm -f #{fetch(:maintenance_dirname)}/#{fetch(:maintenance_basename)}.html"
31
30
  end
32
31
  end
33
32
  end
33
+
34
+ namespace :load do
35
+ task :defaults do
36
+ set_if_empty :maintenance_roles, -> { roles(:web) }
37
+ set_if_empty :maintenance_template_path,
38
+ File.join(File.expand_path('../../templates', __FILE__), 'maintenance.html.erb')
39
+ set_if_empty :maintenance_dirname, -> { "#{shared_path}/public/system" }
40
+ set_if_empty :maintenance_basename, 'maintenance'
41
+ end
42
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-maintenance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kir Shatrov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-26 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: danger
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -60,7 +74,9 @@ extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
76
  - ".gitignore"
77
+ - ".travis.yml"
63
78
  - CHANGELOG.md
79
+ - Dangerfile
64
80
  - Gemfile
65
81
  - LICENSE.txt
66
82
  - README.md
@@ -90,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
106
  version: '0'
91
107
  requirements: []
92
108
  rubyforge_project:
93
- rubygems_version: 2.6.8
109
+ rubygems_version: 2.6.10
94
110
  signing_key:
95
111
  specification_version: 4
96
112
  summary: Enable and disabled tasks to show when your project is on maintenance