forked from mikedijkstra/Pattern-Primer-Ruby
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Dijkstra
committed
Dec 27, 2011
1 parent
7a293a1
commit ab186e5
Showing
32 changed files
with
86 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source :rubygems | ||
gem 'sinatra' |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |