Copy over configuration needed for gadgets.
Make changes to copied-over configuration.

* Remove references of OAuth which is not moved yet.
* Change RAILS_ENV to Rails.env for Rails 4.
More one-time config needed for gadgets.
Fix the Gemfile. Enable gadgets gem.
Fix routes for gadgets.

* Remove temporary routes.
* Remove 'catch all' route which was overriding the engine's routes
  which were added later by Rails (meaning, after the 'catch all').
* Fix resources route in gadgets. It is now more similar to its original form.
Set site URLs properly.

They need to be set on to the current thread so that they can be used by the gadgets gem.
Fix 'SSL not configured' error view.

* This is used in the most bizzare way, in plugin_ssl_helper.rb
Fix view: List and add new gadget client view form.
Fix validations.
Make delete provider work.

* The issue mentioned here was affecting it:
  http://martinciu.com/2011/07/difference-between-class_inheritable_attribute-and-class_attribute.html
Fix 'Card Activity' page.

* Streaming in Rails 4 is no longer done using: render :text => proc {}
  It is done using response_body or using Live streaming (response.stream).

* Had to change makeRequest call to be a POST.

* Had to use java_stream_to_string instead of copy_java_stream_to_io. Not
  ideal, since it will not work well for binary data. In this case, it
  is alright.
Use admin layout for OAutH provider pages.
Merge remote-tracking branch 'origin/master' into gadgets
Move catch_all route from routes.rb to application.rb.

* Otherwise, the catch_all route will show up before the gadget routes.
  So, none of the gadget routes work.
Merge remote-tracking branch 'origin/master' into gadgets

Conflicts:
	server/webapp/WEB-INF/rails.new/Gemfile
	server/webapp/WEB-INF/rails.new/Gemfile.lock
	server/webapp/WEB-INF/rails.new/config/application.rb
	server/webapp/WEB-INF/rails.new/vendor/bundle/bundler/setup.rb
	server/webapp/WEB-INF/rails.new/vendor/engines/gadgets/config/routes.rb
#445 - Remove environment variables set for this plugin.

It is already added into environment.rb.
#000 - Fix tests: Cleanup properly after run.

new_html_spec and edit_html_spec, when run together, used to fail because
the plugin is registered already in the before section of the first test.
#000 - Change order of assertions.

To help to debug this test, if it is flaky. It failed once, but does not fail locally.
Merge pull request #459 from arvindsv/fix_rails_new_tests

Fix rails new tests
#445 - Move gadget datasource setup method into engine_extensions.rb