myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3613] branches/component-api: Merged trunk 3586:


From: noreply
Subject: [myexperiment-hackers] [3613] branches/component-api: Merged trunk 3586: 3612 into component-api branch
Date: Fri, 19 Jul 2013 10:05:53 +0000 (UTC)

Revision
3613
Author
fbacall
Date
2013-07-19 10:05:53 +0000 (Fri, 19 Jul 2013)

Log Message

Merged trunk 3586:3612 into component-api branch

Modified Paths

Added Paths

Removed Paths

Diff

Deleted: branches/component-api/README_LOGIN (3612 => 3613)


--- branches/component-api/README_LOGIN	2013-07-18 13:55:42 UTC (rev 3612)
+++ branches/component-api/README_LOGIN	2013-07-19 10:05:53 UTC (rev 3613)
@@ -1,116 +0,0 @@
-== About
-
-This is a port of the standard LoginGenerator to use OpenID for
-authentication.  It is distributed with the Ruby OpenID library.
-
-Read more at:
-* http://openidenabled.com
-* http://openidenabled.com/openid/libraries/ruby
-* http://openid.net
-
-== Installation
-
-If you are reading this, then you have installed the openid_login
-system, but there are still a few things you have to do
-manually. First open your app/controllers/application.rb and add
-
-  require_dependency "openid_login_system"
-
-to the top of the file and include the login system with
-
-  include OpenidLoginSystem 
-
-The beginning of your ApplicationController.
-It should look something like this : 
-
-  require_dependency "openid_login_system"
-
-  class ApplicationController < ActionController::Base
-    include OpenidLoginSystem
-    model :user
-
-After you have done the modifications the the AbstractController you can import
-the user model into the database. This model is meant as an example and you
-should extend it. 
-
-The model :user is required when you are hitting problems to the degree of
-"Session could not be restored becuase not all items in it are known"
-
-== Requirements
-
-You need a database table corresponding to the User model. 
-
-  mysql syntax:
-  CREATE TABLE users (
-    id int(11) NOT NULL auto_increment,
-    openid_url varchar(256) default NULL,
-    PRIMARY KEY  (id)
-  );
-\xA0
-  postgres :
-  CREATE TABLE "users" (
-  \xA0"id" SERIAL NOT NULL UNIQUE,
-  \xA0"openid_url" VARCHAR(256),
-  \xA0PRIMARY KEY("id")
-  ) WITH OIDS;
-
-  sqlite:
-  CREATE TABLE 'users' (
-    'id' INTEGER PRIMARY KEY NOT NULL,
-    'openid_url' VARCHAR(256) DEFAULT NULL
-  );
-
-Of course your user model can have any amount of extra fields. This is just a
-starting point
-
-== How to use it 
-
-Now you can go around and happily add "before_filter :login_required" to the
-controllers which you would like to protect. 
-
-After integrating the login system with your rails application
-navigate to your new controller's login method. There you may login
-which will create a new User object if you've never logged in
-before. After you are done you should have a look at your DB, and
-you'll see the record for your User with the openid_url you entered.
-
-
-== Tips & Tricks
-
-How do I...
-
-  ... access the user who is currently logged in
-
-  A: You can get the user id from the session using @session[:user_id]
-     Example: 
-	
-	@session[:user_id] 
-
-       To get the User object:
-
-	user = User.find(@session[:user_id])
-
-      	The OpenidController also has a find_user method
-     	which will return the User object of the logged in user, or nil
-	if no user is logged in.
-	
-
-  ... restrict access to only a few methods? 
-  
-  A: Use before_filters build in scoping. 
-     Example: 
-       before_filter :login_required, : [:myaccount, :changepassword]
-       before_filter :login_required, :except => [:index]
-     
-  ... check if a user is logged-in in my views?
-  
-  A: @session[:user_id] will tell you. Here is an example helper which you can use to make this more pretty:
-     Example: 
-       def user?
-         address@hidden:user_id].nil?
-       end
-
-
-
-
-

Modified: branches/component-api/Rakefile (3612 => 3613)


--- branches/component-api/Rakefile	2013-07-18 13:55:42 UTC (rev 3612)
+++ branches/component-api/Rakefile	2013-07-19 10:05:53 UTC (rev 3613)
@@ -6,9 +6,11 @@
 require 'rake'
 require 'rake/testtask'
 require 'rdoc/task'
-
 require 'tasks/rails'
 
+require 'sunspot/rails/tasks'
+require 'sunspot/solr/tasks'
+
 desc 'Rebuild Solr index'
 task "myexp:refresh:solr" do
   require File.dirname(__FILE__) + '/config/environment'

Modified: branches/component-api/app/controllers/license_attributes_controller.rb (3612 => 3613)


