maintenance 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in maintenance.gemspec
4
+ gemspec
File without changes
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ namespace :deploy do
2
+
3
+ desc "enable the web app (take out of maintenance)"
4
+ task :enable, :roles => :web do
5
+ run "rm #{shared_path}/current/public/maintenance.html"
6
+ end
7
+
8
+
9
+ desc "disable the web app (put in maintenance)"
10
+ task :disable, :roles => :web do
11
+ run "cp #{deploy_to}/current/public/maintenance.html #{shared_path}/maintenance.html"
12
+ end
13
+
14
+ end
@@ -0,0 +1,2 @@
1
+ require "maintenance/version"
2
+ require "maintenance/engine"
@@ -0,0 +1,34 @@
1
+ module Maintenance
2
+
3
+ class Engine < Rails::Engine
4
+
5
+ MyEngine::Engine.routes.draw do
6
+ constraints MaintenanceMode do
7
+ constraints IpRestrictor do
8
+ match "*a" => "static#maintenance"
9
+ end
10
+ end
11
+ end
12
+
13
+ end
14
+
15
+
16
+ class IpRestrictor
17
+
18
+ def initialize(ip_addresses = {})
19
+ @ip_addresses = ip_addresses
20
+ end
21
+
22
+ def self.matches?(request)
23
+ request.ip =~ /127.0.0.1/
24
+ end
25
+ end
26
+
27
+
28
+ class MaintenanceMode
29
+ def self.matches?(request)
30
+ FileTest.exist?("maintenance.html")
31
+ end
32
+ end
33
+
34
+ end
@@ -0,0 +1,3 @@
1
+ module Maintenance
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "maintenance/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "maintenance"
7
+ s.version = Maintenance::VERSION
8
+ s.authors = ["ready4god2513"]
9
+ s.email = ["brandonh@ibethel.org"]
10
+ s.homepage = ""
11
+ s.summary = %q{Maintenance Mode Simplified with Capistrano}
12
+ s.description = %q{Use this gem, capistrano, and a few config settings in apache/nginx for easy maintenance mode}
13
+
14
+ s.rubyforge_project = "maintenance"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency "capistrano"
22
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: maintenance
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - ready4god2513
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &70295823117100 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70295823117100
25
+ description: Use this gem, capistrano, and a few config settings in apache/nginx for
26
+ easy maintenance mode
27
+ email:
28
+ - brandonh@ibethel.org
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - Gemfile
35
+ - README.md
36
+ - Rakefile
37
+ - config/deploy.rb
38
+ - lib/maintenance.rb
39
+ - lib/maintenance/maintenance_engine.rb
40
+ - lib/maintenance/version.rb
41
+ - maintenance.gemspec
42
+ homepage: ''
43
+ licenses: []
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project: maintenance
62
+ rubygems_version: 1.8.6
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: Maintenance Mode Simplified with Capistrano
66
+ test_files: []