social_stream-ostatus 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/Gemfile +3 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +26 -0
  4. data/Rakefile +26 -0
  5. data/app/assets/images/logos/actor/remote_subject.png +0 -0
  6. data/app/controllers/host_meta_controller.rb +9 -0
  7. data/app/controllers/pshb_controller.rb +34 -0
  8. data/app/controllers/remoteusers_controller.rb +30 -0
  9. data/app/controllers/subjects_controller.rb +5 -0
  10. data/app/controllers/webfinger_controller.rb +15 -0
  11. data/app/models/remote_subject.rb +43 -0
  12. data/app/views/remoteusers/index.html.erb +8 -0
  13. data/config/locales/en.yml +34 -0
  14. data/config/routes.rb +10 -0
  15. data/db/migrate/20120905145030_create_social_stream_ostatus.rb +19 -0
  16. data/lib/generators/social_stream/ostatus/install_generator.rb +22 -0
  17. data/lib/generators/social_stream/ostatus/templates/initializer.rb +4 -0
  18. data/lib/social_stream/migrations/ostatus.rb +9 -0
  19. data/lib/social_stream/ostatus/engine.rb +21 -0
  20. data/lib/social_stream/ostatus/models/actor.rb +43 -0
  21. data/lib/social_stream/ostatus/models/audience.rb +19 -0
  22. data/lib/social_stream/ostatus/version.rb +5 -0
  23. data/lib/social_stream-ostatus.rb +27 -0
  24. data/social_stream-ostatus.gemspec +28 -0
  25. data/spec/dummy/Rakefile +7 -0
  26. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  27. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  28. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/spec/dummy/config/application.rb +45 -0
  30. data/spec/dummy/config/boot.rb +10 -0
  31. data/spec/dummy/config/database.yml +22 -0
  32. data/spec/dummy/config/environment.rb +5 -0
  33. data/spec/dummy/config/environments/development.rb +26 -0
  34. data/spec/dummy/config/environments/production.rb +49 -0
  35. data/spec/dummy/config/environments/test.rb +35 -0
  36. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  37. data/spec/dummy/config/initializers/inflections.rb +10 -0
  38. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  39. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  40. data/spec/dummy/config/initializers/session_store.rb +8 -0
  41. data/spec/dummy/config/locales/en.yml +5 -0
  42. data/spec/dummy/config/routes.rb +58 -0
  43. data/spec/dummy/config.ru +4 -0
  44. data/spec/dummy/public/404.html +26 -0
  45. data/spec/dummy/public/422.html +26 -0
  46. data/spec/dummy/public/500.html +26 -0
  47. data/spec/dummy/public/favicon.ico +0 -0
  48. data/spec/dummy/public/javascripts/application.js +2 -0
  49. data/spec/dummy/public/javascripts/controls.js +965 -0
  50. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  51. data/spec/dummy/public/javascripts/effects.js +1123 -0
  52. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  53. data/spec/dummy/public/javascripts/rails.js +191 -0
  54. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  55. data/spec/dummy/script/rails +6 -0
  56. data/spec/integration/navigation_spec.rb +9 -0
  57. data/spec/social_stream_ostatus.spec.rb +9 -0
  58. data/spec/spec_helper.rb +33 -0
  59. metadata +233 -0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2011 VÍCTOR SÁNCHEZ BELMAR
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,26 @@
1
+ = SocialStream OStatus
2
+
3
+ Provides a SocialStream powered node with social network federation support
4
+ using OStatus
5
+
6
+ = Installation
7
+
8
+ Add to your Gemfile:
9
+
10
+ gem 'social_stream-ostatus'
11
+
12
+ and run:
13
+
14
+ bundle update
15
+
16
+ Then:
17
+
18
+ rails generate social_stream:ostatus:install
19
+
20
+ You're almost there, now run:
21
+
22
+ rake db:migrate
23
+
24
+ And finally:
25
+
26
+ rails server
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rdoc/task'
4
+
5
+ require 'rspec/core'
6
+ require 'rspec/core/rake_task'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ task :default => :spec
11
+
12
+ Rake::RDocTask.new(:rdoc) do |rdoc|
13
+ rdoc.rdoc_dir = 'rdoc'
14
+ rdoc.title = 'SocialStream::Ostatus'
15
+ rdoc.rdoc_files.include('README*')
16
+ rdoc.rdoc_files.include('lib/**/*.rb')
17
+ end
18
+
19
+ Bundler::GemHelper.install_tasks
20
+
21
+ # Modify this gem's tags
22
+ class Bundler::GemHelper
23
+ def version_tag
24
+ "ostatus#{version}"
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ class HostMetaController < ActionController::Metal
2
+ include ActionController::Redirecting
3
+ include Rails.application.routes.url_helpers
4
+
5
+ def index
6
+ self.response_body = Proudhon::HostMeta.to_xml("#{ webfinger_url }?q={uri}")
7
+ self.content_type = Mime::XML
8
+ end
9
+ end
@@ -0,0 +1,34 @@
1
+ class PshbController < ApplicationController
2
+
3
+ def callback
4
+ #sync subscription verification
5
+ if params['hub.mode']=='subscribe'
6
+ render :text => params['hub.challenge'], :status => 200
7
+ # TO-DO: confirm that params['hub.topic'] is a real
8
+ # requested subscription by someone in this node
9
+ return
10
+ end
11
+
12
+ #sync unsubscription verification
13
+ if params['hub.mode']=='unsubscribe'
14
+ render :text => params['hub.challenge'], :status => 200
15
+ # TO-DO: confirm that params['hub.topic'] is a real
16
+ # requested unsubscription by someone in this node
17
+ # and delete permissions/remote actor if necessary
18
+ return
19
+ end
20
+
21
+ #If we got here we are receiving an XML Activity Feed
22
+ doc = Nokogiri::XML(request.body.read)
23
+ origin = doc.xpath("//xmlns:link[@rel='self']").first['href'].split('/')
24
+ webfinger_id = origin[5]+"@"+origin[2]
25
+
26
+ activity_texts = doc.xpath("//xmlns:content")
27
+ activity_texts.each do |activity_text|
28
+ r_user = RemoteSubject.find_by_webfinger_id(webfinger_id)
29
+ if r_user != nil
30
+ Post.create!(:text => activity_text.content, :_activity_tie_id => r_user.public_tie)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,30 @@
1
+ class RemoteusersController < ApplicationController
2
+ before_filter :authenticate_user!
3
+
4
+ def index
5
+ if params[:slug].present?
6
+ #Selecting the remote subject
7
+ u = RemoteSubject.find_or_create_using_wslug(params[:slug])
8
+
9
+ #Creating the tie between me and the remote subject
10
+ t = Tie.create!(:sender => current_user.actor,
11
+ :receiver => u.actor,
12
+ :relation_name => "friend")
13
+
14
+ #Requesting a subscription to the hub
15
+ t = Thread.new do
16
+ uri = URI.parse(SocialStream::Ostatus.hub)
17
+ response = Net::HTTP::post_form(uri,{ 'hub.callback' => pshb_callback_url,
18
+ 'hub.mode' => "subscribe",
19
+ 'hub.topic' => u.public_feed_url,
20
+ 'hub.verify' => 'sync'})
21
+
22
+ end
23
+ end
24
+
25
+ respond_to do |format|
26
+ format.html
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,5 @@
1
+ class SubjectsController < ApplicationController
2
+ def lrdd
3
+
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ class WebfingerController < ActionController::Metal
2
+ include ActionController::Redirecting
3
+ include Rails.application.routes.url_helpers
4
+
5
+ def index
6
+ actor = Actor.find_by_webfinger!(params[:q])
7
+
8
+ finger = Proudhon::Finger.new :links => {
9
+ :profile => polymorphic_url([actor.subject, :profile])
10
+ }
11
+
12
+ self.response_body = finger.to_xml
13
+ self.content_type = Mime::XML
14
+ end
15
+ end
@@ -0,0 +1,43 @@
1
+ class RemoteSubject < ActiveRecord::Base
2
+ attr_accessible :name, :webfinger_id, :origin_node_url
3
+
4
+ #validates_format_of :webfinger_slug, :with => Devise.email_regexp, :allow_blank => true
5
+
6
+ class << self
7
+ def find_or_create_using_webfinger_id(id)
8
+ subject = RemoteSubject.find_by_webfinger_id(id)
9
+
10
+ return subject if subject.present?
11
+
12
+ RemoteSubject.create! :name => id,
13
+ :webfinger_id => id
14
+ end
15
+ end
16
+
17
+ # Public feed url for this RemoteSubject
18
+ #
19
+ # TODO: get from webfinger?
20
+ # It does not work for every remote user!
21
+ def public_feed_url
22
+ "http://#{ webfinger_url }/api/user/#{ name }/public.atom"
23
+ end
24
+
25
+ # Return the slug in the webfinger_id
26
+ def webfinger_slug
27
+ splitted_webfinger_id.first
28
+ end
29
+
30
+ # Return the origin url in the webfinger_id
31
+ def webfinger_url
32
+ splitted_webfinger_id.last
33
+ end
34
+
35
+ protected
36
+
37
+ def splitted_webfinger_id
38
+ @splitted_webfinger_id ||=
39
+ webfinger_id.split('@')
40
+ end
41
+
42
+
43
+ end
@@ -0,0 +1,8 @@
1
+ <h2> Follow remote user: </h2>
2
+ <br/>
3
+
4
+ <%= form_tag(add_remote_user_url, :method => "post") do %>
5
+ <%= label_tag(:slug, "Remote user slug:") %>
6
+ <%= text_field_tag(:slug) %>
7
+ <%= submit_tag("Follow") %>
8
+ <% end %>
@@ -0,0 +1,34 @@
1
+ en:
2
+ activity:
3
+ verb:
4
+ follow:
5
+ RemoteSubject:
6
+ title: "%{subject} added %{contact} as contact."
7
+ message: "%{name} added you as contact."
8
+ notification:
9
+ subject: "%{name} added you as contact."
10
+ body: "%{name} added you as contact."
11
+ like:
12
+ RemoteSubject:
13
+ title: "%{subject} is a fan of %{contact}."
14
+ message: "%{name} is now your fan."
15
+ notification:
16
+ subject: "%{name} is now your fan."
17
+ body: "%{name} is now your fan."
18
+ make-friend:
19
+ RemoteSubject:
20
+ title: "%{subject} and %{contact} are now connected."
21
+ message: "%{name} also added you as contact."
22
+ notification:
23
+ subject: "%{name} also added you as contact."
24
+ body: "%{name} also added you as contact."
25
+ post:
26
+ RemoteSubject:
27
+ notification:
28
+ subject: "%{name} has posted something(%{direct_object}) in your wall"
29
+ body: "%{name} has posted something(%{direct_object}) in your wall"
30
+ update:
31
+ RemoteSubject:
32
+ notification:
33
+ subject: "%{name} has updated %{direct_object} in your wall"
34
+ body: "%{name} has updated something(%{direct_object}) in your wall"
data/config/routes.rb ADDED
@@ -0,0 +1,10 @@
1
+ Rails.application.routes.draw do
2
+ # Webfinger
3
+ match '/.well-known/host-meta', :to => HostMetaController.action(:index)
4
+
5
+ # Find subjects by slug
6
+ match '/webfinger' => 'webfinger#index', :as => 'webfinger'
7
+
8
+ match 'pshb/callback' => 'pshb#callback', :as => :pshb_callback
9
+ match 'remoteuser/' => 'remoteusers#index', :as => :add_remote_user
10
+ end
@@ -0,0 +1,19 @@
1
+ class CreateSocialStreamOstatus < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :remote_subjects, :force => true do |t|
5
+ t.integer :actor_id
6
+ t.string :webfinger_id
7
+ t.timestamps
8
+ end
9
+
10
+ add_index "remote_subjects", "actor_id"
11
+ add_foreign_key "remote_subjects", "actors", :name => "remote_subjects_on_actor_id"
12
+ end
13
+
14
+ def self.down
15
+ remove_foreign_key "remote_subjects", :name => "remote_subjects_on_actor_id"
16
+ drop_table :remote_subjects
17
+ end
18
+
19
+ end
@@ -0,0 +1,22 @@
1
+ class SocialStream::Ostatus::InstallGenerator < Rails::Generators::Base
2
+ include Rails::Generators::Migration
3
+
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def create_migration_file
7
+ require 'rake'
8
+ Rails.application.load_tasks
9
+ Rake::Task['railties:install:migrations'].reenable
10
+ Rake::Task['social_stream_ostatus_engine:install:migrations'].invoke
11
+ end
12
+
13
+ def config_initializer
14
+ copy_file 'initializer.rb', 'config/initializers/social_stream-ostatus.rb'
15
+ end
16
+
17
+ def inject_remote_user_relation
18
+ append_file 'config/relations.yml',
19
+ "\nremote_subject:\n friend:\n name: friend\n permissions:\n - [ follow ]\n sphere: personal\n"+
20
+ " public:\n name: public\n permissions:\n - [ read, tie, star_tie ]\n sphere: personal"
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ SocialStream::Ostatus.setup do |config|
2
+ config.hub = 'http://localhost:4567/'
3
+ config.node_base_url = 'http://localhost:3000'
4
+ end
@@ -0,0 +1,9 @@
1
+ require 'social_stream/migrations/components'
2
+
3
+ module SocialStream
4
+ module Migrations
5
+ # Migrate Ostatus
6
+ class Ostatus < Components
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ module SocialStream
2
+ module Ostatus
3
+ class Engine < Rails::Engine
4
+ initializer 'social_stream-ostatus.actor' do
5
+ ActiveSupport.on_load(:actor) do
6
+ include SocialStream::Ostatus::Models::Actor
7
+ end
8
+ end
9
+
10
+ initializer 'social_stream-ostatus.audience' do
11
+ ActiveSupport.on_load(:audience) do
12
+ include SocialStream::Ostatus::Models::Audience
13
+ end
14
+ end
15
+
16
+ initializer "social_stream-ostatus.remote_subject_in_social_stream_subjects" do
17
+ SocialStream.subjects << :remote_subject unless SocialStream.subjects.include?(:remote_subject)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,43 @@
1
+ require "net/http"
2
+ require "uri"
3
+
4
+ module SocialStream
5
+ module Ostatus
6
+ module Models
7
+ module Actor
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ after_create :init_feeds_to_hub
12
+ end
13
+
14
+ module ClassMethods
15
+ # Extract the slug from the webfinger id and return the actor
16
+ # searching by that slug
17
+ def find_by_webfinger!(link)
18
+ link =~ /(acct:)?(.*)@/
19
+
20
+ find_by_slug! $2
21
+ end
22
+ end
23
+
24
+ def init_feeds_to_hub
25
+ publish_or_update_public_feed
26
+ #TO-DO: add calls to other public feeds if any
27
+ end
28
+
29
+ def publish_or_update_public_feed
30
+ t = Thread.new do
31
+ hub = SocialStream::Ostatus.hub
32
+ topic = SocialStream::Ostatus.node_base_url+'/api/user/'+self.slug+'/public.atom'
33
+
34
+ uri = URI.parse(hub)
35
+ response = Net::HTTP::post_form(uri,{ 'hub.mode' => 'publish',
36
+ 'hub.url' => topic})
37
+ #TO-DO: process 4XX look at: response.status
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,19 @@
1
+ module SocialStream
2
+ module Ostatus
3
+ module Models
4
+ module Audience
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ after_create :update_feed_to_hub
9
+ end
10
+
11
+ def update_feed_to_hub
12
+ if relation.is_a?(Relation::Public)
13
+ activity.owner.publish_or_update_public_feed
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module SocialStream
2
+ module Ostatus
3
+ VERSION = "0.0.1".freeze
4
+ end
5
+ end
@@ -0,0 +1,27 @@
1
+ require 'social_stream-base'
2
+
3
+ # Ruby implementation of OStatus
4
+ require 'proudhon'
5
+
6
+ module SocialStream
7
+ module Ostatus
8
+ mattr_accessor :hub
9
+ @@hub = :hub
10
+
11
+ mattr_accessor :node_base_url
12
+ @@node_base_url = :node_base_url
13
+
14
+ class << self
15
+ def setup
16
+ yield self
17
+ end
18
+ end
19
+
20
+ module Models
21
+ autoload :Actor, 'social_stream/ostatus/models/actor'
22
+ autoload :Audience, 'social_stream/ostatus/models/audience'
23
+ end
24
+ end
25
+ end
26
+
27
+ require 'social_stream/ostatus/engine'
@@ -0,0 +1,28 @@
1
+ # encoding UTF-8
2
+ require File.join(File.dirname(__FILE__), 'lib', 'social_stream', 'ostatus', 'version')
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "social_stream-ostatus"
6
+ s.version = SocialStream::Ostatus::VERSION.dup
7
+ s.authors = ["Antonio Tapiador", "GING - DIT - UPM"]
8
+ s.summary = "Provides a Social Stream node with social network federation support via OStatus protocol"
9
+ s.description = "This gem allow you to connect several social stream nodes using PSHB hubs, also allows to follow, and share streams with social stream users in any node."
10
+ s.email = "social-stream@dit.upm.es"
11
+ s.homepage = "http://social-stream.dit.upm.es"
12
+ s.files = `git ls-files`.split("\n")
13
+
14
+ # Gem dependencies
15
+ s.add_runtime_dependency('social_stream-base','~> 0.22.0')
16
+ s.add_runtime_dependency('proudhon','>= 0.3')
17
+ s.add_runtime_dependency('nokogiri','> 1.4.4')
18
+
19
+ # Development Gem dependencies
20
+ s.add_development_dependency('sqlite3-ruby')
21
+ if RUBY_VERSION < '1.9'
22
+ s.add_development_dependency('ruby-debug')
23
+ end
24
+ s.add_development_dependency('rspec-rails')
25
+ s.add_development_dependency('factory_girl')
26
+ s.add_development_dependency('forgery')
27
+ s.add_development_dependency('capybara')
28
+ end
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,45 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "active_model/railtie"
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_view/railtie"
7
+ require "action_mailer/railtie"
8
+
9
+ Bundler.require
10
+ require "social_stream-ostatus"
11
+
12
+ module Dummy
13
+ class Application < Rails::Application
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # JavaScript files you want as :defaults (application.js is always included).
37
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
38
+
39
+ # Configure the default encoding used in templates for Ruby 1.9.
40
+ config.encoding = "utf-8"
41
+
42
+ # Configure sensitive parameters which will be filtered from the log file.
43
+ config.filter_parameters += [:password]
44
+ end
45
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,26 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+ end
26
+