Module: Twee2
- Defined in:
- lib/twee2.rb,
lib/twee2/version.rb,
lib/twee2/story_file.rb,
lib/twee2/story_format.rb
Defined Under Namespace
Classes: StoryFile, StoryFileNotFoundException, StoryFormat, StoryFormatNotFoundException
Constant Summary
collapse
- DEFAULT_FORMAT =
'Harlowe'
- VERSION =
"0.2.2"
Class Method Summary
collapse
Class Method Details
.build(input, output, options = {}) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/twee2.rb', line 13
def self.build(input, output, options = {})
story_format = StoryFormat::new(options[:format])
story_file = StoryFile::new(input)
File::open(output, 'w') do |out|
out.print story_format.compile(story_file)
end
puts "Done"
end
|
.buildpath(path) ⇒ Object
45
46
47
|
# File 'lib/twee2.rb', line 45
def self.buildpath(path)
File.join(File.dirname(File.expand_path(__FILE__)), "../#{path}")
end
|
35
36
37
38
|
# File 'lib/twee2.rb', line 35
def self.formats
puts "I understand the following output formats:"
puts StoryFormat.known_names.join("\n")
end
|
.help ⇒ Object
40
41
42
43
|
# File 'lib/twee2.rb', line 40
def self.help
puts "Twee2 #{Twee2::VERSION}"
puts File.read(buildpath('doc/usage.txt'))
end
|
.watch(input, output, options = {}) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/twee2.rb', line 25
def self.watch(input, output, options = {})
puts "Compiling #{output}"
build(input, output, options)
puts "Watching #{input}"
FileWatcher.new(input).watch do
puts "Recompiling #{output}"
build(input, output, options)
end
end
|