Skip to content

Commit

Permalink
Use shared directory path instead of marker
Browse files Browse the repository at this point in the history
  • Loading branch information
merqlove committed Jan 8, 2016
1 parent 2afe2a3 commit ac32e02
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/sprig/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module Sprig
class Configuration

attr_writer :directory, :logger, :shared
attr_writer :directory, :logger, :shared_directory

def directory
Rails.root.join(@directory || default_directory, environment_directory)
Rails.root.join(@directory || default_directory, source_directory)
end

def shared
@shared ||= false
def shared_directory
@shared_directory
end

def logger
Expand All @@ -17,8 +17,8 @@ def logger

private

def environment_directory
shared ? '' : Rails.env
def source_directory
shared_directory || Rails.env
end

def default_directory
Expand Down
10 changes: 5 additions & 5 deletions spec/lib/sprig/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
end
end

describe "#shared" do
it "returns false by default" do
subject.shared.should == false
describe "#shared_directory" do
it "returns nil by default" do
subject.shared_directory.should == nil
end

it "returns a shared directory" do
subject.shared = true
subject.shared_directory = 'shared'
subject.directory = 'seed_files'

subject.directory.to_path.should == '~/seed_files'
subject.directory.to_path.should == '~/seed_files/shared'
end
end

Expand Down

0 comments on commit ac32e02

Please sign in to comment.