scidea-cv-redirects 0.0.1

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/CHANGELOG ADDED
@@ -0,0 +1,2 @@
1
+ 0.0.1
2
+ - initial release
data/MIT-LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 Scitent, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Scidea (CardioVillage) Redirects
2
+
3
+ This gem adds two URL redirections to the CardioVillage instance of Scidea.
4
+
5
+ ## Usage
6
+
7
+ 1. Add `scidea-cv-redirects` to your Scidea Gemfile:
8
+
9
+ ```
10
+ # Gemfile
11
+ gem 'requirejs-rails'
12
+ ```
13
+
14
+ ## Development Environment and Testing
15
+
16
+ The gem is configured to use rspec tests. Because there are so many dependencies upon the Scidea core, rspec has been configured to launch an instance of the core application with the plugin's resources tied in. The features and specs of the plugin, however, are the only ones executed when you run rspec.
17
+
18
+ To set up your environment for testing, perform the following:
19
+
20
+ 1. In your local Scidea core instance, add the following line to the Gemfile:
21
+
22
+ ```
23
+ # Gemfile
24
+ gem 'scidea-cv-redirects', :path => 'LOCAL_PATH_TO_THIS_GEM'
25
+ ```
26
+
27
+ 2. Copy the contents of the Scidea core Gemfile *after* ``gemspec``, and paste it to the end of the Gemfile in the scidea-cv-redirects code. When you run rspec, it requires this Gemfile, thus you need all of the gems that Scidea core requires as well.
28
+
29
+ ```
30
+ source 'http://rubygems.org'
31
+
32
+ gemspec
33
+
34
+ gem 'scidea', :path => 'LOCAL_PATH_TO_SCIDEA-CORE'
35
+
36
+ #from scidea core Gemfile:
37
+ gem 'rails', '= 3.1.3'
38
+
39
+ # db
40
+ gem 'mysql2', '>= 0.3'
41
+
42
+ # authentication and authorization
43
+ gem 'devise', '< 2.0'
44
+ gem 'cancan'
45
+
46
+ ... and so on
47
+ ```
48
+
49
+ From scidea-schools, you can run ``rspec``. Note that FactoryGirl factories from the Scidea core are included in the testing runtime and added to whatever you include in ``spec/factories``. The database configuration from the Scidea core will also be used. You must run all rake operations for that database in the context of the Scidea core folder. They will not work in the scidea-cv-redirects folder.
50
+
51
+ ----
52
+
53
+ Copyright 2012 Scitent, Inc. See the file MIT-LICENSE for terms.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ # encoding: utf-8
2
+ require 'rake'
@@ -0,0 +1,15 @@
1
+ module Cv
2
+ class RedirectsController < ApplicationController
3
+
4
+ ssl_allowed :all
5
+
6
+ def scai
7
+ redirect_to Scidea::CV::Redirects::Config::SCAI
8
+ end
9
+
10
+ def hsf
11
+ redirect_to Scidea::CV::Redirects::Config::HSF
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ # Load local Gemfile and get the path to the local core application
2
+ # (from standard rails config/boot.rb)
3
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
4
+ begin
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ rescue Bundler::GemNotFound => e
9
+ STDERR.puts e.message
10
+ STDERR.puts "Try running `bundle install`."
11
+ exit!
12
+ end if File.exist?(gemfile)
13
+
14
+ # get only the paths constants; let scidea core load all gems
15
+ require 'scidea/paths.rb'
16
+
17
+ # Load and initialize the Scidea core application
18
+ require File.expand_path('../config/environment', Scidea::APP_PATH)
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ Rails.application.routes.draw do
2
+ get "scai", :to => "cv/redirects#scai"
3
+ get "hsf", :to => "cv/redirects#hsf"
4
+ end
@@ -0,0 +1,16 @@
1
+ module SeedUserRoles
2
+ def self.seed
3
+ Role.public || Factory( :role_public )
4
+ Role.learner || Factory( :role_learner )
5
+ Role.user_admin || Factory(:role_user_admin)
6
+ Role.course_admin || Factory(:role_course_admin)
7
+ Role.product_admin || Factory(:role_product_admin)
8
+ Role.tech_support || Factory(:role_tech_support)
9
+ Role.scitent_admin || Factory(:role_scitent_admin)
10
+ end
11
+
12
+ def self.clean
13
+ Role.destroy_all
14
+ end
15
+ end
16
+
@@ -0,0 +1,10 @@
1
+ module Scidea
2
+ module CV
3
+ module Redirects
4
+ class Config
5
+ SCAI = "http://legacy-cardiovillage.cardioconcepts.com/scai"
6
+ HSF = "http://legacy-cardiovillage.cardioconcepts.com/hsf"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module Scidea
2
+ module CV
3
+ module Redirects
4
+ class Engine < ::Rails::Engine
5
+ end # class Engine
6
+ end # module Redirects
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Scidea
2
+ module CV
3
+ module Redirects
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ module Scidea
2
+ module CV
3
+ module Redirects
4
+ require 'scidea/cv/redirects/config'
5
+ require 'scidea/cv/redirects/engine' if defined?(::Rails)
6
+ end
7
+ end
8
+ end
data/lib/scidea/cv.rb ADDED
@@ -0,0 +1 @@
1
+ require 'scidea/cv/redirects'
@@ -0,0 +1 @@
1
+ require 'scidea/cv.rb'
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cv::RedirectsController do
4
+
5
+ describe "scai" do
6
+ it "should redirect gets to legacy cv" do
7
+ get :scai
8
+ response.should redirect_to(Scidea::CV::Redirects::Config::SCAI)
9
+ end
10
+ end
11
+
12
+ describe "hsf" do
13
+ it "should redirect gets to legacy cv" do
14
+ get :hsf
15
+ response.should redirect_to(Scidea::CV::Redirects::Config::HSF)
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,15 @@
1
+ require "spec_helper"
2
+
3
+ describe Cv::RedirectsController do
4
+ describe "routing" do
5
+
6
+ it "recognizes and generates #scai" do
7
+ { :get => "scai" }.should route_to(:controller => "cv/redirects", :action => "scai" )
8
+ end
9
+
10
+ it "recognizes and generates #hsf" do
11
+ { :get => "hsf" }.should route_to(:controller => "cv/redirects", :action => "hsf" )
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,52 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'rspec'
8
+ require 'scidea-cv-redirects'
9
+
10
+ require 'rspec/rails'
11
+ require 'rspec_tag_matchers'
12
+ require 'cancan/matchers'
13
+ require 'paperclip/matchers'
14
+
15
+ require File.expand_path("../../features/support/seed_user_roles.rb", __FILE__)
16
+
17
+ # Requires supporting files with custom matchers and macros, etc,
18
+ # in ./support/ and its subdirectories.
19
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
20
+
21
+ RSpec.configure do |config|
22
+ config.mock_with :rspec
23
+ config.use_transactional_fixtures = true
24
+
25
+ config.before(:suite) do
26
+ DatabaseCleaner.strategy = :transaction
27
+ DatabaseCleaner.clean_with(:truncation)
28
+ ::SeedUserRoles.seed
29
+ end
30
+
31
+ config.before(:each) do
32
+ DatabaseCleaner.start
33
+ end
34
+
35
+ config.after(:each) do
36
+ DatabaseCleaner.clean
37
+ end
38
+
39
+ config.after(:suite) do
40
+ ::SeedUserRoles.clean
41
+ end
42
+
43
+ config.include Devise::TestHelpers, :type => :controller
44
+ config.include Devise::TestHelpers, :type => :view
45
+ config.extend ControllerMacros, :type => :controller
46
+ end
47
+
48
+ # load local factories which will be added to the factories from scidea.
49
+ Rails.configuration.after_initialize do
50
+ FactoryGirl.definition_file_paths = [File.expand_path('../factories', __FILE__)]
51
+ FactoryGirl.find_definitions
52
+ end
@@ -0,0 +1,15 @@
1
+ module ControllerMacros
2
+ def login_scitent_admin
3
+ before(:each) do
4
+ @request.env["devise.mapping"] = Devise.mappings[:users]
5
+ sign_in Factory(:user_scitent_admin)
6
+ end
7
+ end
8
+
9
+ def login_learner
10
+ before(:each) do
11
+ @request.env["devise.mapping"] = Devise.mappings[:users]
12
+ sign_in Factory(:user_learner)
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scidea-cv-redirects
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Phoenix Team
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-29 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Custom URL redirects for CardioVillage. This is not a reusable Gem
15
+ email:
16
+ - phoenix@scitent.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - app/controllers/cv/redirects_controller.rb
22
+ - lib/scidea-cv-redirects.rb
23
+ - lib/scidea/cv.rb
24
+ - lib/scidea/cv/redirects/config.rb
25
+ - lib/scidea/cv/redirects/engine.rb
26
+ - lib/scidea/cv/redirects/version.rb
27
+ - lib/scidea/cv/redirects.rb
28
+ - config/routes.rb
29
+ - config/environment.rb
30
+ - features/support/seed_user_roles.rb
31
+ - spec/controllers/cv/redirects_controller_spec.rb
32
+ - spec/routing/cv/redirects_routing_spec.rb
33
+ - spec/support/controller_macros.rb
34
+ - spec/spec_helper.rb
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - CHANGELOG
39
+ homepage: https://github.com/phoenix-scitent/scidea-cv-redirects
40
+ licenses: []
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 1.8.10
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Custom URL redirects for CardioVillage
63
+ test_files: []