Permalink
Browse files

Update gender

  • Loading branch information...
2 parents 3e8d486 + 71f90d1 commit 52f6813187fc9c13ea27c755b31ace8f4728ec69 @hoverbird hoverbird committed Jul 25, 2011
View
@@ -6,6 +6,7 @@ group :default do
gem "thin"
gem "sinatra"
gem "ruby-debug"
+ gem "mustache"
gem "shotgun"
end
View
25 app.rb
@@ -2,24 +2,35 @@
LIB_PATH = File.join(ROOT, 'lib', 'storying')
$:.unshift LIB_PATH
-%w(rubygems chance story_elements gender character storying).each {|library| require library}
-%w(bundler/setup yaml erb sinatra/base thin).each {|library| require library}
+%w(rubygems chance story_elements gender character storying ).each {|library| require library}
+%w(bundler/setup yaml erb mustache/sinatra sinatra/base story_view thin).each {|library| require library}
Dir.entries(LIB_PATH).sort.each {|filename| require filename if filename =~ /\.rb$/ }
-class MyApp < Sinatra::Base
+class StoryingWebApp < Sinatra::Base
+ register Mustache::Sinatra
+
TEMPLATE_PATH = ROOT + "/templates"
+ VIEW_PATH = ROOT + "/views"
+
TEMPLATES = Dir.glob(TEMPLATE_PATH + "/*.erb").map {|f| File.read f}
+ Dir.glob(VIEW_PATH + "/*.rb").each {|filename| require filename }
+
+ set :mustache, {
+ :templates => TEMPLATE_PATH,
+ :views => VIEW_PATH,
+ :namespace => Storying
+ }
- get 'hella' do
- 'hell world'
+ get '/hella' do
+ mustache :simple
end
get '/' do
random_template = TEMPLATES.random
begin
erb TEMPLATES.random, :layout => :layout
- rescue => e
- raise "Error rendering #{random_template}:\n #{e}"
+ # rescue => e
+ # raise "Error rendering #{random_template}:\n #{e}"
end
end
View
@@ -1,2 +1,2 @@
require 'app'
-run MyApp
+run StoryingWebApp
View
@@ -19,29 +19,29 @@ def possessive_pronoun
female?? 'her' : 'his'
end
- def personal_pronoun(type = :subject)
- if type.to_sym == :object
- female?? 'her' : 'him'
- else
- female?? 'she' : 'he'
- end
+ def personal_pronoun
+ female?? 'she' : 'he'
+ end
+
+ def personal_pronoun_object
+ female?? 'her' : 'him'
end
def noun_as_parent
female?? 'mother' : 'father'
end
-
+
def noun_as_child
female?? 'daughter' : 'son'
end
-
+
def noun_as_sibling
female?? 'sister' : 'brother'
end
-
+
def noun_as_ruler
female?? 'queen' : 'king'
end
-
+
end
end
View
@@ -0,0 +1,19 @@
+module Storying
+ module Views
+ class StoryView < Mustache
+
+ def story
+ @story ||= Storying::Story.new
+ end
+
+ def hero
+ story.hero
+ end
+
+ def support
+ story.supporting_character
+ end
+
+ end
+ end
+end
View
@@ -0,0 +1,53 @@
+<!doctype html>
+<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
+<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
+<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
+<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
+<head>
+
+ <!-- Basic Page Needs
+ ================================================== -->
+ <meta charset="utf-8" />
+ <title>Storying</title>
+ <meta name="description" content="">
+ <meta name="author" content="">
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Mobile Specific Metas
+ ================================================== -->
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
+
+ <!-- CSS
+ ================================================== -->
+ <link rel="stylesheet" href="stylesheets/base.css">
+ <link rel="stylesheet" href="stylesheets/skeleton.css">
+ <link rel="stylesheet" href="stylesheets/layout.css">
+
+ <!-- Favicons
+ ================================================== -->
+ <link rel="shortcut icon" href="images/favicon.ico">
+ <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+ <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png" />
+ <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png" />
+
+</head>
+<body>
+
+ <div class="container">
+ <div class="sixteen columns">
+ <h1 class="remove-bottom" style="margin-top: 40px">Storying</h1>
+ <hr />
+ </div>
+ <div class="one-third column">
+ <div>{{{yield}}}</div>
+ </div>
+ </div>
+
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
+ <script>window.jQuery || document.write("<script src='javascripts/jquery-1.5.1.min.js'>\x3C/script>")</script>
+ <script src="javascripts/app.js"></script>
+
+</body>
+</html>
@@ -0,0 +1,6 @@
+<p>
+A {{hero.gender}} with a {{hero.characteristic}}, {{hero.name}} is an international operative who will stop at nothing to see justice done. Sometimes {{hero.personal_pronoun}} must journey far in search of evil; sometimes evil finds {{hero.personal_pronoun_object}} in {{story.setting}}.
+</p>
+<p>
+When a {{story.conflict}} arises, only {{hero.possessive_pronoun}} {{support.relationship_to_hero}} {{support.full_name}} can turn the tide. In a dangerous world, one extraordinary {{support.gender}} can mean the difference between life and death...
+</p>
View
@@ -0,0 +1 @@
+The world is {{hella}}
View
@@ -34,11 +34,11 @@
<% if @hero.can_handle_element %> With <%= story.supporting_character.full_name %> strong mastery of @gift_type, <%= supporting_character.personal_pronoun %> stepped past the flesh and cleaned the cave of all remaining <% Storying.uncanny_phrase.random_pop%>, winning the favor of the nearby villagers.
<% else %>
- Though <%= story.supporting_character.first_name %> had not the gift of <% @story.magic_element %>, <%= supporting_character.possessive %> general excellence allowed <%= supporting_character.personal_pronoun %> to reclaim the abandoned flesh of <%= story.supporting_character.first_name %>, the use of which would come back to haunt us all in the next age.
+ Though <%= story.supporting_character.first_name %> had not the gift of <% @story.magic_element %>, <%= story.supporting_character.possessive %> general excellence allowed <%= story.supporting_character.personal_pronoun %> to reclaim the abandoned flesh of <%= story.supporting_character.first_name %>, the use of which would come back to haunt us all in the next age.
<% end %>
</p>
<p>
-There's much more to tell of this story, but I do think this brief sketch gives a basic introduction for those interested in understanding the complicated relationship between the <%= story.supporting_character.last_name %> and <%= hero.supporting_character.last_name %> families.
+There's much more to tell of this story, but I do think this brief sketch gives a basic introduction for those interested in understanding the complicated relationship between the <%= story.supporting_character.last_name %> and <%= story.hero.last_name %> families.
</p>
View
@@ -0,0 +1,42 @@
+<p> intro
+
+ It was once said without irony that *{{ uncanny_philosophy }}*. It's always been terribly untrue, of course, and has been scientifically disproved by the most recent work from the <% Storying.uncanny_phrase.random_pop%> Magazine. Yet, when the uncannies began to surface, common usage of the phrase only increased, and was within 3 years fully transformed into a dark warning. Because uncannies, like your run-of-the-mill serial killers, have been generally perceived as the most normal of folk with few exceptions. Likely for the same reason as well: because the uncannies often sense at a young age (well before their true talents develop) that they will one day be understood as the truest threat faced by an ordered society.
+</p>
+
+<p>
+ It concerns two: <%= story.supporting_character.full_name %>, by age <%= (5..10).random %> began having regular dreams of <% Storying.uncanny_skills.random_pop %> and by early adulthood was, in secret and on regular, practicing intermediate management of <% story.supporting_character.gift_type%>. <%= supporting_character.Possessive_pronoun %> parents had no abilities, and uncanniologists have been unable to confirm any particular talents within two branches of the <%= story.supporting_character.last_name %> line.
+</p>
+
+<p>
+ The second is <%= story.hero.full_name %>, who would become first order of <% @gift_type %> at age <%(22..32).random%>. As is widely known, <%= story.hero.first_name %>, perceived no great talent until a near-drowning at age <%(15..20)%>, and within 6 months had, without formal training or learning, fully mastered skills of <% Storying.uncanny_skills.random_pop %> and <% Storying.uncanny_skills.random_pop %>. (And yet, may we not describe the early life of <%= story.hero.first_name %> as one almost comically devoted to the avoidance of just those situations that often force these abilities to the future)?
+</p>
+
+<p>
+ Through various circumstances (additional background can be found in the early issues of <% Storying.uncanny_phrase.random_pop%>) Monthly), <%= story.supporting_character.first_name %> quickly become the primary <%= Storying.relationships_to_character.random %> to <%= story.hero.first_name %>, and both gained general infamy in the summer regions. Unbeknownst to the other, both decided privately to seek the glory promised in the first Scroll of the <% Storying.uncanny_phrase.random_pop%>, and followed the solstice map they arrived, within hours of each other, at a now-well-known <%= Storying.settings.random %>.
+</p>
+
+<p>
+ <%= story.supporting_character.first_name %> arrived first, and came upon the Cave of Unmanageable <%= @story.magic_element %>, which had destroyed many in quite gruesome ways.
+
+ <% if story.supporting_character.can_handle_element %> Given <%= story.supporting_character.full_name %> strong mastery of @gift_type, <%= supporting_character.personal_pronoun %> did pass through the Cave, gaining the Cloak of <% Storying.uncanny_elements %> and losing only one limb, that lay at the Cave's entrance unrotting and alerting all others to the great triumph of the day.
+ <% else %>
+
+ Though <%= story.supporting_character.first_name %> was not blessed with master of <% @story.magic_element %>, <%= supporting_character.personal_pronoun %> thought <%= supporting_character.posessive_pronoun %> general abilities sufficient and pushed forward to a quick and gruesome death, <%= supporting_character.posessive_pronoun %> body left at the mouth of the cave as warning.
+
+ <% end %>
+</p>
+
+<p>
+ When <%= story.hero.first_name %> came upon the scene, it is said <%= hero.personal_pronoun %> wept for two hours, and bottled the tears to later make the Elixir of <% Storying.uncanny_phrase.random_pop%> that features so prominently in <%story.full_name%>'s best-selling <% Storying.uncanny_phrase.random_pop%>: An Observers Tale.
+
+ <% if @hero.can_handle_element %> With <%= story.supporting_character.full_name %> strong mastery of @gift_type, <%= supporting_character.personal_pronoun %> stepped past the flesh and cleaned the cave of all remaining <% Storying.uncanny_phrase.random_pop%>, winning the favor of the nearby villagers.
+ <% else %>
+
+ Though <%= story.supporting_character.first_name %> had not the gift of <% @story.magic_element %>, <%= story.supporting_character.possessive %> general excellence allowed <%= story.supporting_character.personal_pronoun %> to reclaim the abandoned flesh of <%= story.supporting_character.first_name %>, the use of which would come back to haunt us all in the next age.
+ <% end %>
+</p>
+
+<p>
+There's much more to tell of this story, but I do think this brief sketch gives a basic introduction for those interested in understanding the complicated relationship between the <%= story.supporting_character.last_name %> and <%= story.hero.last_name %> families.
+</p>
+
View
@@ -0,0 +1,6 @@
+module Storying
+ module Views
+ class Layout < Mustache
+ end
+ end
+end
View
@@ -0,0 +1,6 @@
+module Storying
+ module Views
+ class Simple < StoryView
+ end
+ end
+end
View
@@ -0,0 +1,6 @@
+module Storying
+ module Views
+ class Test < StoryView
+ end
+ end
+end
View
@@ -0,0 +1,9 @@
+module Storying
+ module Views
+ class Uncanny < StoryView
+ def uncanny_philosophy
+ Storying.uncanny_philosophies.random_pop
+ end
+ end
+ end
+end

0 comments on commit 52f6813

Please sign in to comment.