├── .gitignore ├── app ├── img │ ├── thumbnails │ │ └── .gitkeep │ └── blank.png ├── fonts │ └── lib │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.svg ├── css │ ├── views.show.css │ ├── app.css │ └── views.index.css ├── js │ ├── controllers.show.js │ ├── app.js │ ├── framework.js │ ├── controllers.index.js │ └── lib │ │ ├── underscore.js │ │ └── bootstrap.js └── index.html ├── .rspec ├── Gemfile ├── Rakefile ├── lib ├── storys │ ├── version.rb │ ├── core_ext │ │ └── pathname.rb │ ├── story.rb │ ├── update.rb │ └── package.rb └── storys.rb ├── bin └── storys ├── spec ├── factories.rb ├── spec_helper.rb └── story_spec.rb ├── LICENSE ├── storys.gemspec └── Gemfile.lock /.gitignore: -------------------------------------------------------------------------------- 1 | /pkg/ 2 | -------------------------------------------------------------------------------- /app/img/thumbnails/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format progress 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | gemspec 3 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler' 2 | Bundler::GemHelper.install_tasks 3 | -------------------------------------------------------------------------------- /lib/storys/version.rb: -------------------------------------------------------------------------------- 1 | module Storys 2 | VERSION = "0.1.0" 3 | end 4 | -------------------------------------------------------------------------------- /app/img/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/storys/master/app/img/blank.png -------------------------------------------------------------------------------- /app/fonts/lib/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/storys/master/app/fonts/lib/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /app/fonts/lib/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/storys/master/app/fonts/lib/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /app/fonts/lib/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/storys/master/app/fonts/lib/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /bin/storys: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "storys" 4 | 5 | root_path = Pathname.new(ARGV.first || ".").realpath 6 | 7 | storys = Storys::Package.new(root_path) 8 | storys.update 9 | -------------------------------------------------------------------------------- /app/css/views.show.css: -------------------------------------------------------------------------------- 1 | #view-show { 2 | display: none; 3 | } 4 | 5 | iframe { 6 | display: none; 7 | } 8 | 9 | #view-show #story { 10 | position: relative; 11 | } 12 | 13 | #view-show #return-to-index { 14 | padding: 5px; 15 | } 16 | 17 | #view-show #return-to-index a { 18 | color: #ffffff; 19 | } 20 | -------------------------------------------------------------------------------- /spec/factories.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :package, class: 'Storys::Package' do 3 | path { Pathname.new(".") } 4 | initialize_with { new(path) } 5 | end 6 | 7 | factory :story, class: 'Storys::Story' do 8 | path { Pathname.new(".") } 9 | initialize_with { new(build(:package), path) } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/storys.rb: -------------------------------------------------------------------------------- 1 | #Ruby stdlib 2 | require "pathname" 3 | require "fileutils" 4 | require "cgi" 5 | require "uri" 6 | require "json" 7 | require "digest" 8 | 9 | #Gems 10 | require "nsf" 11 | require "addressable/uri" 12 | require "naturally" 13 | 14 | #Core Extensions 15 | require "storys/core_ext/pathname" 16 | 17 | module Storys 18 | end 19 | 20 | require "storys/package" 21 | require "storys/update" 22 | require "storys/story" 23 | -------------------------------------------------------------------------------- /app/css/app.css: -------------------------------------------------------------------------------- 1 | body, div, a, img { 2 | -webkit-user-select: none; 3 | -moz-user-select: none; 4 | -khtml-user-select: none; 5 | -ms-user-select: none; 6 | user-select: none; 7 | } 8 | 9 | h1, p, ul { margin-top: 0; margin-bottom: 1.2em; } 10 | h1 { margin-top: 0; margin-bottom: 0.6em; text-align: left; } 11 | h2 { margin-top: 0; margin-bottom: 0.6em; text-align: left; } 12 | h3 { margin-top: 0; margin-bottom: 0.6em; text-align: left; } 13 | h4 { margin-top: 0; margin-bottom: 0.6em; text-align: left; } 14 | 15 | .clear { clear: both; } 16 | 17 | #wrapper { 18 | max-width: 1200px; 19 | margin: 51px auto 0 auto; 20 | padding: 30px; 21 | } 22 | 23 | #navbar-content-target { 24 | text-align: center; 25 | } 26 | 27 | .navbar-nav.navbar-right:last-child { 28 | margin-right: 0 !important; 29 | } 30 | -------------------------------------------------------------------------------- /lib/storys/core_ext/pathname.rb: -------------------------------------------------------------------------------- 1 | class Pathname 2 | def descendant_files 3 | out = children.select { |p| p.html? && !p.hidden? } 4 | children.select { |p| p.directory? && !p.hidden? }.each do |p| 5 | out += p.descendant_files 6 | end 7 | out 8 | end 9 | 10 | def html? 11 | file? && %w(.html).include?(extname) 12 | end 13 | 14 | def hidden? 15 | basename.to_s[0..0] == "." 16 | end 17 | 18 | def update_ext(extension) 19 | return self if extname == extension 20 | Pathname.new("#{to_s}#{extension}") 21 | end 22 | 23 | def write(content, options = {}) 24 | preserve_mtime = options.delete(:preserve_mtime) 25 | _atime, _mtime = atime, mtime if preserve_mtime 26 | 27 | open("w", options) { |file| file << content } 28 | 29 | utime(_atime, _mtime) if preserve_mtime 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file was generated by the `rspec --init` command. Conventionally, all 2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 3 | # Require this file using `require "spec_helper"` to ensure that it is only 4 | # loaded once. 5 | # 6 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 7 | 8 | require "bundler/setup" 9 | Bundler.require(:default, :development) 10 | 11 | require "storys" 12 | 13 | RSpec.configure do |config| 14 | config.treat_symbols_as_metadata_keys_with_true_values = true 15 | config.run_all_when_everything_filtered = true 16 | config.filter_run :focus 17 | 18 | # Run specs in random order to surface order dependencies. If you find an 19 | # order dependency and want to debug it, you can fix the order by providing 20 | # the seed, which is printed after each run. 21 | # --seed 1234 22 | config.order = 'random' 23 | 24 | config.include FactoryGirl::Syntax::Methods 25 | end 26 | 27 | require_relative "factories.rb" 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Brenton Fletcher (http://blog.bloople.net i@bloople.net) 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /app/js/controllers.show.js: -------------------------------------------------------------------------------- 1 | controllers.show = function(key) { 2 | var _this = this; 3 | 4 | var story = _.find(store, function(story) { 5 | return story.key == key; 6 | }); 7 | 8 | function loadStory(url) { 9 | var iframe = $("