yadda yadda yadda.
gem 'sinatra', ">=1.1.0"
gem 'haml', ">=3.0.0"
gem 'less', ">=1.2.0"
-gem 'mongo', ">=1.1.0"
-gem 'rdiscount', ">=1.6.5"
\ No newline at end of file
+gem 'rdiscount', ">=1.6.5"
+gem 'dm-core', ">=1.0"
+gem 'dm-timestamps', ">=1.0"
+gem 'dm-mysql-adapter', ">=1.0"
\ No newline at end of file
--- /dev/null
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.2)
+ data_objects (0.10.2)
+ addressable (~> 2.1)
+ dm-core (1.0.2)
+ addressable (~> 2.2)
+ extlib (~> 0.9.15)
+ dm-do-adapter (1.0.2)
+ data_objects (~> 0.10.2)
+ dm-core (~> 1.0.2)
+ dm-mysql-adapter (1.0.2)
+ dm-do-adapter (~> 1.0.2)
+ do_mysql (~> 0.10.2)
+ dm-timestamps (1.0.2)
+ dm-core (~> 1.0.2)
+ do_mysql (0.10.2)
+ data_objects (= 0.10.2)
+ extlib (0.9.15)
+ haml (3.0.24)
+ less (1.2.21)
+ mutter (>= 0.4.2)
+ treetop (>= 1.4.2)
+ mutter (0.5.3)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rdiscount (1.6.5)
+ sinatra (1.1.0)
+ rack (~> 1.1)
+ tilt (~> 1.1)
+ tilt (1.1)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ dm-core (>= 1.0)
+ dm-mysql-adapter (>= 1.0)
+ dm-timestamps (>= 1.0)
+ haml (>= 3.0.0)
+ less (>= 1.2.0)
+ rdiscount (>= 1.6.5)
+ sinatra (>= 1.1.0)
require 'sinatra'
require 'haml'
require 'less'
-require 'mongo'
+require 'dm-core'
+require 'dm-timestamps'
#config
set :haml, :format => :html5
haml :index
end
+post '/' do
+ @grito = Grito.first_or_create(:title => params[:title], :text => params[:text])
+ haml :index
+end
+
get '/style.css' do
less :style
end
not_found do
- "Estos no son los droides que estás buscando."
+ haml :error
+end
+
+DataMapper.setup(:default, ENV['DATABASE_URL'] || 'mysql://root:root@localhost/grita')
+class Grito
+ include DataMapper::Resource
+ property :id, Serial
+ property :title, String, :required => true
+ property :text, Text, :required => true
+ property :created_at, DateTime
+
+ def geturl()
+ self.id.to_s(36)
+ end
end
\ No newline at end of file
--- /dev/null
+%h1 ERROR
+%p Un error ha ocurrido. Revisa que la página esté bien escrita.
\ No newline at end of file
--- /dev/null
+%h1 The Sorrows of Young Werther
+%p
+ :markdown
+ A **wonderful serenity** has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine.
+
+ I am so happy, *my dear friend*, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.
+
+ When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image,
\ No newline at end of file
-%h1 The Sorrows of Young Werther
-%p
- :markdown
- A **wonderful serenity** has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine.
-
- I am so happy, *my dear friend*, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.
-
- When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image,
\ No newline at end of file
+%form{:method => 'post', :action => '/'}
+ %h1 Título
+ %input{:type => 'text', :name => 'title', :class => 'title'}
+ %br
+ %h1 Texto
+ %textarea{:name => 'text', :class => 'text', :cols => '100'}
+ %br
+ %input{:type => 'submit', :value => 'Gritalo!'}
\ No newline at end of file