Class: SprocketsFS::Mount
- Inherits:
-
Object
- Object
- SprocketsFS::Mount
- Includes:
- FromHash
- Defined in:
- lib/sprockets_fs/rails.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.parsed ⇒ Object
63 64 65 66 67 |
# File 'lib/sprockets_fs/rails.rb', line 63 def parsed res = new res.parse! res end |
Instance Method Details
#mount! ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/sprockets_fs/rails.rb', line 54 def mount! if FileTest.exist?("#{parent_dir}/config/environment.rb") mount_rails! else mount_regular! end end |
#mount_rails! ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/sprockets_fs/rails.rb', line 33 def mount_rails! if FileTest.exist?(mount_dir) ec "rm -r #{mount_dir}/*" if Dir["#{mount_dir}/*"].size > 0 else FileUtils.mkdir(mount_dir) end load "#{parent_dir}/config/environment.rb" env = app_obj.assets dir = SprocketsFS::SprocketsDir.new(:parent_dirs => env.paths, :env => env, :mount_dir => mount_dir) FuseFS.start(dir,mount_dir) end |
#mount_regular! ⇒ Object
48 49 50 51 52 |
# File 'lib/sprockets_fs/rails.rb', line 48 def mount_regular! dir = SprocketsFS::SprocketsDir.new(:parent_dir => parent_dir, :mount_dir => mount_dir) FuseFS.start(dir,mount_dir) end |
#parse! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sprockets_fs/rails.rb', line 11 def parse! require 'optparse' OptionParser.new do |opts| opts. = "Usage: sprockets_fs" opts.on("-m", "--mount-point MOUNT_POINT", "Mount Point") do |v| self.mount_dir = File.(v) end opts.on("-p", "--parent-dir PARENT_DIR", "Parent Dir") do |v| self.parent_dir = File.(v) end end.parse! end |