rehearsal 0.9.2 → 1.0.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.
- data/lib/generators/rehearsal/initializer/initializer_generator.rb +9 -0
- data/lib/generators/rehearsal/initializer/templates/initializer.rb +4 -0
- data/lib/rehearsal/configuration.rb +9 -0
- data/lib/rehearsal/engine.rb +1 -0
- data/lib/rehearsal/version.rb +1 -1
- data/lib/rehearsal/view_helpers.rb +4 -4
- data/lib/rehearsal.rb +18 -4
- data/rehearsal.gemspec +4 -2
- data/vendor/assets/stylesheets/rehearsal.css.scss +1 -1
- metadata +28 -10
- data/.gitignore +0 -16
- data/.rvmrc +0 -1
- data/Gemfile +0 -4
- data/LICENSE +0 -22
- data/README.md +0 -62
- data/Rakefile +0 -2
data/lib/rehearsal/engine.rb
CHANGED
data/lib/rehearsal/version.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Rehearsal
|
2
2
|
module ViewHelpers
|
3
|
-
def
|
4
|
-
return unless
|
3
|
+
def rehearsal_banner(options = {})
|
4
|
+
return unless rehearsing?
|
5
5
|
|
6
|
-
content_tag :div, :id => 'rehearsal-
|
6
|
+
content_tag :div, :id => 'rehearsal-banner' do
|
7
7
|
options[:message] || default_message
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
12
|
def default_message
|
13
|
-
'This is your
|
13
|
+
'This is your rehearsal banner. Override this text with the :message option.'
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/rehearsal.rb
CHANGED
@@ -4,7 +4,7 @@ require "rehearsal/engine"
|
|
4
4
|
module Rehearsal
|
5
5
|
def self.included(base)
|
6
6
|
base.extend ClassMethods
|
7
|
-
base.helper_method :
|
7
|
+
base.helper_method :rehearsing?
|
8
8
|
base.before_filter :require_http_basic_auth
|
9
9
|
end
|
10
10
|
|
@@ -22,14 +22,28 @@ module Rehearsal
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
class << self
|
26
|
+
def configure
|
27
|
+
yield(config)
|
28
|
+
end
|
29
|
+
|
30
|
+
def config=(config_instance)
|
31
|
+
@config = config_instance
|
32
|
+
end
|
33
|
+
|
34
|
+
def config
|
35
|
+
@config ||= Configuration.new
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
25
39
|
private
|
26
40
|
def require_http_basic_auth
|
27
41
|
authenticate_or_request_with_http_basic do |username, password|
|
28
42
|
username == self.username && password == self.password
|
29
|
-
end if
|
43
|
+
end if rehearsing?
|
30
44
|
end
|
31
45
|
|
32
|
-
def
|
33
|
-
Rails.env.
|
46
|
+
def rehearsing?
|
47
|
+
Rails.env.to_sym == Rehearsal.config.env
|
34
48
|
end
|
35
49
|
end
|
data/rehearsal.gemspec
CHANGED
@@ -8,10 +8,12 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = %q{Easy HTTP Basic Auth for Staging Rails Apps}
|
9
9
|
gem.homepage = ""
|
10
10
|
|
11
|
-
gem.files = `git ls-files`.split(
|
11
|
+
gem.files = `git ls-files -- {lib/*,vendor/*,*.gemspec}`.split("\n")
|
12
|
+
gem.require_paths = ["lib"]
|
12
13
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
14
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
15
|
gem.name = "rehearsal"
|
15
|
-
gem.require_paths = ["lib", "vendor"]
|
16
16
|
gem.version = Rehearsal::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'rails', '>= 3.0.0', '< 4.0.0'
|
17
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rehearsal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-12-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
- - <
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 4.0.0
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.0
|
33
|
+
- - <
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 4.0.0
|
14
36
|
description: Quickly add Staging Env. HTTP basic auth to your project
|
15
37
|
email:
|
16
38
|
- joe@neotericdesign.com
|
@@ -18,13 +40,10 @@ executables: []
|
|
18
40
|
extensions: []
|
19
41
|
extra_rdoc_files: []
|
20
42
|
files:
|
21
|
-
- .
|
22
|
-
- .
|
23
|
-
- Gemfile
|
24
|
-
- LICENSE
|
25
|
-
- README.md
|
26
|
-
- Rakefile
|
43
|
+
- lib/generators/rehearsal/initializer/initializer_generator.rb
|
44
|
+
- lib/generators/rehearsal/initializer/templates/initializer.rb
|
27
45
|
- lib/rehearsal.rb
|
46
|
+
- lib/rehearsal/configuration.rb
|
28
47
|
- lib/rehearsal/engine.rb
|
29
48
|
- lib/rehearsal/version.rb
|
30
49
|
- lib/rehearsal/view_helpers.rb
|
@@ -36,7 +55,6 @@ post_install_message:
|
|
36
55
|
rdoc_options: []
|
37
56
|
require_paths:
|
38
57
|
- lib
|
39
|
-
- vendor
|
40
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
59
|
none: false
|
42
60
|
requirements:
|
data/.gitignore
DELETED
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use --create 1.9.3@neoteric-protection
|
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 Joe Sak
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# Rehearsal
|
2
|
-
|
3
|
-
This gem gives drop-in staging environment HTTP basic auth for rails apps, maybe any Ruby web app.
|
4
|
-
|
5
|
-
You also get a `staging_banner` view helper
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
gem 'rehearsal'
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install rehearsal
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
**You must have a staging environment**
|
24
|
-
|
25
|
-
$ cp config/environments/production.rb config/environments/staging.rb
|
26
|
-
|
27
|
-
**Add a `staging` section to your database.yml**
|
28
|
-
|
29
|
-
**Run your app in staging mode**
|
30
|
-
|
31
|
-
$ RAILS_ENV=staging
|
32
|
-
$ heroku config:add RAILS_ENV=staging
|
33
|
-
|
34
|
-
In the controller you want to protect, or in application_controller to protect the entire app:
|
35
|
-
|
36
|
-
class ApplicationController < ActionController::Base
|
37
|
-
rehearse_with :username => 'username',
|
38
|
-
:password => 'password'
|
39
|
-
end
|
40
|
-
|
41
|
-
Add the CSS to your application.css:
|
42
|
-
|
43
|
-
@import "rehearsal";
|
44
|
-
|
45
|
-
-or-
|
46
|
-
|
47
|
-
//= require rehearsal
|
48
|
-
|
49
|
-
**or** define your own style:
|
50
|
-
|
51
|
-
#rehearsal-staging-banner {
|
52
|
-
/* styles */
|
53
|
-
}
|
54
|
-
|
55
|
-
## Staging Banner View Helper
|
56
|
-
|
57
|
-
In your view templates (for example, in your layout), you can insert the banner:
|
58
|
-
|
59
|
-
<body>
|
60
|
-
<%= staging_banner :message => "Put your message here" %>
|
61
|
-
<!-- ... -->
|
62
|
-
</body>
|
data/Rakefile
DELETED