capistrano-custom-maintenance 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -48,6 +48,8 @@ Following options are available to manage your maintenance.
48
48
  * `:maintenance_system_path` - the path to the maintenance page.
49
49
  * `:maintenance_template_path` - the path to the maintenance templates.
50
50
  * `:maintenance_template` - the path to the template of maintenance page.
51
+ * `:maintenance_input_encoding` - encoding of maintenance page template. use system encoding by default.
52
+ * `:maintenance_output_encoding` - encoding of result maintenance page. use system encoding by default.
51
53
 
52
54
  ## Contributing
53
55
 
@@ -55,8 +55,21 @@ module Capistrano
55
55
 
56
56
  reason = maintenance_reason
57
57
  deadline = maintenance_deadline
58
- template = File.read(maintenance_template)
59
- result = ERB.new(template).result(binding)
58
+
59
+ begin
60
+ ic = fetch(:maintenance_input_encoding, nil)
61
+ template = File.read(maintenance_template, :external_encoding => ic)
62
+ rescue
63
+ template = File.read(maintenance_template)
64
+ end
65
+
66
+ _result = ERB.new(template).result(binding)
67
+ begin
68
+ oc = fetch(:maintenance_output_encoding, nil)
69
+ result = oc ? _result.encode(oc) : _result
70
+ rescue
71
+ result = _result
72
+ end
60
73
 
61
74
  put(result, maintenance_system_path, :mode => 0644)
62
75
  }
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module CustomMaintenance
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-custom-maintenance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-29 00:00:00.000000000 Z
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -102,4 +102,3 @@ signing_key:
102
102
  specification_version: 3
103
103
  summary: a customizable capistrano maintenance recipe.
104
104
  test_files: []
105
- has_rdoc: