Module: Distil

Defined in:
lib/distil.rb,
lib/distil/server.rb,
lib/distil/browser.rb,
lib/distil/library.rb,
lib/distil/product.rb,
lib/distil/project.rb,
lib/distil/file-vendor.rb,
lib/distil/source-file.rb,
lib/distil/configurable.rb,
lib/distil/build-failure.rb,
lib/distil/error-reporter.rb,
lib/distil/product/css-product.rb,
lib/distil/product/html-product.rb,
lib/distil/source-file/css-file.rb,
lib/distil/source-file/html-file.rb,
lib/distil/source-file/json-file.rb,
lib/distil/recursive-http-fetcher.rb,
lib/distil/javascript-file-validator.rb,
lib/distil/product/javascript-product.rb,
lib/distil/source-file/javascript-file.rb,
lib/distil/product/cache-manifest-product.rb,
lib/distil/source-file/yui-minifiable-file.rb

Defined Under Namespace

Modules: ErrorReporter, FileVendor, JavascriptFileValidator, YuiMinifiableFile Classes: Browser, BuildFailure, CacheManifestProduct, Configurable, CssFile, CssProduct, HtmlFile, HtmlProduct, JavascriptFile, JavascriptProduct, JsonFile, Library, Product, Project, RecursiveHTTPFetcher, SourceFile, ValidationError

Constant Summary collapse

COMPRESSOR =
File.expand_path("#{VENDOR_DIR}/yuicompressor-2.4.2.jar")
LIBRARY_CACHE_FOLDER =
File.expand_path("~/.distil/library_cache")
RELEASE_VARIANT =
:release
DEBUG_VARIANT =
:debug
BUILD_FILE =
'Buildfile'
DEFAULT_OUTPUT_FOLDER =
'build'
DEFAULT_DOC_OUTPUT_FOLDER =
'doc'
DEFAULT_LANGUAGE =
'en'
DEFAULT_DOC_FOLDER =
'doc'
APPLICATION_TYPE =
'application'
FRAMEWORK_TYPE =
'framework'
CSS_IMPORT_REGEX =
/@import\s+url\("?(.*\.css)"?\)/
CSS_IMAGE_URL_REGEX =
/url\("?([^)]*\.(jpg|png|gif|otf))"?\)/
JSL_CONF =
"#{LIB_DIR}/jsl.conf"
LINT_COMMAND =
"#{VENDOR_DIR}/jsl-0.3.0/bin/jsl"
JS_GLOBALS =

LINT_COMMAND= “/Users/jeff/.gem/ruby/1.8/gems/distil-0.13.6/vendor/jsl-0.3.0/bin/jsl”

Set.new ['Array', 'Boolean', 'Date', 'Error', 'EvalError',
'Function', 'Math', 'Number', 'Object', 'RangeError',
'ReferenceError', 'RegExp', 'String', 'SyntaxError',
'TypeError', 'URIError']
BOOTSTRAP_SCRIPT =
"#{ASSETS_DIR}/distil.js"
FILE_SEPARATOR =
"        /*jsl:ignore*/;/*jsl:end*/"
JSL_IMPORT_REGEX =
/\/\*jsl:import\s+([^\*]*)\*\//
NIB_ASSET_REGEX =
/(NIB\.asset(?:Url)?)\(['"]([^)]+)['"]\)/
NIB_DECLARATION_REGEX =
/NIB\(\s*(["'])(\w(?:\w|-)*)\1\s*,/
DISTIL_ASSET_REGEX =
/(distil.asset(?:Url)?)\(['"]([^)]+)['"]\)/

Class Method Summary collapse

Class Method Details

.start_server(project, options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/distil/server.rb', line 3

def self.start_server(project, options)
  require 'webrick'
  require 'directory_watcher'
  
  port= options['server_port'] || 8888;
  path= options['url']
  config= {
    :Port => port
  }

  server= WEBrick::HTTPServer.new(config)
  server.mount(path || '/', WEBrick::HTTPServlet::FileHandler, project.output_path)

  ['INT', 'TERM'].each { |signal|
     trap(signal){ server.shutdown }
  }

  puts "watching #{project.folder}"
  dw = DirectoryWatcher.new(project.folder, {
    :glob=>"**/*",
    :pre_load => true,
    :interval => 1
  })
  dw.add_observer { |*args|
    args.each { |event|
      puts event
      if :modified==event.type
        puts event.path
      end
    }
  }

  dw.start
  gets
  # b= Browser.new
  # b.open("http://localhost:#{port}/#{path}")
  # server.start
  dw.stop
end