Rails.root and File.join cleanup
- `Rails.root` is a `Pathname`, so let's use `Rails.root.join` - Clean up most of the remaining `File.join`s
This commit is contained in:
parent
e021fd821d
commit
a8de3a5a3f
91 changed files with 142 additions and 141 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
require File.join(Rails.root, 'lib','statistics')
|
require Rails.root.join('lib', 'statistics')
|
||||||
|
|
||||||
class AdminsController < ApplicationController
|
class AdminsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ class AspectsController < ApplicationController
|
||||||
@contacts = @contacts_in_aspect + @contacts_not_in_aspect
|
@contacts = @contacts_in_aspect + @contacts_not_in_aspect
|
||||||
|
|
||||||
unless @aspect
|
unless @aspect
|
||||||
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
|
render :file => Rails.root.join('public', '404.html').to_s, :layout => false, :status => 404
|
||||||
else
|
else
|
||||||
@aspect_ids = [@aspect.id]
|
@aspect_ids = [@aspect.id]
|
||||||
@aspect_contacts_count = @aspect.contacts.size
|
@aspect_contacts_count = @aspect.contacts.size
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class HomeController < ApplicationController
|
||||||
redirect_to stream_path
|
redirect_to stream_path
|
||||||
end
|
end
|
||||||
elsif is_mobile_device?
|
elsif is_mobile_device?
|
||||||
unless(File.exist?("#{Rails.root}/app/views/home/_show.mobile.erb"))
|
unless(File.exist?(Rails.root.join('app', 'views', 'home', '_show.mobile.erb')))
|
||||||
redirect_to user_session_path
|
redirect_to user_session_path
|
||||||
else
|
else
|
||||||
render :show, :layout => 'post'
|
render :show, :layout => 'post'
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, "lib", 'stream', "person")
|
require Rails.root.join("lib", 'stream', "person")
|
||||||
|
|
||||||
class PeopleController < ApplicationController
|
class PeopleController < ApplicationController
|
||||||
before_filter :authenticate_user!, :except => [:show, :last_post]
|
before_filter :authenticate_user!, :except => [:show, :last_post]
|
||||||
|
|
@ -13,7 +13,7 @@ class PeopleController < ApplicationController
|
||||||
respond_to :js, :only => [:tag_index]
|
respond_to :js, :only => [:tag_index]
|
||||||
|
|
||||||
rescue_from ActiveRecord::RecordNotFound do
|
rescue_from ActiveRecord::RecordNotFound do
|
||||||
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
|
render :file => Rails.root.join('public', '404.html').to_s, :layout => false, :status => 404
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :search_query
|
helper_method :search_query
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib', 'stream', 'public')
|
require Rails.root.join('lib', 'stream', 'public')
|
||||||
class PublicsController < ApplicationController
|
class PublicsController < ApplicationController
|
||||||
require File.join(Rails.root, '/lib/diaspora/parser')
|
require Rails.root.join('lib', 'diaspora', 'parser')
|
||||||
require File.join(Rails.root, '/lib/postzord/receiver/public')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'public')
|
||||||
require File.join(Rails.root, '/lib/postzord/receiver/private')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'private')
|
||||||
include Diaspora::Parser
|
include Diaspora::Parser
|
||||||
|
|
||||||
# We use newrelic_ignore to prevent artifical RPM bloat; however,
|
# We use newrelic_ignore to prevent artifical RPM bloat; however,
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, "lib", "stream", "aspect")
|
require Rails.root.join("lib", "stream", "aspect")
|
||||||
require File.join(Rails.root, "lib", "stream", "multi")
|
require Rails.root.join("lib", "stream", "multi")
|
||||||
require File.join(Rails.root, "lib", "stream", "comments")
|
require Rails.root.join("lib", "stream", "comments")
|
||||||
require File.join(Rails.root, "lib", "stream", "likes")
|
require Rails.root.join("lib", "stream", "likes")
|
||||||
require File.join(Rails.root, "lib", "stream", "mention")
|
require Rails.root.join("lib", "stream", "mention")
|
||||||
require File.join(Rails.root, "lib", "stream", "followed_tag")
|
require Rails.root.join("lib", "stream", "followed_tag")
|
||||||
require File.join(Rails.root, "lib", "stream", "activity")
|
require Rails.root.join("lib", "stream", "activity")
|
||||||
|
|
||||||
|
|
||||||
class StreamsController < ApplicationController
|
class StreamsController < ApplicationController
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
require File.join(Rails.root, 'app', 'models', 'acts_as_taggable_on', 'tag')
|
require Rails.root.join('app', 'models', 'acts_as_taggable_on', 'tag')
|
||||||
require File.join(Rails.root, 'lib', 'stream', 'tag')
|
require Rails.root.join('lib', 'stream', 'tag')
|
||||||
|
|
||||||
class TagsController < ApplicationController
|
class TagsController < ApplicationController
|
||||||
skip_before_filter :set_grammatical_gender
|
skip_before_filter :set_grammatical_gender
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
require File.join(Rails.root, 'lib/diaspora/exporter')
|
require Rails.root.join('lib', 'diaspora', 'exporter')
|
||||||
require File.join(Rails.root, 'lib/collect_user_photos')
|
require Rails.root.join('lib', 'collect_user_photos')
|
||||||
|
|
||||||
before_filter :authenticate_user!, :except => [:new, :create, :public, :user_photo]
|
before_filter :authenticate_user!, :except => [:new, :create, :public, :user_photo]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.expand_path("#{Rails.root}/lib/diaspora/markdownify")
|
require Rails.root.join('lib', 'diaspora', 'markdownify')
|
||||||
|
|
||||||
module MarkdownifyHelper
|
module MarkdownifyHelper
|
||||||
def markdownify(target, render_options={})
|
def markdownify(target, render_options={})
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'uri'
|
require 'uri'
|
||||||
require File.join(Rails.root, 'lib', 'enviroment_configuration')
|
require Rails.root.join('lib', 'enviroment_configuration')
|
||||||
|
|
||||||
class AppConfig < Settingslogic
|
class AppConfig < Settingslogic
|
||||||
def self.source_file_name
|
def self.source_file_name
|
||||||
|
|
@ -11,9 +11,9 @@ class AppConfig < Settingslogic
|
||||||
puts "using remote application.yml"
|
puts "using remote application.yml"
|
||||||
return ENV['application_yml']
|
return ENV['application_yml']
|
||||||
end
|
end
|
||||||
config_file = File.join(Rails.root, "config", "application.yml")
|
config_file = Rails.root.join("config", "application.yml")
|
||||||
if !File.exists?(config_file) && (Rails.env == 'test' || Rails.env.include?("integration") || EnviromentConfiguration.heroku?)
|
if !File.exists?(config_file) && (Rails.env == 'test' || Rails.env.include?("integration") || EnviromentConfiguration.heroku?)
|
||||||
config_file = File.join(Rails.root, "config", "application.yml.example")
|
config_file = Rails.root.join("config", "application.yml.example")
|
||||||
end
|
end
|
||||||
config_file
|
config_file
|
||||||
end
|
end
|
||||||
|
|
@ -96,7 +96,7 @@ HELP
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.have_old_config_file?
|
def self.have_old_config_file?
|
||||||
File.exists?(File.join(Rails.root, "config", "app.yml")) || (File.exists?(File.join(Rails.root, "config", "app_config.yml")))
|
File.exists?(Rails.root.join("config", "app.yml")) || (File.exists?(Rails.root.join("config", "app_config.yml")))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new_relic_app_name
|
def self.new_relic_app_name
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class Base
|
class Base
|
||||||
Dir["#{Rails.root}/app/models/jobs/mail/*.rb"].each {|file| require file }
|
Dir[Rails.root.join('app', 'models', 'jobs', 'mail', '*.rb')].each {|file| require file }
|
||||||
|
|
||||||
#TODO these should be subclassed real exceptions
|
#TODO these should be subclassed real exceptions
|
||||||
DUMB_ERROR_MESSAGES = [
|
DUMB_ERROR_MESSAGES = [
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'uri'
|
require 'uri'
|
||||||
require File.join(Rails.root, 'lib/hydra_wrapper')
|
require Rails.root.join('lib', 'hydra_wrapper')
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class HttpMulti < Base
|
class HttpMulti < Base
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module Jobs
|
||||||
class NotifyLocalUsers < Base
|
class NotifyLocalUsers < Base
|
||||||
@queue = :receive_local
|
@queue = :receive_local
|
||||||
|
|
||||||
require File.join(Rails.root, 'app/models/notification')
|
require Rails.root.join('app', 'models', 'notification')
|
||||||
|
|
||||||
def self.perform(user_ids, object_klass, object_id, person_id)
|
def self.perform(user_ids, object_klass, object_id, person_id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ module Jobs
|
||||||
@queue = :http_service
|
@queue = :http_service
|
||||||
|
|
||||||
def self.perform(sender_public_url)
|
def self.perform(sender_public_url)
|
||||||
require File.join(Rails.root, 'lib/pubsubhubbub')
|
require Rails.root.join('lib', 'pubsubhubbub')
|
||||||
atom_url = sender_public_url + '.atom'
|
atom_url = sender_public_url + '.atom'
|
||||||
Pubsubhubbub.new(AppConfig[:pubsub_server]).publish(atom_url)
|
Pubsubhubbub.new(AppConfig[:pubsub_server]).publish(atom_url)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver/private')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'private')
|
||||||
module Jobs
|
module Jobs
|
||||||
class ReceiveEncryptedSalmon < Base
|
class ReceiveEncryptedSalmon < Base
|
||||||
@queue = :receive_salmon
|
@queue = :receive_salmon
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver/private')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'private')
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver/local_batch')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'local_batch')
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class ReceiveLocalBatch < Base
|
class ReceiveLocalBatch < Base
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver/public')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'public')
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class ReceiveUnencryptedSalmon < Base
|
class ReceiveUnencryptedSalmon < Base
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'uri'
|
require 'uri'
|
||||||
require File.join(Rails.root, 'lib/hcard')
|
require Rails.root.join('lib', 'hcard')
|
||||||
|
|
||||||
class Person < ActiveRecord::Base
|
class Person < ActiveRecord::Base
|
||||||
include ROXML
|
include ROXML
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,5 @@ class Service < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
require File.join(Rails.root, 'app/models/services/facebook')
|
require Rails.root.join('app', 'models', 'services', 'facebook')
|
||||||
require File.join(Rails.root, 'app/models/services/twitter')
|
require Rails.root.join('app', 'models', 'services', 'twitter')
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/salmon/salmon')
|
require Rails.root.join('lib', 'salmon', 'salmon')
|
||||||
require File.join(Rails.root, 'lib/postzord/dispatcher')
|
require Rails.root.join('lib', 'postzord', 'dispatcher')
|
||||||
|
|
||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
include Encryptor::Private
|
include Encryptor::Private
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib', 'evil_query')
|
require Rails.root.join('lib', 'evil_query')
|
||||||
|
|
||||||
|
|
||||||
#TODO: THIS FILE SHOULD NOT EXIST, EVIL SQL SHOULD BE ENCAPSULATED IN EvilQueries,
|
#TODO: THIS FILE SHOULD NOT EXIST, EVIL SQL SHOULD BE ENCAPSULATED IN EvilQueries,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'template_picker')
|
require Rails.root.join('lib', 'template_picker')
|
||||||
|
|
||||||
class PostPresenter
|
class PostPresenter
|
||||||
attr_accessor :post, :current_user
|
attr_accessor :post, :current_user
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,4 @@
|
||||||
|
|
||||||
- rescue
|
- rescue
|
||||||
:erb
|
:erb
|
||||||
<%= File.open(File.join(Rails.root, 'public/default.html')).read %>
|
<%= File.open(Rails.root.join('public', 'default.html')).read %>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ USERNAME_BLACKLIST = ['admin', 'administrator', 'hostmaster', 'info', 'postmaste
|
||||||
|
|
||||||
# Initialize the rails application
|
# Initialize the rails application
|
||||||
Diaspora::Application.initialize!
|
Diaspora::Application.initialize!
|
||||||
require File.join(Rails.root, 'lib', 'federation_logger')
|
require Rails.root.join('lib', 'federation_logger')
|
||||||
|
|
||||||
# allow token auth only for posting activitystream photos
|
# allow token auth only for posting activitystream photos
|
||||||
module Devise
|
module Devise
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'app', 'models', 'app_config')
|
require Rails.root.join('app', 'models', 'app_config')
|
||||||
|
|
@ -6,7 +6,7 @@ def load_config_yaml filename
|
||||||
YAML.load(ERB.new(File.read(filename)).result)
|
YAML.load(ERB.new(File.read(filename)).result)
|
||||||
end
|
end
|
||||||
|
|
||||||
oauth_keys_file = "#{Rails.root}/config/oauth_keys.yml"
|
oauth_keys_file = Rails.root.join('config', 'oauth_keys.yml').to_s
|
||||||
|
|
||||||
|
|
||||||
SERVICES = load_config_yaml("#{oauth_keys_file}.example")
|
SERVICES = load_config_yaml("#{oauth_keys_file}.example")
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ ENV["SSL_CERT_FILE"] = AppConfig[:ca_file]
|
||||||
CarrierWave.configure do |config|
|
CarrierWave.configure do |config|
|
||||||
if !Rails.env.test? && AppConfig[:s3_key] && AppConfig[:s3_secret] && AppConfig[:s3_bucket] && AppConfig[:s3_region]
|
if !Rails.env.test? && AppConfig[:s3_key] && AppConfig[:s3_secret] && AppConfig[:s3_bucket] && AppConfig[:s3_region]
|
||||||
config.storage = :fog
|
config.storage = :fog
|
||||||
config.cache_dir = "#{Rails.root}/tmp/uploads"
|
config.cache_dir = Rails.root.join('tmp', 'uploads').to_s
|
||||||
config.fog_credentials = {
|
config.fog_credentials = {
|
||||||
:provider => 'AWS',
|
:provider => 'AWS',
|
||||||
:aws_access_key_id => AppConfig[:s3_key],
|
:aws_access_key_id => AppConfig[:s3_key],
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/direction_detector')
|
require Rails.root.join('lib', 'direction_detector')
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Dir["#{Rails.root}/app/models/jobs/mail/*.rb"].each { |file| require file }
|
Dir[Rails.root.join('app', 'models', 'jobs', 'mail', '*.rb')].each { |file| require file }
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
require File.join(Rails.root, 'lib/messagebus/mailer')
|
require Rails.root.join('lib', 'messagebus', 'mailer')
|
||||||
|
|
||||||
Diaspora::Application.configure do
|
Diaspora::Application.configure do
|
||||||
config.action_mailer.default_url_options = {:protocol => AppConfig[:pod_uri].scheme,
|
config.action_mailer.default_url_options = {:protocol => AppConfig[:pod_uri].scheme,
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,6 @@ end
|
||||||
|
|
||||||
if AppConfig[:mount_resque_web]
|
if AppConfig[:mount_resque_web]
|
||||||
require 'resque/server'
|
require 'resque/server'
|
||||||
require File.join(Rails.root, 'lib/admin_rack')
|
require Rails.root.join('lib', 'admin_rack')
|
||||||
Resque::Server.use AdminRack
|
Resque::Server.use AdminRack
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
class UndoAddingIndicies < ActiveRecord::Migration
|
class UndoAddingIndicies < ActiveRecord::Migration
|
||||||
require File.join(Rails.root, 'db/migrate/20110213052742_add_more_indicies')
|
require Rails.root.join('db', 'migrate', '20110213052742_add_more_indicies')
|
||||||
def self.up
|
def self.up
|
||||||
AddMoreIndicies.down
|
AddMoreIndicies.down
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
require File.join(Rails.root, 'db/migrate/20110105051803_create_import_tables')
|
require Rails.root.join('db', 'migrate', '20110105051803_create_import_tables')
|
||||||
class DropImportTables < ActiveRecord::Migration
|
class DropImportTables < ActiveRecord::Migration
|
||||||
def self.up
|
def self.up
|
||||||
CreateImportTables.down
|
CreateImportTables.down
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
require File.join(Rails.root, 'db/migrate/20110319005509_add_processed_to_post')
|
require Rails.root.join('db', 'migrate', '20110319005509_add_processed_to_post')
|
||||||
class UnprocessedImageUploader < ActiveRecord::Migration
|
class UnprocessedImageUploader < ActiveRecord::Migration
|
||||||
def self.up
|
def self.up
|
||||||
AddProcessedToPost.down
|
AddProcessedToPost.down
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
class DropAspectsOpen < ActiveRecord::Migration
|
class DropAspectsOpen < ActiveRecord::Migration
|
||||||
require File.join(Rails.root, "db", "migrate", "20110202015222_add_open_to_aspects")
|
require Rails.root.join("db", "migrate", "20110202015222_add_open_to_aspects")
|
||||||
def self.up
|
def self.up
|
||||||
AddOpenToAspects.down
|
AddOpenToAspects.down
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class ShareVisibility < ActiveRecord::Base
|
||||||
belongs_to :contact
|
belongs_to :contact
|
||||||
end
|
end
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'share_visibility_converter')
|
require Rails.root.join('lib', 'share_visibility_converter')
|
||||||
|
|
||||||
class MoveRecentlyHiddenPostsToUser < ActiveRecord::Migration
|
class MoveRecentlyHiddenPostsToUser < ActiveRecord::Migration
|
||||||
def self.up
|
def self.up
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@
|
||||||
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||||
# Mayor.create(:name => 'Daley', :city => citie
|
# Mayor.create(:name => 'Daley', :city => citie
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), "..", "config", "environment")
|
require Rails.root.join('config', 'environment')
|
||||||
require 'factory_girl_rails'
|
require 'factory_girl_rails'
|
||||||
require File.join(File.dirname(__FILE__), "..", "spec", "helper_methods")
|
require Rails.root.join('spec', 'helper_methods')
|
||||||
include HelperMethods
|
include HelperMethods
|
||||||
|
|
||||||
alice = Factory(:user_with_aspect, :username => "alice", :password => 'evankorth')
|
alice = Factory(:user_with_aspect, :username => "alice", :password => 'evankorth')
|
||||||
|
|
@ -47,8 +47,8 @@ Role.add_admin(bob.person)
|
||||||
puts "done!"
|
puts "done!"
|
||||||
|
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), '..', 'spec', 'support', 'fake_resque')
|
require Rails.root.join('spec', 'support', 'fake_resque')
|
||||||
require File.join(File.dirname(__FILE__), '..', 'spec', 'support', 'user_methods')
|
require Rails.root.join('spec', 'support', 'user_methods')
|
||||||
|
|
||||||
print "Seeding post data..."
|
print "Seeding post data..."
|
||||||
time_interval = 1000
|
time_interval = 1000
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
Given /^configuration parameter (\w+) is ([^ ]+)$/ do |key, value|
|
Given /^configuration parameter (\w+) is ([^ ]+)$/ do |key, value|
|
||||||
require Rails.root.join('config', "initializers", "_load_app_config.rb")
|
require Rails.root.join('config', "initializers", "_load_app_config.rb")
|
||||||
app_value = AppConfig[ key.to_sym]
|
app_value = AppConfig[key.to_sym]
|
||||||
assert_equal value, app_value,
|
assert_equal value, app_value,
|
||||||
"You must set #{key} to #{value} and kill running server"
|
"You must set #{key} to #{value} and kill running server"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ Spork.prefork do
|
||||||
require File.join(File.dirname(__FILE__), "integration_sessions_controller")
|
require File.join(File.dirname(__FILE__), "integration_sessions_controller")
|
||||||
require File.join(File.dirname(__FILE__), "poor_mans_webmock")
|
require File.join(File.dirname(__FILE__), "poor_mans_webmock")
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods")
|
require Rails.root.join('spec', 'helper_methods')
|
||||||
require File.join(File.dirname(__FILE__), "..", "..", "spec", "support","user_methods")
|
require Rails.root.join('spec', 'support', 'user_methods')
|
||||||
include HelperMethods
|
include HelperMethods
|
||||||
|
|
||||||
# require 'webmock/cucumber'
|
# require 'webmock/cucumber'
|
||||||
|
|
@ -61,7 +61,7 @@ Spork.prefork do
|
||||||
AppConfig[:configured_services] << 'facebook'
|
AppConfig[:configured_services] << 'facebook'
|
||||||
end
|
end
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), "..", "..", "spec", "support", "fake_resque")
|
require Rails.root.join('spec', 'support', 'fake_resque')
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), 'run_resque_in_process')
|
require File.join(File.dirname(__FILE__), 'run_resque_in_process')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ module CsvGenerator
|
||||||
PATH = '/tmp/'
|
PATH = '/tmp/'
|
||||||
BACKER_CSV_LOCATION = File.join('/usr/local/app/diaspora/', 'backer_list.csv')
|
BACKER_CSV_LOCATION = File.join('/usr/local/app/diaspora/', 'backer_list.csv')
|
||||||
#BACKER_CSV_LOCATION = File.join('/home/ilya/workspace/diaspora/', 'backer_list.csv')
|
#BACKER_CSV_LOCATION = File.join('/home/ilya/workspace/diaspora/', 'backer_list.csv')
|
||||||
WAITLIST_LOCATION = File.join(Rails.root, 'config', 'mailing_list.csv')
|
WAITLIST_LOCATION = Rails.root.join('config', 'mailing_list.csv')
|
||||||
OFFSET_LOCATION = File.join(Rails.root, 'config', 'email_offset')
|
OFFSET_LOCATION = Rails.root.join('config', 'email_offset')
|
||||||
UNSUBSCRIBE_LOCATION = File.join(Rails.root, 'config', 'unsubscribe.csv')
|
UNSUBSCRIBE_LOCATION = Rails.root.join('config', 'unsubscribe.csv')
|
||||||
|
|
||||||
def self.all_active_users
|
def self.all_active_users
|
||||||
file = self.filename("all_active_users")
|
file = self.filename("all_active_users")
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, "app", "models", "acts_as_taggable_on", "tag")
|
require Rails.root.join("app", "models", "acts_as_taggable_on", "tag")
|
||||||
|
|
||||||
module Diaspora
|
module Diaspora
|
||||||
module Taggable
|
module Taggable
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ module EnviromentConfiguration
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.secret_token_initializer_is_not_present?
|
def self.secret_token_initializer_is_not_present?
|
||||||
!File.exists?( File.join(Rails.root, 'config', 'initializers', 'secret_token.rb'))
|
!File.exists?( Rails.root.join('config', 'initializers', 'secret_token.rb'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.prevent_fetching_community_spotlight?
|
def self.prevent_fetching_community_spotlight?
|
||||||
|
|
@ -27,7 +27,7 @@ module EnviromentConfiguration
|
||||||
Rails.application.config.secret_token = ENV['SECRET_TOKEN']
|
Rails.application.config.secret_token = ENV['SECRET_TOKEN']
|
||||||
elsif secret_token_initializer_is_not_present?
|
elsif secret_token_initializer_is_not_present?
|
||||||
`rake generate:secret_token`
|
`rake generate:secret_token`
|
||||||
require File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
|
require Rails.root.join('config', 'initializers', 'secret_token.rb')
|
||||||
else
|
else
|
||||||
#do nothing
|
#do nothing
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ end
|
||||||
|
|
||||||
if Rails.env.match(/integration/)
|
if Rails.env.match(/integration/)
|
||||||
puts "using federation logger"
|
puts "using federation logger"
|
||||||
logfile = File.open(File.join(Rails.root, "/log/#{Rails.env}_federation.log"), 'a') #create log file
|
logfile = File.open(Rails.root.join("log", "#{Rails.env}_federation.log"), 'a') #create log file
|
||||||
logfile.sync = true #automatically flushes data to file
|
logfile.sync = true #automatically flushes data to file
|
||||||
FEDERATION_LOGGER = FederationLogger.new(logfile) #constant accessible anywhere
|
FEDERATION_LOGGER = FederationLogger.new(logfile) #constant accessible anywhere
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
|
|
||||||
class Postzord::Dispatcher
|
class Postzord::Dispatcher
|
||||||
require File.join(Rails.root, 'lib/postzord/dispatcher/private')
|
require Rails.root.join('lib', 'postzord', 'dispatcher', 'private')
|
||||||
require File.join(Rails.root, 'lib/postzord/dispatcher/public')
|
require Rails.root.join('lib', 'postzord', 'dispatcher', 'public')
|
||||||
|
|
||||||
attr_reader :sender, :object, :xml, :subscribers, :opts
|
attr_reader :sender, :object, :xml, :subscribers, :opts
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
|
|
||||||
class Postzord::Receiver
|
class Postzord::Receiver
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver/private')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'private')
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver/public')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'public')
|
||||||
|
|
||||||
def perform!
|
def perform!
|
||||||
self.receive!
|
self.receive!
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/webfinger')
|
require Rails.root.join('lib', 'webfinger')
|
||||||
require File.join(Rails.root, 'lib/diaspora/parser')
|
require Rails.root.join('lib', 'diaspora', 'parser')
|
||||||
|
|
||||||
class Postzord::Receiver::Private < Postzord::Receiver
|
class Postzord::Receiver::Private < Postzord::Receiver
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ end
|
||||||
|
|
||||||
# Verify documents secured with Magic Signatures
|
# Verify documents secured with Magic Signatures
|
||||||
module Salmon
|
module Salmon
|
||||||
autoload :Slap, File.join(Rails.root, "lib", "salmon", "slap")
|
autoload :Slap, Rails.root.join("lib", "salmon", "slap")
|
||||||
autoload :EncryptedSlap, File.join(Rails.root, "lib", "salmon", "encrypted_slap")
|
autoload :EncryptedSlap, Rails.root.join("lib", "salmon", "encrypted_slap")
|
||||||
autoload :MagicSigEnvelope, File.join(Rails.root, "lib", "salmon", "magic_sig_envelope")
|
autoload :MagicSigEnvelope, Rails.root.join("lib", "salmon", "magic_sig_envelope")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
require File.join(Rails.root, "lib", "publisher")
|
require Rails.root.join("lib", "publisher")
|
||||||
class Stream::Base
|
class Stream::Base
|
||||||
TYPES_OF_POST_IN_STREAM = ['StatusMessage', 'Reshare', 'ActivityStreams::Photo']
|
TYPES_OF_POST_IN_STREAM = ['StatusMessage', 'Reshare', 'ActivityStreams::Photo']
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ desc "revert custom landing page commit after heroku san deploys"
|
||||||
task :after_deploy => :environment do
|
task :after_deploy => :environment do
|
||||||
|
|
||||||
# Perform this task only if custom landing page is not present in app/views/home/_show.html.haml
|
# Perform this task only if custom landing page is not present in app/views/home/_show.html.haml
|
||||||
if (File.exist?(File.join(Rails.root, "app", "views", "home", "_show.html.erb")) || File.exist?(File.join(Rails.root, "app", "views", "home", "_show.mobile.erb"))) && system("git log | head -5 | grep 'custom\ landing\ page(s)'")
|
if (File.exist?(Rails.root.join("app", "views", "home", "_show.html.erb")) || File.exist?(Rails.root.join("app", "views", "home", "_show.mobile.erb"))) && system("git log | head -5 | grep 'custom\ landing\ page(s)'")
|
||||||
puts "-----> resetting HEAD before custom landing page commit"
|
puts "-----> resetting HEAD before custom landing page commit"
|
||||||
|
|
||||||
system("git reset HEAD^") ? true : fail
|
system("git reset HEAD^") ? true : fail
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
require File.join(Rails.root, 'lib', 'rake_helpers')
|
require Rails.root.join('lib', 'rake_helpers')
|
||||||
include RakeHelpers
|
include RakeHelpers
|
||||||
|
|
||||||
namespace :invites do
|
namespace :invites do
|
||||||
|
|
@ -11,8 +11,8 @@ namespace :invites do
|
||||||
task :send, :number, :test do |t, args|
|
task :send, :number, :test do |t, args|
|
||||||
require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment')
|
require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment')
|
||||||
|
|
||||||
filename = File.join(Rails.root, 'config', 'mailing_list.csv')
|
filename = Rails.root.join('config', 'mailing_list.csv')
|
||||||
offset_filename = File.join(Rails.root, 'config', 'email_offset')
|
offset_filename = Rails.root.join('config', 'email_offset')
|
||||||
number_of_backers = args[:number] ? args[:number].to_i : 1000
|
number_of_backers = args[:number] ? args[:number].to_i : 1000
|
||||||
|
|
||||||
offset = if File.exists?(offset_filename)
|
offset = if File.exists?(offset_filename)
|
||||||
|
|
@ -26,7 +26,7 @@ namespace :invites do
|
||||||
finish_num = process_emails(filename, number_of_backers, offset, test)
|
finish_num = process_emails(filename, number_of_backers, offset, test)
|
||||||
|
|
||||||
new_offset = offset + finish_num + 1
|
new_offset = offset + finish_num + 1
|
||||||
File.open(File.join(Rails.root, 'config', 'email_offset'), 'w') do |f|
|
File.open(Rails.root.join('config', 'email_offset'), 'w') do |f|
|
||||||
f.write(new_offset)
|
f.write(new_offset)
|
||||||
end
|
end
|
||||||
puts "you ended on #{new_offset}"
|
puts "you ended on #{new_offset}"
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ namespace :ci do
|
||||||
puts "Stopping virtual display..."
|
puts "Stopping virtual display..."
|
||||||
`sh -e /etc/init.d/xvfb stop`
|
`sh -e /etc/init.d/xvfb stop`
|
||||||
puts "Cleaning up..."
|
puts "Cleaning up..."
|
||||||
FileUtils.rm_rf("#{Rails.root}/public/uploads/images")
|
FileUtils.rm_rf(Rails.root.join('public', 'uploads', 'images'))
|
||||||
FileUtils.rm_rf("#{Rails.root}/public/uploads/tmp")
|
FileUtils.rm_rf(Rails.root.join('public', 'uploads', 'tmp'))
|
||||||
raise "tests failed!" unless exit_status == 0
|
raise "tests failed!" unless exit_status == 0
|
||||||
puts "All tests passed!"
|
puts "All tests passed!"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
desc 'Seeds cool users'
|
desc 'Seeds cool users'
|
||||||
task :cool => :environment do
|
task :cool => :environment do
|
||||||
require 'factory_girl_rails'
|
require 'factory_girl_rails'
|
||||||
cool_people_yml = YAML.load(File.open(File.join(Rails.root, 'config', 'cool_people.yml')))
|
cool_people_yml = YAML.load(File.open(Rails.root.join('config', 'cool_people.yml')))
|
||||||
|
|
||||||
cool_people_yml.each do |name, attributes|
|
cool_people_yml.each do |name, attributes|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
||||||
|
|
||||||
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
vendored_cucumber_bin = Dir[Rails.root.join('vendor', '{gems,plugins}', 'cucumber*', 'bin', 'cucumber')].first
|
||||||
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ namespace :generate do
|
||||||
desc 'Generates a Session Secret Token'
|
desc 'Generates a Session Secret Token'
|
||||||
task :secret_token do
|
task :secret_token do
|
||||||
|
|
||||||
path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
|
path = Rails.root.join('config', 'initializers', 'secret_token.rb')
|
||||||
secret = SecureRandom.hex(40)
|
secret = SecureRandom.hex(40)
|
||||||
File.open(path, 'w') do |f|
|
File.open(path, 'w') do |f|
|
||||||
f.write <<"EOF"
|
f.write <<"EOF"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#licensed under the Affero General Public License version 3 or later. See
|
#licensed under the Affero General Public License version 3 or later. See
|
||||||
#the COPYRIGHT file.
|
#the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib', 'enviroment_configuration')
|
require Rails.root.join('lib', 'enviroment_configuration')
|
||||||
|
|
||||||
namespace :heroku do
|
namespace :heroku do
|
||||||
HEROKU_CONFIG_ADD_COMMAND = "heroku config:add"
|
HEROKU_CONFIG_ADD_COMMAND = "heroku config:add"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ namespace :migrations do
|
||||||
|
|
||||||
desc 'copy all hidden share visibilities from share_visibilities to users. Can be run with the site still up.'
|
desc 'copy all hidden share visibilities from share_visibilities to users. Can be run with the site still up.'
|
||||||
task :copy_hidden_share_visibilities_to_users => [:environment] do
|
task :copy_hidden_share_visibilities_to_users => [:environment] do
|
||||||
require File.join(Rails.root, 'lib', 'share_visibility_converter')
|
require Rails.root.join('lib', 'share_visibility_converter')
|
||||||
ShareVisibilityConverter.copy_hidden_share_visibilities_to_users
|
ShareVisibilityConverter.copy_hidden_share_visibilities_to_users
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
require File.join(Rails.root, 'lib', 'statistics' )
|
require Rails.root.join('lib', 'statistics' )
|
||||||
|
|
||||||
namespace :stats do
|
namespace :stats do
|
||||||
desc 'Emails recent engagement statistics the admins'
|
desc 'Emails recent engagement statistics the admins'
|
||||||
task :save_retention => :environment do
|
task :save_retention => :environment do
|
||||||
require File.join(Rails.root, 'app', 'mailers', 'notifier' )
|
require Rails.root.join('app', 'mailers', 'notifier' )
|
||||||
|
|
||||||
return unless AppConfig[:admins].present?
|
return unless AppConfig[:admins].present?
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace :stats do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(File.join(Rails.root, "tmp", "retention_stats_#{Time.now.strftime("%Y-%m-%d-%H:%M:%S-%Z")}.txt"), "w") do |file|
|
File.open(Rails.root.join("tmp", "retention_stats_#{Time.now.strftime("%Y-%m-%d-%H:%M:%S-%Z")}.txt"), "w") do |file|
|
||||||
file << string
|
file << string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -35,6 +35,6 @@ namespace :stats do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open("#{Rails.root}/tmp/top_actives.csv", 'w') {|f| f.write(string) }
|
File.open(Rails.root.join('tmp', 'top_actives.csv'), 'w') {|f| f.write(string) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require File.join(Rails.root, 'lib/hcard')
|
require Rails.root.join('lib', 'hcard')
|
||||||
require File.join(Rails.root, 'lib/webfinger_profile')
|
require Rails.root.join('lib', 'webfinger_profile')
|
||||||
|
|
||||||
class Webfinger
|
class Webfinger
|
||||||
attr_accessor :host_meta_xrd, :webfinger_profile_xrd,
|
attr_accessor :host_meta_xrd, :webfinger_profile_xrd,
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,11 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
require 'pathname'
|
||||||
|
|
||||||
class Rails
|
class Rails
|
||||||
def self.root
|
def self.root
|
||||||
File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
@@root ||= Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), "..")))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.env
|
def self.env
|
||||||
|
|
@ -22,7 +23,7 @@ if ARGV.length >= 1
|
||||||
setting_name = ARGV[0]
|
setting_name = ARGV[0]
|
||||||
if Rails.env == 'script_server' # load from the special script_server_config.yml file
|
if Rails.env == 'script_server' # load from the special script_server_config.yml file
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
script_server_config_file = File.join(Rails.root, 'config', 'script_server.yml')
|
script_server_config_file = Rails.root.join('config', 'script_server.yml')
|
||||||
begin
|
begin
|
||||||
print YAML.load_file(script_server_config_file)['script_server'][setting_name]
|
print YAML.load_file(script_server_config_file)['script_server'][setting_name]
|
||||||
rescue
|
rescue
|
||||||
|
|
@ -34,7 +35,7 @@ if ARGV.length >= 1
|
||||||
require 'active_support/core_ext/class/attribute_accessors'
|
require 'active_support/core_ext/class/attribute_accessors'
|
||||||
require 'active_support/core_ext/object/blank'
|
require 'active_support/core_ext/object/blank'
|
||||||
require 'settingslogic'
|
require 'settingslogic'
|
||||||
require File.join(Rails.root, 'app', 'models', 'app_config')
|
require Rails.root.join('app', 'models', 'app_config')
|
||||||
setting_name = setting_name.to_sym
|
setting_name = setting_name.to_sym
|
||||||
if (!AppConfig.respond_to?(setting_name) || AppConfig.send(setting_name).nil?) && AppConfig[setting_name].nil?
|
if (!AppConfig.respond_to?(setting_name) || AppConfig.send(setting_name).nil?) && AppConfig[setting_name].nil?
|
||||||
$stderr.puts "Could not find setting #{ARGV[0]} for environment #{Rails.env}."
|
$stderr.puts "Could not find setting #{ARGV[0]} for environment #{Rails.env}."
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ describe PhotosController do
|
||||||
@params = {
|
@params = {
|
||||||
:photo => {:aspect_ids => "all"},
|
:photo => {:aspect_ids => "all"},
|
||||||
:qqfile => Rack::Test::UploadedFile.new(
|
:qqfile => Rack::Test::UploadedFile.new(
|
||||||
File.join( Rails.root, "spec/fixtures/button.png" ),
|
Rails.root.join("spec", "fixtures", "button.png").to_s,
|
||||||
"image/png"
|
"image/png"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe PublicsController do
|
describe PublicsController do
|
||||||
let(:fixture_path) { File.join(Rails.root, 'spec', 'fixtures')}
|
let(:fixture_path) { Rails.root.join('spec', 'fixtures') }
|
||||||
before do
|
before do
|
||||||
@user = alice
|
@user = alice
|
||||||
@person = Factory(:person)
|
@person = Factory(:person)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'lib/diaspora/exporter')
|
require Rails.root.join('lib', 'diaspora', 'exporter')
|
||||||
|
|
||||||
describe Diaspora::Exporter do
|
describe Diaspora::Exporter do
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'lib/hcard')
|
require Rails.root.join('lib', 'hcard')
|
||||||
|
|
||||||
describe HCard do
|
describe HCard do
|
||||||
it 'should parse an hcard' do
|
it 'should parse an hcard' do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'lib/postzord/dispatcher/private')
|
require Rails.root.join('lib', 'postzord', 'dispatcher', 'private')
|
||||||
|
|
||||||
describe Postzord::Dispatcher::Private do
|
describe Postzord::Dispatcher::Private do
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/postzord/dispatcher')
|
require Rails.root.join('lib', 'postzord', 'dispatcher')
|
||||||
|
|
||||||
describe Postzord::Dispatcher do
|
describe Postzord::Dispatcher do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'lib','postzord', 'receiver', 'local_batch')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'local_batch')
|
||||||
|
|
||||||
describe Postzord::Receiver::LocalBatch do
|
describe Postzord::Receiver::LocalBatch do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/postzord')
|
require Rails.root.join('lib', 'postzord')
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver/private')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'private')
|
||||||
|
|
||||||
describe Postzord::Receiver::Private do
|
describe Postzord::Receiver::Private do
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/postzord')
|
require Rails.root.join('lib', 'postzord')
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver/public')
|
require Rails.root.join('lib', 'postzord', 'receiver', 'public')
|
||||||
|
|
||||||
describe Postzord::Receiver::Public do
|
describe Postzord::Receiver::Public do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib/postzord/receiver')
|
require Rails.root.join('lib', 'postzord', 'receiver')
|
||||||
|
|
||||||
describe Postzord::Receiver do
|
describe Postzord::Receiver do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
#NOTE;why is it not auto loadeded?
|
#NOTE;why is it not auto loadeded?
|
||||||
require File.join(Rails.root, 'lib', 'publisher')
|
require Rails.root.join('lib', 'publisher')
|
||||||
|
|
||||||
describe Publisher do
|
describe Publisher do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'lib', 'pubsubhubbub')
|
require Rails.root.join('lib', 'pubsubhubbub')
|
||||||
|
|
||||||
describe Pubsubhubbub do
|
describe Pubsubhubbub do
|
||||||
describe '#publish' do
|
describe '#publish' do
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'lib/rake_helpers.rb')
|
require Rails.root.join('lib', 'rake_helpers')
|
||||||
include RakeHelpers
|
include RakeHelpers
|
||||||
describe RakeHelpers do
|
describe RakeHelpers do
|
||||||
before do
|
before do
|
||||||
@csv = File.join(Rails.root, 'spec/fixtures/test.csv')
|
@csv = Rails.root.join('spec', 'fixtures', 'test.csv')
|
||||||
end
|
end
|
||||||
describe '#process_emails' do
|
describe '#process_emails' do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'lib/statistics')
|
require Rails.root.join('lib', 'statistics')
|
||||||
|
|
||||||
describe Statistics do
|
describe Statistics do
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::Activity do
|
describe Stream::Activity do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
describe Stream::Base do
|
describe Stream::Base do
|
||||||
before do
|
before do
|
||||||
@stream = Stream::Base.new(alice)
|
@stream = Stream::Base.new(alice)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::Comments do
|
describe Stream::Comments do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::FollowedTag do
|
describe Stream::FollowedTag do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::Likes do
|
describe Stream::Likes do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::Mention do
|
describe Stream::Mention do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::Multi do
|
describe Stream::Multi do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::Person do
|
describe Stream::Person do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::Public do
|
describe Stream::Public do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
describe Stream::Tag do
|
describe Stream::Tag do
|
||||||
context 'with a user' do
|
context 'with a user' do
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe WebfingerProfile do
|
describe WebfingerProfile do
|
||||||
let(:webfinger_profile){File.open(File.join(Rails.root, "spec/fixtures/finger_xrd")).read.strip}
|
let(:webfinger_profile){File.open(Rails.root.join("spec", "fixtures", "finger_xrd")).read.strip}
|
||||||
let(:not_diaspora_webfinger){File.open(File.join(Rails.root, "spec/fixtures/nonseed_finger_xrd")).read.strip}
|
let(:not_diaspora_webfinger){File.open(Rails.root.join("spec", "fixtures", "nonseed_finger_xrd")).read.strip}
|
||||||
|
|
||||||
let(:account){"tom@tom.joindiaspora.com"}
|
let(:account){"tom@tom.joindiaspora.com"}
|
||||||
let(:profile){ WebfingerProfile.new(account, webfinger_profile) }
|
let(:profile){ WebfingerProfile.new(account, webfinger_profile) }
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Webfinger do
|
describe Webfinger do
|
||||||
let(:host_meta_xrd) { File.open(File.join(Rails.root, 'spec', 'fixtures', 'host-meta.fixture.html')).read }
|
let(:host_meta_xrd) { File.open(Rails.root.join('spec', 'fixtures', 'host-meta.fixture.html')).read }
|
||||||
let(:webfinger_xrd) { File.open(File.join(Rails.root, 'spec', 'fixtures', 'webfinger.fixture.html')).read }
|
let(:webfinger_xrd) { File.open(Rails.root.join('spec', 'fixtures', 'webfinger.fixture.html')).read }
|
||||||
let(:hcard_xml) { File.open(File.join(Rails.root, 'spec', 'fixtures', 'hcard.fixture.html')).read }
|
let(:hcard_xml) { File.open(Rails.root.join('spec', 'fixtures', 'hcard.fixture.html')).read }
|
||||||
let(:account){'foo@bar.com'}
|
let(:account){'foo@bar.com'}
|
||||||
let(:account_in_fixtures){"alice@localhost:9887"}
|
let(:account_in_fixtures){"alice@localhost:9887"}
|
||||||
let(:finger){Webfinger.new(account)}
|
let(:finger){Webfinger.new(account)}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ describe AppConfig do
|
||||||
context "with old-style application.yml" do
|
context "with old-style application.yml" do
|
||||||
before do
|
before do
|
||||||
@original_source = AppConfig.source
|
@original_source = AppConfig.source
|
||||||
AppConfig.source(File.join(Rails.root, "spec", "fixtures", "config", "old_style_app.yml"))
|
AppConfig.source(Rails.root.join("spec", "fixtures", "config", "old_style_app.yml"))
|
||||||
end
|
end
|
||||||
after do
|
after do
|
||||||
AppConfig.source(@original_source)
|
AppConfig.source(@original_source)
|
||||||
|
|
@ -42,8 +42,8 @@ describe AppConfig do
|
||||||
context "when source config file (i.e. config/application.yml) does not exist" do
|
context "when source config file (i.e. config/application.yml) does not exist" do
|
||||||
before do
|
before do
|
||||||
application_yml = AppConfig.source_file_name
|
application_yml = AppConfig.source_file_name
|
||||||
@app_yml = File.join(Rails.root, "config", "app.yml")
|
@app_yml = Rails.root.join("config", "app.yml")
|
||||||
@app_config_yml = File.join(Rails.root, "config", "app_config.yml")
|
@app_config_yml = Rails.root.join("config", "app_config.yml")
|
||||||
File.should_receive(:exists?).with(application_yml).at_least(:once).and_return(false)
|
File.should_receive(:exists?).with(application_yml).at_least(:once).and_return(false)
|
||||||
end
|
end
|
||||||
after do
|
after do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require "#{Rails.root}/lib/pubsubhubbub"
|
require Rails.root.join('lib', 'pubsubhubbub')
|
||||||
|
|
||||||
describe Jobs::PublishToHub do
|
describe Jobs::PublishToHub do
|
||||||
describe '.perform' do
|
describe '.perform' do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, "spec", "shared_behaviors", "relayable")
|
require Rails.root.join("spec", "shared_behaviors", "relayable")
|
||||||
|
|
||||||
describe Like do
|
describe Like do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.join(Rails.root, "spec", "shared_behaviors", "relayable")
|
require Rails.root.join("spec", "shared_behaviors", "relayable")
|
||||||
|
|
||||||
describe RelayableRetraction do
|
describe RelayableRetraction do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ Spork.prefork do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Force fixture rebuild
|
# Force fixture rebuild
|
||||||
FileUtils.rm_f(File.join(Rails.root, 'tmp', 'fixture_builder.yml'))
|
FileUtils.rm_f(Rails.root.join('tmp', 'fixture_builder.yml'))
|
||||||
|
|
||||||
# Requires supporting files with custom matchers and macros, etc,
|
# Requires supporting files with custom matchers and macros, etc,
|
||||||
# in ./support/ and its subdirectories.
|
# in ./support/ and its subdirectories.
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
module JasmineFixtureGeneration
|
module JasmineFixtureGeneration
|
||||||
# Saves the markup to a fixture file using the given name
|
# Saves the markup to a fixture file using the given name
|
||||||
def save_fixture(markup, name, fixture_path=nil )
|
def save_fixture(markup, name, fixture_path=nil )
|
||||||
fixture_path = File.join(Rails.root, 'tmp', 'js_dom_fixtures') unless fixture_path
|
fixture_path = Rails.root.join('tmp', 'js_dom_fixtures') unless fixture_path
|
||||||
Dir.mkdir(fixture_path) unless File.exists?(fixture_path)
|
Dir.mkdir(fixture_path) unless File.exists?(fixture_path)
|
||||||
|
|
||||||
fixture_file = File.join(fixture_path, "#{name}.fixture.html")
|
fixture_file = fixture_path.join("#{name}.fixture.html")
|
||||||
File.open(fixture_file, 'w') do |file|
|
File.open(fixture_file, 'w') do |file|
|
||||||
file.puts(markup)
|
file.puts(markup)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue