Skip to content

Commit

Permalink
restructure a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Sep 18, 2016
1 parent a63ed91 commit df9c6c6
Show file tree
Hide file tree
Showing 23 changed files with 142 additions and 5 deletions.
12 changes: 11 additions & 1 deletion lib/rails_module_unification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
module RailsModuleUnification
extend ActiveSupport::Autoload

module_function

def directory=(dir)
@directory = dir
end

def directory
@directory || ''
end

require 'rails_module_unification/railtie'
ActiveSupport::Dependencies.extend ActiveSupportExtensions
ActiveSupport::Dependencies.extend RailsModuleUnification::ActiveSupportExtensions
end
2 changes: 1 addition & 1 deletion lib/rails_module_unification/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module RailsModuleUnification
class Railtie < Rails::Railtie
initializer 'activeservice.autoload', before: :set_autoload_paths do |app|
# TODO: make the module unification root directory configurable
mu_dir = "#{Rails.root}/app/mu"
mu_dir = "#{Rails.root}/app/#{RailsModuleUnification.directory}"

# Data
data_paths = Dir["#{mu_dir}/data/**/"]
Expand Down
1 change: 1 addition & 0 deletions spec/support/rails_app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem 'rails', '~> 5.0.0'
gem 'sqlite3'

gem 'active_model_serializers'
gem 'rails_module_unification', path: '../rails_module_unification'

# Use Puma as the app server
gem 'puma', '~> 3.0'
Expand Down
1 change: 0 additions & 1 deletion spec/support/rails_app/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require_relative 'boot'

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
Expand Down
2 changes: 0 additions & 2 deletions spec/support/rails_app/config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Load the Rails application.
require_relative 'application'

require 'rails_module_unification'

# Initialize the Rails application.
Rails.application.initialize!
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: this currently doesn't work, because the railtie
# adds to the autoload paths before this file is required
# RailsModuleUnification.directory = 'mu'
110 changes: 110 additions & 0 deletions spec/support/rails_app/log/development.log

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions spec/unit/active_support_extensions_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'spec_helper'

describe RailsModuleUnification::ActiveSupportExtensions do
describe 'load_from_parent' do

end

describe 'load_from_path' do

end

describe 'load_missing_constant' do


end
end

0 comments on commit df9c6c6

Please sign in to comment.