summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Beltran <ben@nsovocal.com>2010-12-01 00:18:06 -0700
committerBen Beltran <ben@nsovocal.com>2010-12-01 00:18:06 -0700
commit5573b3c2672a04d58a91ce1c74f9c543e14fb423 (patch)
tree89f6333c33044c69ec1a96f2cfe2240d36e2f7cf
parenta7ac2194708c39f02fa20ad4edff78fc4f24ea91 (diff)
Gemfile.lock y nuevas revisiones.
yadda yadda yadda.
-rw-r--r--Gemfile6
-rw-r--r--Gemfile.lock46
-rw-r--r--grita.rb23
-rw-r--r--views/error.haml2
-rw-r--r--views/grito.haml8
-rw-r--r--views/index.haml16
6 files changed, 89 insertions, 12 deletions
diff --git a/Gemfile b/Gemfile
index e407b4b..7043675 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,5 +3,7 @@ source :rubygems
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
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..2edb464
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,46 @@
+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)
diff --git a/grita.rb b/grita.rb
index 17ed55e..eaf59a7 100644
--- a/grita.rb
+++ b/grita.rb
@@ -1,7 +1,8 @@
require 'sinatra'
require 'haml'
require 'less'
-require 'mongo'
+require 'dm-core'
+require 'dm-timestamps'
#config
set :haml, :format => :html5
@@ -11,10 +12,28 @@ get '/' do
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
diff --git a/views/error.haml b/views/error.haml
new file mode 100644
index 0000000..7de3a5b
--- /dev/null
+++ b/views/error.haml
@@ -0,0 +1,2 @@
+%h1 ERROR
+%p Un error ha ocurrido. Revisa que la página esté bien escrita. \ No newline at end of file
diff --git a/views/grito.haml b/views/grito.haml
new file mode 100644
index 0000000..a8e5eb5
--- /dev/null
+++ b/views/grito.haml
@@ -0,0 +1,8 @@
+%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
diff --git a/views/index.haml b/views/index.haml
index a8e5eb5..742418d 100644
--- a/views/index.haml
+++ b/views/index.haml
@@ -1,8 +1,8 @@
-%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