Module: CodeSync::MiddlemanExtension

Defined in:
lib/middleman_extension.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.registered(app, options_hash = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/middleman_extension.rb', line 8

def registered app, options_hash={}

  app.after_configuration do
    unless build?
      pid = fork do
        source = begin
          File.join(app.root, app.source)
        rescue
          File.join(Dir.pwd(),'source')
        end

        CodeSync::Manager.start(root: source,
          sprockets: (sprockets rescue nil),
          forbid_saving: (options_hash[:forbid_saving] == true),
          parent:'middleman'
        )
      end
    end
  end

  trap("SIGINT") do
    Process.kill(9,pid) rescue nil
  end
end