Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cschneid/sinatra-book
base: master
...
head fork: sinatra/sinatra-book
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 14 commits
  • 12 files changed
  • 0 commit comments
  • 7 contributors
Commits on Nov 26, 2012
@tedlee tedlee Corrected small grammatical error
Fixed the line "a way for you too hook into" with "a way for you to hook into".
bd80cc0
@zzak zzak Merge pull request #60 from tedlee/master
Fixed small grammatical error
3dc9799
Commits on May 23, 2013
@zzak zzak use wkhtmltopdf-binary gem instead of vendor'd binary. fixes #61 66ddedc
Commits on Nov 19, 2013
@katgironpe katgironpe Updated Heroku deployment guide
fixes #sinatra/sinatra-book/#62
7f35272
@katgironpe katgironpe Added PATCH
fixes sinatra/sinatra-book/#64
893a649
Commits on Nov 21, 2013
@kgrz kgrz Merge pull request #63 from katgironpe/master
Updated Heroku deployment guide and add PATCH
92bb3d7
@kgrz kgrz Fix syntax highlighting 02297ff
Commits on Dec 14, 2013
@nzwsch nzwsch Fix typo by reported #66 de8f8bc
Commits on Dec 15, 2013
@nzwsch nzwsch Merge pull request #67 from sinatra-sapporo/models
Fix typo by reported #66
6e1dfef
Commits on Dec 31, 2013
@kgrz kgrz Fix Qt related SSL connection errors
* Presumably, this happens when compiling the book, the wkhtmltopdf
 library tries to download assets that are linked to GitHub's servers.
 By removing that dependency and using local assets, this can be
 mitigated.
