Skip to content

Commit

Permalink
First commit of ruby version
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Dijkstra committed Dec 27, 2011
1 parent 7a293a1 commit ab186e5
Show file tree
Hide file tree
Showing 32 changed files with 86 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
17 changes: 17 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
GEM
remote: http://rubygems.org/
specs:
rack (1.3.5)
rack-protection (1.1.4)
rack
sinatra (1.3.1)
rack (~> 1.3, >= 1.3.4)
rack-protection (~> 1.1, >= 1.1.2)
tilt (~> 1.3, >= 1.3.3)
tilt (1.3.3)

PLATFORMS
ruby

DEPENDENCIES
sinatra
17 changes: 16 additions & 1 deletion README.mdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Ruby version of Pattern-Primer by adactio

See https://github.com/adactio/Pattern-Primer

## Pattern Primer

Create little snippets of markup and save them to the "patterns folder." The pattern primer will generate a list of all the patterns in that folder. You will see the pattern rendered as HTML. You will also get the source displayed in a textarea.

You should be able to take the whole "pattern-primer" folder and drop it into your own project (assuming you're running PHP) **BUT** make sure to update the link element in the head of pattern-primer/index.php to point to your own CSS.
## How it works

1. Clone the repo
2. run bundle install
3. Copy your CSS to public/style.css
4. Run the file with 'ruby application.rb' or 'shotgun' if you have the shotgun gem installed (https://github.com/rtomayko/shotgun)

## Acknowledgements

Thanks to @adactio
6 changes: 6 additions & 0 deletions application.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'sinatra'
set :public_folder, File.dirname(__FILE__) + '/public'

get '/' do
erb :index
end
7 changes: 7 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'rubygems'
require 'bundler/setup'
require 'sinatra'

require './application'

run Sinatra::Application
2 changes: 2 additions & 0 deletions gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source :rubygems
gem 'sinatra'
51 changes: 0 additions & 51 deletions index.php

This file was deleted.

Empty file modified patterns/blockquote.html
100644 → 100755
Empty file.
Empty file modified patterns/feedback-error.html
100644 → 100755
Empty file.
Empty file modified patterns/feedback.html
100644 → 100755
Empty file.
Empty file modified patterns/form-buttons.html
100644 → 100755
Empty file.
Empty file modified patterns/form-checkbox.html
100644 → 100755
Empty file.
Empty file modified patterns/form-email.html
100644 → 100755
Empty file.
Empty file modified patterns/form-number.html
100644 → 100755
Empty file.
Empty file modified patterns/form-select.html
100644 → 100755
Empty file.
Empty file modified patterns/form-text.html
100644 → 100755
Empty file.
Empty file modified patterns/form-textarea.html
100644 → 100755
Empty file.
Empty file modified patterns/form-url.html
100644 → 100755
Empty file.
Empty file modified patterns/heading-1.html
100644 → 100755
Empty file.
Empty file modified patterns/heading-2.html
100644 → 100755
Empty file.
Empty file modified patterns/heading-3.html
100644 → 100755
Empty file.
Empty file modified patterns/heading-4.html
100644 → 100755
Empty file.
Empty file modified patterns/heading-5.html
100644 → 100755
Empty file.
Empty file modified patterns/heading-6.html
100644 → 100755
Empty file.
Empty file modified patterns/list-ordered.html
100644 → 100755
Empty file.
Empty file modified patterns/list-unordered.html
100644 → 100755
Empty file.
Empty file modified patterns/pagination-first.html
100644 → 100755
Empty file.
Empty file modified patterns/pagination-last.html
100644 → 100755
Empty file.
Empty file modified patterns/pagination.html
100644 → 100755
Empty file.
Empty file modified patterns/text.html
100644 → 100755
Empty file.
File renamed without changes.
37 changes: 37 additions & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Pattern Primer</title>
<link rel="stylesheet" href="/style.css">
<style>
.pattern {
clear: both;
overflow: hidden;
}
.pattern .display {
width: 65%;
float: left;
}
.pattern .source {
width: 30%;
float: right;
}
.pattern .source textarea {
width: 90%;
}
</style>
</head>
<body>
<% Dir.foreach(Dir.pwd + '/patterns/') do |fname| %>
<% next if fname == '.' or fname == '..' or fname == '.DS_Store' %>
<div class="pattern">
<div class="display">
<%= File.read(File.join('patterns/', fname)) %>
</div>
<div class="source">
<textarea rows="6" cols="30"><%= File.read(File.join('patterns/', fname)) %></textarea>
</div>
</div>
<% end %>
</body>
</html>

0 comments on commit ab186e5

Please sign in to comment.