Module: Tres

Defined in:
lib/tres.rb,
lib/tres/app.rb,
lib/tres/errors.rb,
lib/tres/logger.rb,
lib/tres/server.rb,
lib/tres/packager.rb,
lib/ext/filemethods.rb,
lib/tres/rack_logger.rb,
lib/tres/asset_manager.rb,
lib/tres/template_manager.rb

Defined Under Namespace

Modules: FileMethods Classes: App, AssetManager, CantParseJSONFile, Logger, NoSuchFile, Packager, RackLogger, ScriptExistsError, Server, TemplateExistsError, TemplateManager

Constant Summary collapse

OUTPUT_FORMAT =
"   → %s"
VERSION =
File.read Tres.root/'VERSION'

Class Method Summary collapse

Class Method Details

.error(message) ⇒ Object



43
44
45
# File 'lib/tres.rb', line 43

def error message
  STDERR.puts message unless quiet?
end

.quiet!Object



20
21
22
# File 'lib/tres.rb', line 20

def quiet!
  @quiet = true
end

.quiet?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/tres.rb', line 24

def quiet?
  !!@quiet
end

.rootObject



47
48
49
# File 'lib/tres.rb', line 47

def root
  @root ||= File.expand_path File.dirname(__FILE__)/'..'
end

.say(something) ⇒ Object



32
33
34
35
# File 'lib/tres.rb', line 32

def say something
  STDOUT.puts(OUTPUT_FORMAT % something) unless quiet?
  yield if block_given?
end

.say_progress(something, done = '✔'.colorize(:green)) ⇒ Object



37
38
39
40
41
# File 'lib/tres.rb', line 37

def say_progress something, done = ''.colorize(:green)
  STDOUT.write(OUTPUT_FORMAT % something + "  ") unless quiet?
  yield if block_given?
  STDOUT.puts done unless quiet?
end

.scripts_dirObject



59
60
61
# File 'lib/tres.rb', line 59

def scripts_dir
  root/'javascripts'
end

.styles_dirObject



55
56
57
# File 'lib/tres.rb', line 55

def styles_dir
  root/'sass'
end

.templates_dirObject



51
52
53
# File 'lib/tres.rb', line 51

def templates_dir
  root/'templates'
end

.verbose!Object



28
29
30
# File 'lib/tres.rb', line 28

def verbose!
  @quiet = false
end