Compare commits
No commits in common. "web" and "master" have entirely different histories.
8 changed files with 20 additions and 90 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -53,7 +53,9 @@ Thumbs.db
|
||||||
.netrwhist
|
.netrwhist
|
||||||
*.un~
|
*.un~
|
||||||
|
|
||||||
# Ruby #
|
# YARD Related #
|
||||||
########
|
################
|
||||||
*.gem
|
# doc/ is the generated documentation for Yard, which can easily be generated
|
||||||
/.yardoc/
|
# locally with yardoc
|
||||||
|
# .yardoc/ is yard metadata, not necessary to be uploaded to GH
|
||||||
|
.yardoc/
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
ruby-2.4.2
|
|
27
Gemfile
27
Gemfile
|
@ -1,21 +1,12 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
source 'https://rubygems.org'
|
source "https://rubygems.org"
|
||||||
|
|
||||||
ruby '2.4.2'
|
# Documentation
|
||||||
|
gem "rdoc"
|
||||||
|
gem "redcarpet"
|
||||||
|
gem "thor"
|
||||||
|
gem "yard"
|
||||||
|
gem "yard-ghpages"
|
||||||
|
|
||||||
gem 'thor'
|
# Testing
|
||||||
|
gem "rubocop"
|
||||||
group :documentation do
|
|
||||||
gem 'rdoc'
|
|
||||||
gem 'redcarpet'
|
|
||||||
gem 'yard'
|
|
||||||
gem 'yard-ghpages'
|
|
||||||
end
|
|
||||||
|
|
||||||
group :test do
|
|
||||||
gem 'rubocop'
|
|
||||||
end
|
|
||||||
|
|
||||||
group :web do
|
|
||||||
gem 'rack'
|
|
||||||
end
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ GEM
|
||||||
parser (2.4.0.0)
|
parser (2.4.0.0)
|
||||||
ast (~> 2.2)
|
ast (~> 2.2)
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
rack (2.0.3)
|
|
||||||
rainbow (2.2.2)
|
rainbow (2.2.2)
|
||||||
rake
|
rake
|
||||||
rake (11.3.0)
|
rake (11.3.0)
|
||||||
|
@ -31,7 +30,6 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
rack
|
|
||||||
rdoc
|
rdoc
|
||||||
redcarpet
|
redcarpet
|
||||||
rubocop
|
rubocop
|
||||||
|
@ -39,8 +37,5 @@ DEPENDENCIES
|
||||||
yard
|
yard
|
||||||
yard-ghpages
|
yard-ghpages
|
||||||
|
|
||||||
RUBY VERSION
|
|
||||||
ruby 2.4.2p198
|
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.15.4
|
1.14.6
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
# frozen string literal: true
|
|
||||||
|
|
||||||
require 'rack'
|
|
||||||
require 'thor'
|
require 'thor'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
|
||||||
|
@ -9,7 +7,6 @@ Dir[File.join(__dir__, 'sapling', '*.rb')].each { |file| require file }
|
||||||
|
|
||||||
# The main Sapling interface.
|
# The main Sapling interface.
|
||||||
class Sapling < Thor
|
class Sapling < Thor
|
||||||
# CLI-based options
|
|
||||||
desc 'read TREE', 'Load and traverse the TREE'
|
desc 'read TREE', 'Load and traverse the TREE'
|
||||||
def read(file)
|
def read(file)
|
||||||
puts 'Welcome to Sapling, a Dialogue Tree Utility.'
|
puts 'Welcome to Sapling, a Dialogue Tree Utility.'
|
||||||
|
@ -33,16 +30,10 @@ class Sapling < Thor
|
||||||
gardner.plant
|
gardner.plant
|
||||||
end
|
end
|
||||||
|
|
||||||
# Web-based options
|
|
||||||
desc 'serve TREE', 'Load TREE in a web-based interface'
|
desc 'serve TREE', 'Load TREE in a web-based interface'
|
||||||
def serve(file)
|
def serve(tree)
|
||||||
exit unless verify_tree(file)
|
exit unless verify_tree(tree)
|
||||||
tree = Gardner::Plot.new(YAML.load_file(file))
|
puts 'Sinatra will be cool.'
|
||||||
Rack::Server.new(
|
|
||||||
app: Greenhouse.new(tree),
|
|
||||||
server: 'webrick',
|
|
||||||
Port: 9000
|
|
||||||
).start
|
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'export TREE', 'Save a portable HTML version of TREE'
|
desc 'export TREE', 'Save a portable HTML version of TREE'
|
||||||
|
@ -50,15 +41,4 @@ class Sapling < Thor
|
||||||
exit unless verify_tree(tree)
|
exit unless verify_tree(tree)
|
||||||
puts 'Cool feature, bro!'
|
puts 'Cool feature, bro!'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Miscellaneous options
|
|
||||||
desc 'example', 'Play Example Quest!'
|
|
||||||
def example
|
|
||||||
file = File.join(__dir__, '..', 'var', 'trees', 'example_quest.yaml')
|
|
||||||
puts 'Welcome to Sapling, a Dialogue Tree Utility.'
|
|
||||||
exit unless verify_tree(file)
|
|
||||||
tree = Gardner::Plot.new(YAML.load_file(file))
|
|
||||||
speaker = Dialogue::Speaker.new(tree, false)
|
|
||||||
speaker.conversation
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
require 'erb'
|
|
||||||
|
|
||||||
# The rack application
|
|
||||||
class Greenhouse
|
|
||||||
attr_reader :tree
|
|
||||||
|
|
||||||
def initialize(file)
|
|
||||||
@tree = file
|
|
||||||
@response = ERB.new(File.read('lib/sapling/index.erb')).result(binding)
|
|
||||||
end
|
|
||||||
|
|
||||||
def call(_env)
|
|
||||||
['200', { 'Content-Type' => 'text/html' }, [@response]]
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,20 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>Sapling: Adventure Awaits!</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="header">
|
|
||||||
<div><p>Sapling</p></div>
|
|
||||||
<div>
|
|
||||||
<a href="https://www.github.com/vagabondazulien/sapling">GitHub</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="main">
|
|
||||||
<%= @tree.trunk %>
|
|
||||||
<div class="footer">
|
|
||||||
<div><p>Made with <3 by Nibz</p></div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
|
@ -7,9 +7,7 @@ Gem::Specification.new do |s|
|
||||||
s.description = 'Create, edit, and traverse dialogue trees'
|
s.description = 'Create, edit, and traverse dialogue trees'
|
||||||
s.authors = ['Bill Niblock']
|
s.authors = ['Bill Niblock']
|
||||||
s.email = 'azulien@gmail.com'
|
s.email = 'azulien@gmail.com'
|
||||||
s.files = Dir['lib/**/*.rb'] +
|
s.files = Dir['lib/**/*.rb'] + Dir['bin/*']
|
||||||
Dir['bin/*'] +
|
|
||||||
Dir['var/trees/*']
|
|
||||||
s.homepage = 'http://www.theinternetvagabond.com/sapling/'
|
s.homepage = 'http://www.theinternetvagabond.com/sapling/'
|
||||||
s.license = 'MIT'
|
s.license = 'MIT'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue