bradgessler-app-slice 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 3
4
+ :patch: 4
@@ -1,11 +1,12 @@
1
1
  require File.join(File.dirname(__FILE__), %w[.. app_slice])
2
2
  require File.join(File.dirname(__FILE__), %w[rails initializer])
3
+ require File.join(File.dirname(__FILE__), %w[rails file])
3
4
 
4
5
  module AppSlice
5
6
  module Rails
6
7
  class << self
7
8
  def init!
8
- ::Rails.public_path = File.join(root, 'public')
9
+ ::Rails.public_path = public_path
9
10
  ::ActionController::Routing::Routes.add_configuration_file File.join(config_path, 'routes.rb')
10
11
  # Update frameworks with view_paths
11
12
  [::ActionController, ::ActionMailer].each do |framework|
@@ -26,6 +27,10 @@ module AppSlice
26
27
  File.join(config_path, 'environments', "#{RAILS_ENV}.rb")
27
28
  end
28
29
 
30
+ def public_path
31
+ File.join(root, 'public')
32
+ end
33
+
29
34
  def root_environment_path
30
35
  File.join(config_path, 'environment.rb')
31
36
  end
@@ -0,0 +1,24 @@
1
+ module AppSlice
2
+ module Rails
3
+ class File < File
4
+ # Try to open a file from the AppSlice, then RoR root, followed by the root on the machine
5
+ def self.try(path, *args)
6
+ open(detect(path), *args)
7
+ end
8
+
9
+ # Tries to detect a file within the AppSlice root, then Rails, then whatever file join does...
10
+ def self.detect(path, *args)
11
+ app_slice_path = join(AppSlice::Rails.root, path)
12
+ rails_path = join(::Rails.root, path)
13
+
14
+ if exists?(app_slice_path)
15
+ app_slice_path
16
+ elsif exists?(rails_path)
17
+ rails_path
18
+ else
19
+ path
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bradgessler-app-slice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-02 00:00:00 -07:00
12
+ date: 2009-05-11 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -28,6 +28,7 @@ files:
28
28
  - lib/app_slice/middleware/static.rb
29
29
  - lib/app_slice/middleware.rb
30
30
  - lib/app_slice/rails
31
+ - lib/app_slice/rails/file.rb
31
32
  - lib/app_slice/rails/initializer.rb
32
33
  - lib/app_slice/rails.rb
33
34
  - lib/app_slice.rb