--- branches/component-api/app/controllers/license_attributes_controller.rb	2013-07-18 13:55:42 UTC (rev 3612)
+++ branches/component-api/app/controllers/license_attributes_controller.rb	2013-07-19 10:05:53 UTC (rev 3613)
@@ -13,7 +13,7 @@
     begin
       @license_attribute = LicenseAttribute.find(params[:id])
     rescue ActiveRecord::RecordNotFound
-      error("License Attribute not found", "is invalid")
+      render_404("License Attribute not found.")
     end
   end
   

Modified: branches/component-api/app/controllers/workflows_controller.rb (3612 => 3613)


--- branches/component-api/app/controllers/workflows_controller.rb	2013-07-18 13:55:42 UTC (rev 3612)
+++ branches/component-api/app/controllers/workflows_controller.rb	2013-07-19 10:05:53 UTC (rev 3613)
@@ -188,7 +188,7 @@
 
     TavernaToGalaxy.generate(@workflow, @viewing_version_number, params[:server], zip_file_name)
 
-    zip_file = File.read(zip_file_name)
+    zip_file = File.binread(zip_file_name)
     File.unlink(zip_file_name)
 
     Download.create(:contribution => @workflow.contribution,

Modified: branches/component-api/config/boot.rb (3612 => 3613)


--- branches/component-api/config/boot.rb	2013-07-18 13:55:42 UTC (rev 3612)
+++ branches/component-api/config/boot.rb	2013-07-19 10:05:53 UTC (rev 3613)
@@ -110,5 +110,19 @@
   end
 end
 
+class Rails::Boot
+  def run
+    load_initializer
+
+    Rails::Initializer.class_eval do
+      def load_gems
+        @bundler_loaded ||= Bundler.require :default, Rails.env
+      end
+    end
+
+    Rails::Initializer.run(:set_load_path)
+  end
+end
+
 # All that for this:
 Rails.boot!

Copied: branches/component-api/config/initializers/nitems.rb (from rev 3612, trunk/config/initializers/nitems.rb) (0 => 3613)


--- branches/component-api/config/initializers/nitems.rb	                        (rev 0)
+++ branches/component-api/config/initializers/nitems.rb	2013-07-19 10:05:53 UTC (rev 3613)
@@ -0,0 +1,12 @@
+# Some gems use Array#nitems which isn't in Ruby 1.9 so I need this:
+
+# From http://stackoverflow.com/a/8205275/509839
+
+if ! Array.method_defined?(:nitems)
+  class Array
+    def nitems
+      count{|x| !x.nil?}
+    end
+  end
+end
+

Copied: branches/component-api/config/preinitializer.rb (from rev 3612, trunk/config/preinitializer.rb) (0 => 3613)


--- branches/component-api/config/preinitializer.rb	                        (rev 0)
+++ branches/component-api/config/preinitializer.rb	2013-07-19 10:05:53 UTC (rev 3613)
@@ -0,0 +1,23 @@
+# Load gems from Gemfile.
+# From: http://bundler.io/rails23.html
+
+begin
+  require 'rubygems'
+  require 'bundler'
+rescue LoadError
+  raise "Could not load the bundler gem. Install it with `gem install bundler`."
+end
+
+if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
+  raise RuntimeError, "Your bundler version is too old for Rails 2.3.\n" +
+   "Run `gem install bundler` to upgrade."
+end
+
+begin
+  # Set up load paths for all bundled gems
+  ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
+  Bundler.setup
+rescue Bundler::GemNotFound
+  raise RuntimeError, "Bundler couldn't find some gems.\n" +
+    "Did you run `bundle install`?"
+end

Modified: branches/component-api/config/routes.rb (3612 => 3613)


--- branches/component-api/config/routes.rb	2013-07-18 13:55:42 UTC (rev 3612)
+++ branches/component-api/config/routes.rb	2013-07-19 10:05:53 UTC (rev 3613)
@@ -24,7 +24,7 @@
                    :rerun => :post, 
                    :render_output => :get }
   end
-  
+
   # Ontologies
   map.resources :ontologies
 
@@ -154,9 +154,6 @@
   # content_types
   map.resources :content_types
 
-  # all downloads and viewings
-  map.resources :downloads, :viewings
-
   # messages
   map.resources :messages, :collection => { :sent => :get, :delete_all_selected => :delete }
 

Modified: branches/component-api/lib/pivoting.rb (3612 => 3613)


--- branches/component-api/lib/pivoting.rb	2013-07-18 13:55:42 UTC (rev 3612)
+++ branches/component-api/lib/pivoting.rb	2013-07-19 10:05:53 UTC (rev 3613)
@@ -195,6 +195,7 @@
       end
 
     rescue
+      raise unless Rails.env == "production"
       return false
     end
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]