cuba-sugar 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/LICENSE +8 -0
  2. data/README.md +41 -0
  3. data/lib/cuba/sugar.rb +17 -0
  4. metadata +69 -0
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ /*
2
+ * ----------------------------------------------------------------------------
3
+ * "THE BEER-WARE LICENSE" (Revision 42):
4
+ * elcuervo wrote this file. As long as you retain this notice you
5
+ * can do whatever you want with this stuff. If we meet some day, and you think
6
+ * this stuff is worth it, you can buy me a beer in return Bruno Aguirre
7
+ * ----------------------------------------------------------------------------
8
+ */
@@ -0,0 +1,41 @@
1
+ Cuba/Sugar
2
+ ==========
3
+
4
+ _n_. bundled sugar for [cuba](https://github.com/soveran/cuba)
5
+
6
+ ![Cuba Sugar Cane Cutter In Field](http://maynardswitzer.com/library/Cuba/2002CubaSugarCaneCutterInField.A.jpg)
7
+
8
+ Description
9
+ -----------
10
+
11
+ It's like contrib stuff but with a cooler name.
12
+ Provides helpers and utilities to use with cuba.
13
+
14
+ Usage
15
+ -----
16
+
17
+ Like any other cuba app, but provides:
18
+
19
+ ### as
20
+
21
+ require "cuba"
22
+ require "cuba/sugar"
23
+
24
+ Cuba.use Rack::Session::Cookie
25
+
26
+ Cuba.define do
27
+ on post do
28
+ on "users" do
29
+ # create user
30
+ as 201, {"Content-Location" => "http://somewhere.com/users/705"} do
31
+ "user #{user.id} created"
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+
38
+ Installation
39
+ ------------
40
+
41
+ $ gem install cuba-sugar
@@ -0,0 +1,17 @@
1
+ module Cuba
2
+ class Ron
3
+ # Sugar to do some common response tasks
4
+ #
5
+ # @example
6
+ # on post, "users" do
7
+ # as 201 do
8
+ # "User successfully created!"
9
+ # end
10
+ # end
11
+ def as(http_code = 200, extra_headers = {})
12
+ res.status = http_code
13
+ res.headers.merge! extra_headers
14
+ res.write yield if block_given?
15
+ end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cuba-sugar
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.1"
6
+ platform: ruby
7
+ authors:
8
+ - elcuervo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-30 00:00:00 -03:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: cuba
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ description: Bundled contrib utils to use with cuba
28
+ email:
29
+ - yo@brunoaguirre.com
30
+ executables: []
31
+
32
+ extensions: []
33
+
34
+ extra_rdoc_files: []
35
+
36
+ files:
37
+ - LICENSE
38
+ - README.md
39
+ - lib/cuba/sugar.rb
40
+ has_rdoc: true
41
+ homepage: http://github.com/elcuervo/cuba-sugar
42
+ licenses: []
43
+
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ requirements: []
62
+
63
+ rubyforge_project:
64
+ rubygems_version: 1.6.2
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: Give Cuba some Sugar!
68
+ test_files: []
69
+