cubbyhole 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ vendor/bundle
data/example/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source :rubygems
2
+
3
+ gem "cubbyhole", :path => ".."
4
+ gem "sinatra"
5
+ gem "haml"
data/example/config.ru ADDED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'example'
5
+
6
+ run Example
@@ -0,0 +1,19 @@
1
+ require 'sinatra/base'
2
+ require 'cubbyhole'
3
+ require 'haml'
4
+
5
+ class Example < Sinatra::Base
6
+ get "/" do
7
+ @posts = Post.all
8
+ haml :index
9
+ end
10
+
11
+ get "/posts/new" do
12
+ haml :new
13
+ end
14
+
15
+ post "/posts" do
16
+ Post.create(params[:post])
17
+ redirect "/"
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ %a{:href => "/posts/new"} New Post
2
+
3
+ - @posts.each do |post|
4
+ %h1= post.title
5
+ %p= post.body
@@ -0,0 +1,8 @@
1
+ %form{:action => "/posts", :method => "post"}
2
+ %h1 Title
3
+ %input{:type => "text", :name => "post[title]"}
4
+
5
+ %h1 Body
6
+ %input{:type => "text", :name => "post[body]"}
7
+
8
+ %input{:type => "submit"}
@@ -1,3 +1,3 @@
1
1
  module Cubbyhole
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/cubbyhole.rb CHANGED
@@ -21,6 +21,10 @@ module Cubbyhole
21
21
  id
22
22
  end
23
23
 
24
+ def self.all
25
+ objs.values
26
+ end
27
+
24
28
  def self.objs
25
29
  @objs ||= {}
26
30
  end
@@ -50,4 +50,10 @@ describe Cubbyhole do
50
50
  fetched.foo.should == "baz"
51
51
  fetched.bar.should == "zot"
52
52
  end
53
+
54
+ it "finds all objects" do
55
+ 3.times { MyModel.create }
56
+
57
+ MyModel.all.size.should == 3
58
+ end
53
59
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cubbyhole
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Delcambre
@@ -34,6 +34,12 @@ files:
34
34
  - README.md
35
35
  - Rakefile
36
36
  - cubbyhole.gemspec
37
+ - example/.gitignore
38
+ - example/Gemfile
39
+ - example/config.ru
40
+ - example/example.rb
41
+ - example/views/index.haml
42
+ - example/views/new.haml
37
43
  - lib/cubbyhole.rb
38
44
  - lib/cubbyhole/version.rb
39
45
  - spec/cubbyhole_spec.rb