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
Showing
12 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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,3 @@ | ||
--- | ||
BUNDLE_PATH: bundler | ||
BUNDLE_DISABLE_SHARED_GEMS: "1" |
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 @@ | ||
rvm ruby-1.9.2-p180@8pom |
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,16 @@ | ||
source 'http://rubygems.org' | ||
|
||
# sinatra | ||
gem 'sinatra', '1.2.6' | ||
|
||
# datamapper | ||
gem "data_mapper" | ||
gem "dm-sqlite-adapter" | ||
|
||
gem "haml" | ||
|
||
# thor | ||
gem "thor" | ||
|
||
# Use unicorn as the web server | ||
gem 'unicorn' |
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,78 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
addressable (2.2.6) | ||
bcrypt-ruby (2.1.4) | ||
data_mapper (1.1.0) | ||
dm-aggregates (= 1.1.0) | ||
dm-constraints (= 1.1.0) | ||
dm-core (= 1.1.0) | ||
dm-migrations (= 1.1.0) | ||
dm-serializer (= 1.1.0) | ||
dm-timestamps (= 1.1.0) | ||
dm-transactions (= 1.1.0) | ||
dm-types (= 1.1.0) | ||
dm-validations (= 1.1.0) | ||
data_objects (0.10.6) | ||
addressable (~> 2.1) | ||
dm-aggregates (1.1.0) | ||
dm-core (~> 1.1.0) | ||
dm-constraints (1.1.0) | ||
dm-core (~> 1.1.0) | ||
dm-core (1.1.0) | ||
addressable (~> 2.2.4) | ||
dm-do-adapter (1.1.0) | ||
data_objects (~> 0.10.2) | ||
dm-core (~> 1.1.0) | ||
dm-migrations (1.1.0) | ||
dm-core (~> 1.1.0) | ||
dm-serializer (1.1.0) | ||
dm-core (~> 1.1.0) | ||
fastercsv (~> 1.5.4) | ||
json (~> 1.4.6) | ||
dm-sqlite-adapter (1.1.0) | ||
dm-do-adapter (~> 1.1.0) | ||
do_sqlite3 (~> 0.10.2) | ||
dm-timestamps (1.1.0) | ||
dm-core (~> 1.1.0) | ||
dm-transactions (1.1.0) | ||
dm-core (~> 1.1.0) | ||
dm-types (1.1.0) | ||
bcrypt-ruby (~> 2.1.4) | ||
dm-core (~> 1.1.0) | ||
fastercsv (~> 1.5.4) | ||
json (~> 1.4.6) | ||
stringex (~> 1.2.0) | ||
uuidtools (~> 2.1.2) | ||
dm-validations (1.1.0) | ||
dm-core (~> 1.1.0) | ||
do_sqlite3 (0.10.6) | ||
data_objects (= 0.10.6) | ||
fastercsv (1.5.4) | ||
haml (3.1.2) | ||
json (1.4.6) | ||
kgio (2.6.0) | ||
rack (1.3.2) | ||
raindrops (0.7.0) | ||
sinatra (1.2.6) | ||
rack (~> 1.1) | ||
tilt (>= 1.2.2, < 2.0) | ||
stringex (1.2.2) | ||
thor (0.14.6) | ||
tilt (1.3.2) | ||
unicorn (4.0.1) | ||
kgio (~> 2.4) | ||
rack | ||
raindrops (~> 0.6) | ||
uuidtools (2.1.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
data_mapper | ||
dm-sqlite-adapter | ||
haml | ||
sinatra (= 1.2.6) | ||
thor | ||
unicorn |
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,19 @@ | ||
# encoding: utf-8 | ||
require "rubygems" | ||
require "sinatra" | ||
require "data_mapper" | ||
require "dm-sqlite-adapter" | ||
require "haml" | ||
|
||
require_relative "models" | ||
|
||
class MyApp < Sinatra::Application | ||
get "/" do | ||
if Post.all.count > 0 | ||
@posts = Post.all | ||
else | ||
@posts = [] | ||
end | ||
haml :index | ||
end | ||
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,2 @@ | ||
require ::File.join( ::File.dirname(__FILE__), 'app' ) | ||
run MyApp.new |
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,13 @@ | ||
# encoding: utf-8 | ||
DataMapper.setup(:default, :adapter => "sqlite3", :database => "#{Dir.pwd}/database.sqlite3") | ||
|
||
class Post | ||
include DataMapper::Resource | ||
|
||
property :id, Serial | ||
property :title, Text | ||
property :text, Text | ||
end | ||
|
||
DataMapper.finalize | ||
DataMapper.auto_upgrade! |
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,21 @@ | ||
# encoding: utf-8 | ||
require "rubygems" | ||
require "sinatra" | ||
require "data_mapper" | ||
require "dm-sqlite-adapter" | ||
|
||
require './models' | ||
|
||
class Setup < Thor | ||
include Thor::Actions | ||
desc "quick", "create some articles" | ||
def quick | ||
if Post.all.count == 0 | ||
i = 0 | ||
3.times do | ||
Post.create(:title => "article ##{i}", :text => "Vous voila armé d'un nouveau marteau, ce n'est pas encore une masse, mais vous avez de quoi forger quelque chose d'intéressant d'hors et déjà.") | ||
i += 1 | ||
end | ||
end | ||
end | ||
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,6 @@ | ||
- if @posts.count > 0 | ||
- @posts.each do |post| | ||
%h2= post.title | ||
%p= post.text | ||
- else | ||
Pas d'articles |