61f1464
Commits on Apr 28, 2015
@ksolo ksolo add MIT license 13e5b22
Commits on Jul 03, 2015
@emachnic emachnic Updated gemcutter reference to rubygems 489913a
Commits on Jul 06, 2015
@zzak zzak Merge pull request #75 from emachnic/master
Updated gemcutter reference to rubygems
33218f2
@zzak zzak Merge pull request #74 from ksolo/master
Add MIT license
d16d826
View
3  Gemfile
@@ -1,6 +1,7 @@
-source 'http://rubygems.org'
+source 'https://rubygems.org'
gem 'pdfkit'
gem 'rake'
gem 'redcarpet', '~> 2.0'
gem 'sinatra'
+gem 'wkhtmltopdf-binary', :require => false
View
4 Gemfile.lock
@@ -1,5 +1,5 @@
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
pdfkit (0.5.2)
rack (1.4.1)
@@ -12,6 +12,7 @@ GEM
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
tilt (1.3.3)
+ wkhtmltopdf-binary (0.9.9.1)
PLATFORMS
ruby
@@ -21,3 +22,4 @@ DEPENDENCIES
rake
redcarpet (~> 2.0)
sinatra
+ wkhtmltopdf-binary
View
24 README.md
@@ -49,3 +49,27 @@ Join us on IRC (#sinatra at irc.freenode.org) if you need help with anything.
[forking]: http://help.github.com/forking/
[pull-requests]: http://help.github.com/pull-requests/
+License
+-----------------
+
+The MIT License (MIT)
+
+Copyright (c) 2015 Sinatra
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
4 app.rb
@@ -22,12 +22,12 @@
<title>Sinatra Book</title>
<link rel="stylesheet" type="text/css" href="/book.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="/print.css" media="print" />
- <link rel="shortcut icon" href="https://github.com/sinatra/resources/raw/master/logo/favicon.ico">
+ <link rel="shortcut icon" href="/images/favicon.ico">
</head>
<body>
<div id="download">
<a href="/download">
- <img src="/download.png" alt="Download the Sinatra Book" />
+ <img src="/images/download.png" alt="Download the Sinatra Book" />
</a>
</div>
<%= yield %>
View
BIN  assets/images/book-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/images/favicon.ico
Binary file not shown
View
6 book.rb
@@ -12,10 +12,6 @@ def build(pdf=false)
doc << toc
doc << content
if pdf
- PDFKit.configure { |config|
- config.wkhtmltopdf = File.join(File.dirname(__FILE__),
- 'vendor', 'wkhtmltopdf')
- }
kit = PDFKit.new(doc, :page_size=>'Letter')
kit.stylesheets << "#{ASSETS_DIR}/print.css"
pdf = kit.to_pdf
@@ -30,7 +26,7 @@ def header
<<-header
<div id="header">
<p>
- <img src="https://raw.github.com/sinatra/resources/master/logo/book-logo.png" />
+ <img src="#{ASSETS_DIR}/images/book-logo.png" />
</p>
</div>
header
View
47 book/Deployment.markdown
@@ -11,32 +11,45 @@ pushing to a remote git repository.
Steps to deploy to Heroku:
* Create an [account](http://heroku.com/signup) if you don't have one
-* `gem install heroku`
+* Download and install [Heroku toolbelt](https://toolbelt.heroku.com/)
+* Make sure you have a `Gemfile`. Otherwise, you can create one and install the `sinatra` gem using `bundler`.
* Make a config.ru in the root-directory
* Create the app on heroku
* Push to it
-1. Here is an example config.ru file that does two things. First, it requires
- your main app file, whatever it's called. In the example, it will look for
- `myapp.rb`. Second, run your application. If you're subclassing, use the
- subclass's name, otherwise use Sinatra::Application.
+1. Install `bundler` if you haven't yet (`gem install bundler`). Create a `Gemfile` using `bundle init`. Modify your `Gemfile` to look like:
+
+ ```ruby
+ source 'http://rubygems.org'
+
+ gem 'sinatra'
+ ```
-```ruby
-require "myapp"
+ Run `bundle` to install the gem.
-run Sinatra::Application
-```
+ It is possible to specify a specific Ruby version on your Gemfile.
+ For more information, check [this](https://devcenter.heroku.com/articles/ruby-versions).
+
+2. Here is an example config.ru file that does two things. First, it requires
+ your main app file, whatever it's called. In the example, it will look for
+ `myapp.rb`. Second, run your application. If you're subclassing, use the
+ subclass's name, otherwise use Sinatra::Application.
-2. Create the app and push to it
+ ```ruby
+ require "myapp"
- From the root-directory of the application
+ run Sinatra::Application
+ ```
-```
-$ heroku create <app-name> # This will add heroku as a remote
-$ git push heroku master
-```
+3. Create the app and push to it
-For more details see [this](http://github.com/sinatra/heroku-sinatra-app)
+ From the root directory of the application, run these commands:
+
+ ```bash
+ $ heroku create <app-name> # This will add heroku as a remote
+ $ git push heroku master
+ ```
-[Heroku]: http://www.heroku.com
+ For more details see [this](http://github.com/sinatra/heroku-sinatra-app).
+ [Heroku]: http://www.heroku.com
View
13 book/Getting_to_know_Sinatra.markdown
@@ -15,6 +15,7 @@ HTTP request methods will get you a long ways:
* GET
* POST
+* PATCH
* PUT
* DELETE
@@ -43,6 +44,11 @@ put '/dog/:id' do
# HTTP PUT request method to update an existing dog
end
+patch '/dog/:id' do
+ # HTTP PATCH request method to update an existing dog
+ # See RFC 5789 for more information
+end
+
delete '/dog/:id' do
# HTTP DELETE request method to remove a dog who's been sold!
end
@@ -52,14 +58,15 @@ As you can see from this contrived example, Sinatra's routing is very easy to ge
along with. Don't be fooled, though, Sinatra can do some pretty amazing things
with Routes.
-Take a more in-depth look at [Sinatra's routes][routes], and see for yourself.
+Take a more in-depth look at [Sinatra's routes][routes], and see for yourself.
[routes]: http://www.sinatrarb.com/intro#Routes
[restful-web-services]: http://en.wikipedia.org/wiki/Representational_State_Transfer#RESTful_web_services
+[RFC 5789]: http://www.rfc-base.org/rfc-5789.html
## Filters
-Sinatra offers a way for you too hook into the request chain of your
+Sinatra offers a way for you to hook into the request chain of your
application via [Filters][filters].
Filters define two methods available, `before` and `after` which both accept a
@@ -143,7 +150,7 @@ application:
get '/' do
session['counter'] ||= 0
session['counter'] += 1
- "You've hit this page #{session['counter']} times!"
+ "You've hit this page #{session['counter']} times!"
end
```
View
7 book/Introduction.markdown
@@ -52,7 +52,7 @@ $ gem install haml
### Living on the Edge
-The _edge_ version of Sinatra lives in its Git repository, available at
+The _edge_ version of Sinatra lives in its Git repository, available at
**<http://github.com/sinatra/sinatra/tree/master>**.
You can use the _edge_ version to try new functionality or to contribute to the
@@ -71,7 +71,7 @@ source :rubygems
gem 'sinatra', :git => 'git://github.com/sinatra/sinatra.git'
```
-Here we use the gemcutter source to specify where to get Sinatra's
+Here we use the rubygems source to specify where to get Sinatra's
dependencies; alternatively you can use the git version, but that is up to you.
So now we can install our bundle:
@@ -131,10 +131,9 @@ For more information about the Ruby language visit the following links:
* [ruby-lang](http://www.ruby-lang.org)
* [ruby-lang / documentation](http://www.ruby-lang.org/en/documentation/)
-Need Help?
+Need Help?
----------
The Sinatra club is small, but super-friendly. Join us on IRC at
irc.freenode.org in #sinatra if you have any questions. It's a bit
slow at times, so give us a bit to get back to your questions.
-
View
2  book/Models.markdown
@@ -43,7 +43,7 @@ get '/' do
end
```
-Finally, the view at `./view/index.html`:
+Finally, the view at `./view/index.erb`:
```ruby
<% @posts.each do |post| %>
View
BIN  vendor/wkhtmltopdf
Binary file not shown

No commit comments for this range

Something went wrong with that request. Please try again.