Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bulk rename Bcsec -> Aker.

  • Loading branch information...
commit eac882673df395923d193c63b0c0b2c7a1c2f96b 1 parent 9c00072
@rsutphin rsutphin authored
Showing with 182 additions and 182 deletions.
  1. +1 −1  .gitignore
  2. +1 −1  .rvmrc
  3. +1 −1  Gemfile
  4. +28 −28 README-rails
  5. +7 −7 Rakefile
  6. +5 −5 bcsec-rails.gemspec → aker-rails.gemspec
  7. +5 −5 ci-env.sh
  8. +6 −6 features/support/env.rb
  9. +1 −1  features/support/mechanize_test.rb
  10. +3 −3 lib/{bcsec-rails.rb → aker-rails.rb}
  11. +20 −0 lib/aker/rails.rb
  12. +9 −9 lib/{bcsec → aker}/rails/application.rb
  13. +10 −10 lib/{bcsec → aker}/rails/railtie.rb
  14. +14 −14 lib/{bcsec → aker}/rails/secured_controller.rb
  15. +5 −0 lib/aker/rails/test.rb
  16. +7 −7 lib/{bcsec → aker}/rails/test/helpers.rb
  17. +1 −1  lib/{bcsec → aker}/rails/version.rb
  18. +0 −20 lib/bcsec/rails.rb
  19. +0 −5 lib/bcsec/rails/test.rb
  20. +10 −10 spec/{bcsec → aker}/rails/application_spec.rb
  21. +6 −6 spec/{bcsec → aker}/rails/railtie_spec.rb
  22. +8 −8 spec/{bcsec → aker}/rails/secured_controller_spec.rb
  23. +8 −8 spec/{bcsec → aker}/rails/test/helpers_spec.rb
  24. +3 −3 spec/{bcsec → aker}/rails_spec.rb
  25. +8 −8 spec/deprecation_helper.rb
  26. +2 −2 spec/spec_helper.rb
  27. +2 −2 test-applications/serenity-30/Gemfile
  28. +1 −1  test-applications/serenity-30/app/controllers/permit_controller.rb
  29. +1 −1  test-applications/serenity-30/app/controllers/protected_controller.rb
  30. +2 −2 test-applications/serenity-30/app/views/accounts/login.html.erb
  31. +7 −0 test-applications/serenity-30/config/initializers/aker.rb
  32. +0 −7 test-applications/serenity-30/config/initializers/bcsec.rb
View
2  .gitignore
@@ -1,6 +1,6 @@
.bundle
Gemfile.lock
-bcsec-rails*.gem
+aker-rails*.gem
reports
coverage
View
2  .rvmrc
@@ -1 +1 @@
-rvm_gemset_create_on_use_flag=1; rvm gemset use bcsec-rails
+rvm_gemset_create_on_use_flag=1; rvm gemset use aker-rails
View
2  Gemfile
@@ -3,7 +3,7 @@ source "http://download.bioinformatics.northwestern.edu/gems/"
gemspec
-gem 'bcsec', :git => 'git+ssh://code.bioinformatics.northwestern.edu/git/bcsec.git'
+gem 'aker', :git => 'git://github.com/NUBIC/aker.git'
group :resolver_hacks do
gem 'builder', '~> 2.1.2'
View
56 README-rails
@@ -1,37 +1,37 @@
-Bcsec-Rails
+Aker-Rails
===========
-`bcsec-rails` is the Rails plugin for Bcsec 2.1 and later. It is a
-thin wrapper around Bcsec's rack support.
+`aker-rails` is the Rails plugin for Aker 2.1 and later. It is a
+thin wrapper around Aker's rack support.
Setup
-----
### Prerequisites
-`bcsec-rails` requires Rails ~> 3.0.
+`aker-rails` requires Rails ~> 3.0.
### Get the gem
-`bcsec-rails` is a gem plugin. In order to use it, include it in your
+`aker-rails` is a gem plugin. In order to use it, include it in your
application's Gemfile:
source 'http://download.bioinformatics.northwestern.edu/gems'
- gem 'bcsec-rails'
+ gem 'aker-rails'
Between this and the `Bundler.require` that most Rails 3 applications do
as part of their initialization process, that's all you usually need to
-do to get bcsec and bcsec-rails loaded in your Rails application.
+do to get aker and aker-rails loaded in your Rails application.
-### Add an initializer for bcsec
+### Add an initializer for aker
Put your global configuration in an initializer. By _global
configuration_ I mean the parts that are the same no matter which
environment you are using, like the portal name and the modes.
- # In config/initializers/bcsec.rb
- Bcsec.configure do
+ # In config/initializers/aker.rb
+ Aker.configure do
# The authentication protocol to use for interactive access.
# `:form` is the default.
ui_mode :form
@@ -45,12 +45,12 @@ environment you are using, like the portal name and the modes.
end
For more information on the configuration syntax and options, see the
-bcsec API documentation for {Bcsec::Configuration}.
+aker API documentation for {Aker::Configuration}.
### Add per-environment configurations
In the environment initializer for each of your application's
-environments, put the parts of the Bcsec configuration which are
+environments, put the parts of the Aker configuration which are
env-specific. E.g., you might only use the `netid` authority in staging
and production since full access to the NU LDAP servers is only
available from behind the firewall. This means that the `authorities`
@@ -58,21 +58,21 @@ line will be env-specific.
# In config/environments/production.rb, for example
config.after_initialize do
- Bcsec.configure do
- # The authorities to use. See the bcsec API documentation
- # for `Bcsec::Authorities` for options.
+ Aker.configure do
+ # The authorities to use. See the aker API documentation
+ # for `Aker::Authorities` for options.
authorities :netid, :pers
# The server-central parameters file for cc_pers, NU LDAP,
# CAS, and policy parameters.
- central '/etc/nubic/bcsec-prod.yml'
+ central '/etc/nubic/aker-prod.yml'
end
end
Integration into your app
-------------------------
-With the plugin installed, Bcsec provides a general infrastructure for
+With the plugin installed, Aker provides a general infrastructure for
supporting authentication and authorization in your application. If
you want to _require_ authentication or authorization for particular
resources (and I think you do), you need to do a bit more
@@ -81,24 +81,24 @@ configuration.
### Securing pages
In any controller which authentication is required, include
-{Bcsec::Rails::SecuredController}. If authentication is required for
+{Aker::Rails::SecuredController}. If authentication is required for
all controllers, you can include this module in
`ApplicationController`.
If you want to further require that all actions in a controller
require that the user be a member of a certain group, you can use the
-{Bcsec::Rails::SecuredController::ClassMethods#permit permit} method:
+{Aker::Rails::SecuredController::ClassMethods#permit permit} method:
class ManuscriptController < ApplicationController
- include Bcsec::Rails::SecuredController
+ include Aker::Rails::SecuredController
permit :editor
end
### Partial authorization
-Bcsec also supports resources which are only partially limited to a
+Aker also supports resources which are only partially limited to a
particular group or groups. The helper for this is also called
-{Bcsec::Rails::Application#permit? permit}:
+{Aker::Rails::Application#permit? permit}:
# In a controller action
class DashboardController < ApplicationController
@@ -117,15 +117,15 @@ particular group or groups. The helper for this is also called
This permit helper is available to all subclasses of
`ApplicationController`, not just ones that mix in
-{Bcsec::Rails::SecuredController}. This means you can have a
+{Aker::Rails::SecuredController}. This means you can have a
publically-accessible page which has additional/different content for a
logged-in user.
### The current user
-Bcsec provides a method {Bcsec::Rails::Application#current_user
+Aker provides a method {Aker::Rails::Application#current_user
current_user} to all controllers and views. It will return a
-{Bcsec::User} object for the current user, or `nil` if there isn't
+{Aker::User} object for the current user, or `nil` if there isn't
one.
### Overriding the unauthorized view
@@ -145,12 +145,12 @@ and `/logout`:
match '/login' => 'accounts#login'
match '/logout' => 'accounts#logout'
-Bcsec will now use the views provided by `AccountsController#login` and
+Aker will now use the views provided by `AccountsController#login` and
`AccountsController#logout`; however, credential verification and session
-management is still performed by Bcsec.
+management is still performed by Aker.
When overriding the login view, you are responsible for providing a login form
-that satisfies the interface for Bcsec's credential verifier. Your login form
+that satisfies the interface for Aker's credential verifier. Your login form
should, at minimum, look like this:
# In app/views/accounts/login.html.erb
View
14 Rakefile
@@ -13,9 +13,9 @@ require 'net/scp'
require 'ci/reporter/rake/rspec'
-require 'bcsec/rails'
+require 'aker/rails'
-gemspec = eval(File.read('bcsec-rails.gemspec'), binding, 'bcsec-rails.gemspec')
+gemspec = eval(File.read('aker-rails.gemspec'), binding, 'aker-rails.gemspec')
Gem::PackageTask.new(gemspec).define
@@ -69,7 +69,7 @@ desc "Build API documentation with yard"
docsrc = %w(lib/**/*.rb -) + Dir.glob("{CHANGELOG,MIGRATION}-rails")
YARD::Rake::YardocTask.new do |t|
t.options = %w(--no-private --markup markdown --hide-void-return)
- t.options += ["--title", "bcsec-rails #{Bcsec::Rails::VERSION}"]
+ t.options += ["--title", "aker-rails #{Aker::Rails::VERSION}"]
t.files = docsrc
end
@@ -132,8 +132,8 @@ end
namespace :deploy do
task :check do
- if Bcsec::Rails::VERSION.split('.').any? { |v| v =~ /\D/i }
- puts "#{Bcsec::Rails::VERSION} is a prerelease version. " <<
+ if Aker::Rails::VERSION.split('.').any? { |v| v =~ /\D/i }
+ puts "#{Aker::Rails::VERSION} is a prerelease version. " <<
"Are you sure you want to deploy?\n" <<
"Press ^C to abort or enter to continue deploying."
STDIN.readline
@@ -157,8 +157,8 @@ namespace :deploy do
desc "Tag the final version of a release"
task :tag => [:check] do
- tagname = Bcsec::Rails::VERSION
- system("git tag -a #{tagname} -m 'Bcsec-Rails #{Bcsec::Rails::VERSION}'")
+ tagname = Aker::Rails::VERSION
+ system("git tag -a #{tagname} -m 'Aker-Rails #{Aker::Rails::VERSION}'")
fail "Tagging failed" unless $? == 0
system("git push origin : #{tagname}")
end
View
10 bcsec-rails.gemspec → aker-rails.gemspec
@@ -2,11 +2,11 @@
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
-require 'bcsec/rails/version'
+require 'aker/rails/version'
Gem::Specification.new do |s|
- s.name = 'bcsec-rails'
- s.version = Bcsec::Rails::VERSION
+ s.name = 'aker-rails'
+ s.version = Aker::Rails::VERSION
s.platform = Gem::Platform::RUBY
s.summary = "Bioinformatics core security infrastructure plugin for rails"
@@ -14,11 +14,11 @@ Gem::Specification.new do |s|
s.files = Dir.glob("{CHANGELOG,README,VERSION,{lib,spec,rails}/**/*}")
s.authors = ["David Yip", "Rhett Sutphin", "Peter Nyberg"]
s.email = "r-sutphin@northwestern.edu"
- s.homepage = "https://code.bioinformatics.northwestern.edu/redmine/projects/bcsec-ruby"
+ s.homepage = "https://code.bioinformatics.northwestern.edu/redmine/projects/aker-ruby"
s.add_runtime_dependency "rails", "~> 3.0"
# This is deliberately open -- I expect that this rails plugin will
# change much less frequently than the library.
- s.add_runtime_dependency "bcsec", ">= 2.1.0"
+ s.add_runtime_dependency "aker", ">= 2.1.0"
end
View
10 ci-env.sh
@@ -1,6 +1,6 @@
######
# This is not an executable script. It selects and configures rvm for
-# bcsec-rails' CI process.
+# aker-rails' CI process.
#
# Use it by sourcing it:
#
@@ -18,12 +18,12 @@ echo ". ~/.rvm/scripts/rvm"
. ~/.rvm/scripts/rvm
set -x
-BCSEC_RVM_RUBY='ree-1.8.7-2011.03'
-GEMSET="bcsec-rails-${JOB_NAME}"
+AKER_RVM_RUBY='ree-1.8.7-2011.03'
+GEMSET="aker-rails-${JOB_NAME}"
-echo "Switching to ${BCSEC_RVM_RUBY}"
+echo "Switching to ${AKER_RVM_RUBY}"
set +xe
-rvm use "$BCSEC_RVM_RUBY"
+rvm use "$AKER_RVM_RUBY"
if [ $? -ne 0 ]; then
echo "Switch failed"
exit 2;
View
12 features/support/env.rb
@@ -13,10 +13,10 @@
# Note: there is additional boot-time configuration after the world
# definition
-module Bcsec::Rails
+module Aker::Rails
module Cucumber
class World
- include Bcsec::Rails::Cucumber::MechanizeTest
+ include Aker::Rails::Cucumber::MechanizeTest
include FileUtils
include Spec::Matchers
@@ -87,7 +87,7 @@ def app_url(path)
end
def tmpdir
- @tmpdir ||= "/tmp/bcsec-rails-rails3-integrated-tests"
+ @tmpdir ||= "/tmp/aker-rails-rails3-integrated-tests"
unless File.exist?(@tmpdir)
mkdir_p @tmpdir
puts "Using tmpdir #{@tmpdir}"
@@ -99,7 +99,7 @@ def tmpdir
end
World do
- Bcsec::Rails::Cucumber::World.new
+ Aker::Rails::Cucumber::World.new
end
# The application uses a separate bundle, so it needs to run in a
@@ -107,6 +107,6 @@ def tmpdir
# to test, so it doesn't need to be started and stopped with each
# test.
at_exit do
- Bcsec::Rails::Cucumber::World.stop
+ Aker::Rails::Cucumber::World.stop
end
-Bcsec::Rails::Cucumber::World.start
+Aker::Rails::Cucumber::World.start
View
2  features/support/mechanize_test.rb
@@ -1,7 +1,7 @@
require 'mechanize'
require 'logger'
-module Bcsec::Rails::Cucumber
+module Aker::Rails::Cucumber
##
# Provides helpers & a DSL for testing a deployed set of
# applications with Mechanize.
View
6 lib/bcsec-rails.rb → lib/aker-rails.rb
@@ -7,6 +7,6 @@
# via a subclassing callback. See `Rails::Railtie.inherited`.)
#
# If you change the `Bundler.require` behavior in your application's
-# `config/application.rb` such that `bcsec-rails` is not loaded, you will have
-# to load `bcsec/rails/railtie` yourself.
-require 'bcsec/rails/railtie'
+# `config/application.rb` such that `aker-rails` is not loaded, you will have
+# to load `aker/rails/railtie` yourself.
+require 'aker/rails/railtie'
View
20 lib/aker/rails.rb
@@ -0,0 +1,20 @@
+require 'aker'
+
+module Aker
+ ##
+ # Rails integration for aker. In general, it is a thin wrapper
+ # around aker's rack integration.
+ #
+ # Everything in this module is in the `aker-rails` gem plugin.
+ module Rails
+ autoload :VERSION, 'aker/rails/version'
+
+ autoload :Application, 'aker/rails/application'
+ autoload :Railtie, 'aker/rails/railtie'
+ autoload :SecuredController, 'aker/rails/secured_controller'
+ autoload :Test, 'aker/rails/test'
+ end
+
+ # TODO: deprecate this somehow
+ autoload :SecuredController, 'aker/rails/secured_controller'
+end
View
18 lib/bcsec/rails/application.rb → lib/aker/rails/application.rb
@@ -1,18 +1,18 @@
-require 'bcsec/rails'
+require 'aker/rails'
-module Bcsec::Rails
+module Aker::Rails
##
# A mixin for the rails application controller. Provides global
- # bcsec integration, but does not enforce any authentication or
+ # aker integration, but does not enforce any authentication or
# authorization requirements. (See
- # {Bcsec::Rails::SecuredController} for one way to enforce
+ # {Aker::Rails::SecuredController} for one way to enforce
# authentication and authorization.)
#
# This module is automatically mixed into the application controller
# when the plugin is initialized.
module Application
##
- # Sets up the bcsec global infrastructure and helpers in the
+ # Sets up the aker global infrastructure and helpers in the
# application controller.
#
# @return [void]
@@ -27,23 +27,23 @@ def self.included(controller_class)
#
# This method is also available to views (i.e., it is a helper).
#
- # @return [Bcsec::User,nil]
+ # @return [Aker::User,nil]
def current_user
- request.env["bcsec"].user
+ request.env["aker"].user
end
##
# Aids group-level authorization. It is safe to call this method
# without checking that there is a logged in user first.
#
- # This method delegates directly to {Bcsec::Rack::Facade#permit?};
+ # This method delegates directly to {Aker::Rack::Facade#permit?};
# see the documentation for that method for more information.
#
# This method is also available to views (i.e., it is a helper).
#
# @return [Boolean,Object,nil]
def permit?(*groups, &block)
- request.env["bcsec"].permit?(*groups, &block)
+ request.env["aker"].permit?(*groups, &block)
end
alias :permit :permit?
end
View
20 lib/bcsec/rails/railtie.rb → lib/aker/rails/railtie.rb
@@ -1,24 +1,24 @@
-require 'bcsec/rails'
+require 'aker/rails'
require 'rails/railtie'
-module Bcsec::Rails
+module Aker::Rails
class Railtie < ::Rails::Railtie
- initializer 'Bcsec::Rails initialization' do |app|
- Rails.logger.debug "Initializing bcsec-rails"
+ initializer 'Aker::Rails initialization' do |app|
+ Rails.logger.debug "Initializing aker-rails"
- Bcsec.configure do
+ Aker.configure do
logger Rails.logger
end
- Bcsec::Rack.use_in(app.middleware)
+ Aker::Rack.use_in(app.middleware)
- Rack::Request.send(:include, Bcsec::Rack::RequestExt)
+ Rack::Request.send(:include, Aker::Rack::RequestExt)
end
- initializer 'Bcsec::Rails development support' do |app|
+ initializer 'Aker::Rails development support' do |app|
app.config.to_prepare do
- ApplicationController.send(:include, Bcsec::Rails::Application)
+ ApplicationController.send(:include, Aker::Rails::Application)
end
end
@@ -29,7 +29,7 @@ class Railtie < ::Rails::Railtie
custom_login = app.routes.routes.any? { |r| r.path =~ %r{^/login} }
custom_logout = app.routes.routes.any? { |r| r.path =~ %r{^/logout} }
- Bcsec.configure do
+ Aker.configure do
rack_parameters :use_custom_login_page => custom_login, :use_custom_logout_page => custom_logout
end
end
View
28 lib/bcsec/rails/secured_controller.rb → lib/aker/rails/secured_controller.rb
@@ -1,16 +1,16 @@
-require 'bcsec/rails'
+require 'aker/rails'
-module Bcsec::Rails
+module Aker::Rails
##
# This mixin tags a controller as always requiring authentication.
#
# It also adds a
- # {Bcsec::Rails::SecuredController::ClassMethods#permit method}
+ # {Aker::Rails::SecuredController::ClassMethods#permit method}
# which allows you to mark a controller as only accessible to a
# particular group or groups. For example:
#
# class SecretController
- # include Bcsec::Rails::SecuredController
+ # include Aker::Rails::SecuredController
# permit :confidential
# end
module SecuredController
@@ -19,7 +19,7 @@ module SecuredController
# description
# @return [void]
def self.included(controller_class)
- controller_class.before_filter :bcsec_authorize
+ controller_class.before_filter :aker_authorize
controller_class.extend ClassMethods
end
@@ -27,12 +27,12 @@ def self.included(controller_class)
# The filter which actually forces any user accessing a controller
# which mixes this in to be authenticated.
#
- # It delegates to {Bcsec::Rack::Facade#authentication_required!};
+ # It delegates to {Aker::Rack::Facade#authentication_required!};
# see that method's documentation for more information.
#
# @return [void]
- def bcsec_authorize
- request.env['bcsec'].authentication_required!
+ def aker_authorize
+ request.env['aker'].authentication_required!
end
##
@@ -45,7 +45,7 @@ module ClassMethods
# Tags a controller as requiring that a user both be
# authenticated and belong to one of a set of groups.
#
- # It delegates to {Bcsec::Rack::Facade#permit!}; see that
+ # It delegates to {Aker::Rack::Facade#permit!}; see that
# methods's documentation for more information.
#
# @return [void]
@@ -58,14 +58,14 @@ def permit(*groups)
end
before_filter(options) do |controller|
- controller.request.env['bcsec'].permit!(*groups)
+ controller.request.env['aker'].permit!(*groups)
end
end
end
end
end
-module Bcsec
+module Aker
class << self
alias :prerails_const_missing :const_missing
@@ -74,9 +74,9 @@ class << self
def const_missing(name)
case name
when :SecuredController
- Bcsec::Deprecation.
- notify("Use Bcsec::Rails::SecuredController instead of Bcsec::SecuredController.", "2.2")
- Bcsec::Rails::SecuredController
+ Aker::Deprecation.
+ notify("Use Aker::Rails::SecuredController instead of Aker::SecuredController.", "2.2")
+ Aker::Rails::SecuredController
else
prerails_const_missing(name)
end
View
5 lib/aker/rails/test.rb
@@ -0,0 +1,5 @@
+require File.join(File.dirname(__FILE__), %w(.. rails))
+
+module Aker::Rails::Test
+ autoload :Helpers, 'aker/rails/test/helpers'
+end
View
14 lib/bcsec/rails/test/helpers.rb → lib/aker/rails/test/helpers.rb
@@ -7,11 +7,11 @@
#
# # spec/spec_helper.rb
# Spec::Runner.configure do |config|
-# config.include Bcsec::Rails::Test::Helpers
+# config.include Aker::Rails::Test::Helpers
# ...
# end
-module Bcsec::Rails::Test::Helpers
- include Bcsec::Test::Helpers
+module Aker::Rails::Test::Helpers
+ include Aker::Test::Helpers
##
# Logs in a user.
@@ -19,14 +19,14 @@ module Bcsec::Rails::Test::Helpers
# Users can be identified by:
#
# * their username
- # * building a `Bcsec::User` instance representing that user
+ # * building a `Aker::User` instance representing that user
# * the return value of
#
- # Bcsec.authority.valid_credentials?(:user, username, password)
+ # Aker.authority.valid_credentials?(:user, username, password)
#
- # (which is a `Bcsec::User`)
+ # (which is a `Aker::User`)
#
- # @param [String, Bcsec::User] user a user's username or `Bcsec::User` object
+ # @param [String, Aker::User] user a user's username or `Aker::User` object
def login_as(user)
request.env.merge!(login_env(user))
end
View
2  lib/bcsec/rails/version.rb → lib/aker/rails/version.rb
@@ -1,4 +1,4 @@
-module Bcsec
+module Aker
module Rails
# VERSION is in a separate file with no external dependencies so it
# can be sourced from the gemspec.
View
20 lib/bcsec/rails.rb
@@ -1,20 +0,0 @@
-require 'bcsec'
-
-module Bcsec
- ##
- # Rails integration for bcsec. In general, it is a thin wrapper
- # around bcsec's rack integration.
- #
- # Everything in this module is in the `bcsec-rails` gem plugin.
- module Rails
- autoload :VERSION, 'bcsec/rails/version'
-
- autoload :Application, 'bcsec/rails/application'
- autoload :Railtie, 'bcsec/rails/railtie'
- autoload :SecuredController, 'bcsec/rails/secured_controller'
- autoload :Test, 'bcsec/rails/test'
- end
-
- # TODO: deprecate this somehow
- autoload :SecuredController, 'bcsec/rails/secured_controller'
-end
View
5 lib/bcsec/rails/test.rb
@@ -1,5 +0,0 @@
-require File.join(File.dirname(__FILE__), %w(.. rails))
-
-module Bcsec::Rails::Test
- autoload :Helpers, 'bcsec/rails/test/helpers'
-end
View
20 spec/bcsec/rails/application_spec.rb → spec/aker/rails/application_spec.rb
@@ -2,7 +2,7 @@
require 'rack'
require 'action_controller'
-module Bcsec::Rails
+module Aker::Rails
class FakeApplicationController
attr_accessor :request
@@ -14,9 +14,9 @@ def self.helper_methods
@helper_methods ||= []
end
- Bcsec.configure { }
+ Aker.configure { }
include Application
- Bcsec.configuration = nil
+ Aker.configuration = nil
end
describe Application do
@@ -24,12 +24,12 @@ def self.helper_methods
@controller = FakeApplicationController.new
@env = Rack::MockRequest.env_for('/')
- @env['bcsec'] = (@bcsec = mock)
+ @env['aker'] = (@aker = mock)
@controller.request = Rack::Request.new(@env)
end
it "adds current_user" do
- @bcsec.should_receive(:user).and_return(Bcsec::User.new("jo"))
+ @aker.should_receive(:user).and_return(Aker::User.new("jo"))
@controller.current_user.username.should == "jo"
end
@@ -39,14 +39,14 @@ def self.helper_methods
end
describe "#permit?" do
- it "delegates to the bcsec rack facade" do
- @bcsec.should_receive(:permit?).with(:bar, :quux)
+ it "delegates to the aker rack facade" do
+ @aker.should_receive(:permit?).with(:bar, :quux)
@controller.permit?(:bar, :quux)
end
- it "passes a block to the bcsec rack facade, if present" do
- @bcsec.should_receive(:permit?).with(:bar, :quux).and_yield
+ it "passes a block to the aker rack facade, if present" do
+ @aker.should_receive(:permit?).with(:bar, :quux).and_yield
@controller.permit?(:bar, :quux) { 1 + 1 }.should == 2
end
@@ -57,7 +57,7 @@ def self.helper_methods
describe "permit alias" do
it "exists" do
- @bcsec.should_receive(:permit?).with(:bar, :baz)
+ @aker.should_receive(:permit?).with(:bar, :baz)
@controller.permit(:bar, :baz)
end
View
12 spec/bcsec/rails/railtie_spec.rb → spec/aker/rails/railtie_spec.rb
@@ -1,28 +1,28 @@
require File.expand_path("../../../spec_helper", __FILE__)
-module Bcsec::Rails
+module Aker::Rails
describe Railtie do
- it "uses Rails' logger for Bcsec logging" do
+ it "uses Rails' logger for Aker logging" do
pending "need to figure out a good way to test railties"
end
- it "installs the Bcsec middleware" do
+ it "installs the Aker middleware" do
pending "need to figure out a good way to test railties"
end
- it "sets up a to_prepare hook for Bcsec::Rails::Application" do
+ it "sets up a to_prepare hook for Aker::Rails::Application" do
pending "need to figure out a good way to test railties"
end
context "when the form UI mode is in use" do
context "and a /login route is defined" do
- it "instructs Bcsec to not use its built-in login form" do
+ it "instructs Aker to not use its built-in login form" do
pending "need to figure out a good way to test railties"
end
end
context "and a /logout route is defined" do
- it "instructs Bcsec to not use its built-in logout screen" do
+ it "instructs Aker to not use its built-in logout screen" do
pending "need to figure out a good way to test railties"
end
end
View
16 spec/bcsec/rails/secured_controller_spec.rb → spec/aker/rails/secured_controller_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path("../../../spec_helper", __FILE__)
require 'rack'
-module Bcsec::Rails
+module Aker::Rails
class SomeController
attr_accessor :request
@@ -23,24 +23,24 @@ def self.before_filters
@before_filters ||= []
end
- include Bcsec::Rails::SecuredController
+ include Aker::Rails::SecuredController
end
describe SecuredController do
before do
@request = Rack::Request.new(Rack::MockRequest.env_for("/some"))
- @bcsec = (@request.env['bcsec'] = mock)
+ @aker = (@request.env['aker'] = mock)
@controller = SomeController.new(@request)
end
- describe "#bcsec_authorize" do
+ describe "#aker_authorize" do
it "is registered as a filter" do
- @controller.class.before_filters.should == [ [:bcsec_authorize] ]
+ @controller.class.before_filters.should == [ [:aker_authorize] ]
end
- it "invokes authentication_required on the bcsec rack facade" do
- @bcsec.should_receive(:authentication_required!)
- @controller.bcsec_authorize
+ it "invokes authentication_required on the aker rack facade" do
+ @aker.should_receive(:authentication_required!)
+ @controller.aker_authorize
end
end
View
16 spec/bcsec/rails/test/helpers_spec.rb → spec/aker/rails/test/helpers_spec.rb
@@ -2,18 +2,18 @@
require 'action_controller'
require 'action_controller/test_case'
-module Bcsec::Rails::Test
+module Aker::Rails::Test
describe Helpers do
before do
- Bcsec.configure do
- s = Bcsec::Authorities::Static.new
+ Aker.configure do
+ s = Aker::Authorities::Static.new
s.valid_credentials!(:user, "jo", "50-50")
authorities s
end
@test_case = Class.new do
- include Bcsec::Rails::Test::Helpers
+ include Aker::Rails::Test::Helpers
def request
@request ||= ActionController::TestRequest.new
@@ -25,15 +25,15 @@ def request
it "logs in a user by username" do
@test_case.login_as("jo")
- @test_case.request.env['bcsec'].user.username.should == "jo"
+ @test_case.request.env['aker'].user.username.should == "jo"
end
- it "accepts Bcsec::User objects" do
- user = Bcsec::User.new("jo")
+ it "accepts Aker::User objects" do
+ user = Aker::User.new("jo")
@test_case.login_as(user)
- @test_case.request.env['bcsec'].user.should == user
+ @test_case.request.env['aker'].user.should == user
end
end
end
View
6 spec/bcsec/rails_spec.rb → spec/aker/rails_spec.rb
@@ -1,13 +1,13 @@
require File.expand_path("../../spec_helper", __FILE__)
-describe Bcsec::Rails do
+describe Aker::Rails do
describe "::VERSION" do
it "exists" do
- lambda { Bcsec::Rails::VERSION }.should_not raise_error
+ lambda { Aker::Rails::VERSION }.should_not raise_error
end
it "has three or four dot-separated parts" do
- Bcsec::Rails::VERSION.split('.').size.should be_between(3, 4)
+ Aker::Rails::VERSION.split('.').size.should be_between(3, 4)
end
end
end
View
16 spec/deprecation_helper.rb
@@ -1,6 +1,6 @@
-module Bcsec::Rails
+module Aker::Rails
module Spec
- # Copied from bcsec due to laziness. May want to separate out and
+ # Copied from aker due to laziness. May want to separate out and
# share later.
class DeprecationMode
@@ -8,15 +8,15 @@ def self.use_in(spec_config)
spec_config.include DeprecationHelper
spec_config.before(:each) do
- @original_deprecation_mode, Bcsec::Deprecation.mode =
- Bcsec::Deprecation.mode, DeprecationMode.new
+ @original_deprecation_mode, Aker::Deprecation.mode =
+ Aker::Deprecation.mode, DeprecationMode.new
end
spec_config.after(:each) do
begin
- Bcsec::Deprecation.mode.fail_if_any_very_obsolete
+ Aker::Deprecation.mode.fail_if_any_very_obsolete
ensure
- Bcsec::Deprecation.mode = @original_deprecation_mode
+ Aker::Deprecation.mode = @original_deprecation_mode
end
end
end
@@ -44,7 +44,7 @@ def fail_if_any_very_obsolete
def very_obsolete?(version)
# "very obsolete" if it was deprecated at least two minor
# versions ago
- major_minor(Bcsec::Rails::VERSION) - Rational(2, 10) >= major_minor(version)
+ major_minor(Aker::Rails::VERSION) - Rational(2, 10) >= major_minor(version)
end
def major_minor(version)
@@ -54,7 +54,7 @@ def major_minor(version)
module DeprecationHelper
def deprecation_message(n=0)
- (Bcsec::Deprecation.mode.messages[n] || {})[:message]
+ (Aker::Deprecation.mode.messages[n] || {})[:message]
end
end
end
View
4 spec/spec_helper.rb
@@ -6,10 +6,10 @@
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
-require 'bcsec/rails'
+require 'aker/rails'
require File.expand_path('../deprecation_helper', __FILE__)
Spec::Runner.configure do |config|
- Bcsec::Rails::Spec::DeprecationMode.use_in(config)
+ Aker::Rails::Spec::DeprecationMode.use_in(config)
end
View
4 test-applications/serenity-30/Gemfile
@@ -2,6 +2,6 @@ source 'http://rubygems.org'
plugin_root = File.expand_path("../../..", __FILE__)
-gem 'bcsec', :git => 'git+ssh://code.bioinformatics.northwestern.edu/git/bcsec.git'
-gem 'bcsec-rails', :path => plugin_root
+gem 'aker', :git => 'git://github.com/NUBIC/aker.git'
+gem 'aker-rails', :path => plugin_root
gem 'rails', '~> 3.0'
View
2  test-applications/serenity-30/app/controllers/permit_controller.rb
@@ -1,5 +1,5 @@
class PermitController < ApplicationController
- include Bcsec::Rails::SecuredController
+ include Aker::Rails::SecuredController
permit :owners
View
2  test-applications/serenity-30/app/controllers/protected_controller.rb
@@ -1,5 +1,5 @@
class ProtectedController < ApplicationController
- include Bcsec::Rails::SecuredController
+ include Aker::Rails::SecuredController
def authentication_only
end
View
4 test-applications/serenity-30/app/views/accounts/login.html.erb
@@ -3,13 +3,13 @@ This is a custom login screen.
</p>
<p>
-Failed login attempts are flagged in the Rack environment as <code>bcsec.login_failed</code>.
+Failed login attempts are flagged in the Rack environment as <code>aker.login_failed</code>.
</p>
You'll want to have a form that looks like this:
<%= form_tag('/login') do %>
- <% if request.env['bcsec.login_failed'] %>
+ <% if request.env['aker.login_failed'] %>
Login failed.
<% end %>
View
7 test-applications/serenity-30/config/initializers/aker.rb
@@ -0,0 +1,7 @@
+Aker.configure do
+ portal :Serenity
+
+ api_mode :http_basic
+
+ authority Aker::Authorities::Static.from_file(File.expand_path("../../users.yml", __FILE__))
+end
View
7 test-applications/serenity-30/config/initializers/bcsec.rb
@@ -1,7 +0,0 @@
-Bcsec.configure do
- portal :Serenity
-
- api_mode :http_basic
-
- authority Bcsec::Authorities::Static.from_file(File.expand_path("../../users.yml", __FILE__))
-end
Please sign in to comment.
Something went wrong with that request. Please try again.