couch 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +81 -6
- data/couch.gemspec +3 -4
- data/lib/couch/mapper.rb +12 -1
- data/lib/couch/version.rb +1 -1
- metadata +3 -4
- data/.document +0 -5
data/README.rdoc
CHANGED
@@ -1,17 +1,92 @@
|
|
1
|
-
=
|
1
|
+
= Couch
|
2
|
+
|
3
|
+
Standalone CouchDB Application Development Suite
|
4
|
+
|
5
|
+
With Couch you can easy build a standalone CouchDB application. Couch aims to bring some of the Rails beauty to CouchDB.
|
6
|
+
Currently Couch supports Rails style Generators you will love, using the same awesome Thor library used in Rails 3.
|
7
|
+
|
8
|
+
|
9
|
+
== Why?
|
10
|
+
|
11
|
+
Why do we need a new CouchDB Application Development Suite? We already have the powerful {CouchApp}[http://github.com/couchapp/couchapp].
|
12
|
+
|
13
|
+
I miss some beauty. I miss some elegance on the command line.
|
14
|
+
|
15
|
+
I know my attempt is almost a small little step towards the beauty I aspire.
|
16
|
+
I try to pilfer the most of now: From CouchApp and Ruby on Rails.
|
17
|
+
So here we go:
|
18
|
+
|
19
|
+
<em>Couch is designed to structure standalone CouchDB application development for maximum application portability.</em>
|
20
|
+
|
21
|
+
=== Web development that doesn't hurt
|
22
|
+
|
23
|
+
Couch is a set of open-source tools that's optimized for programmer happiness and sustainable productivity. It lets you write beautyful code by favoring convention over configuration.
|
24
|
+
|
25
|
+
=== Write apps using just JavaScript and HTML
|
26
|
+
|
27
|
+
Render HTML documents using JavaScript templates run by CouchDB. You'll get parallelism and cacheability, *using only HTML and JavaScript*.
|
28
|
+
Building standalone CouchDB applications according to correct principles affords you options not found on other platforms.
|
29
|
+
|
30
|
+
|
31
|
+
== What comes next
|
32
|
+
|
33
|
+
At the moment, Couch supports generating a scaffold application, pushing to a CouchDB server and pulling from a CouchDB.
|
34
|
+
|
35
|
+
The next big steps are:
|
36
|
+
|
37
|
+
* support +code+ and +json+ makros to manage shared pieces of code
|
38
|
+
* add the powerful mustache.js Template engine (http://github.com/janl/mustache.js)
|
39
|
+
* add more code generators to rapidly get you started
|
40
|
+
|
41
|
+
|
42
|
+
== I need your help!
|
43
|
+
|
44
|
+
The reason why I release that project in such an early state is that I beleave it's you, who invent that desired beauty!
|
45
|
+
|
46
|
+
|
47
|
+
== Prerequisites
|
48
|
+
|
49
|
+
All you need is Ruby and its packet manager RubyGems. If you do not have a Ruby environment,
|
50
|
+
|
51
|
+
apt-get install ruby rubygems
|
52
|
+
|
53
|
+
will probably install the required packages. If you run into any troubles, visit http://docs.rubygems.org/read/chapter/3 for in deapth installation notes for RubyGems, and http://www.ruby-lang.org/en/downloads/ for help on installing Ruby.
|
54
|
+
|
55
|
+
Of course, Couch relies on CouchDB. You do not have to install your own CouchDB server if you have access to a CouchDB database over the internet, but I recommend it for development.
|
56
|
+
If you are new to CouchDB, install it:
|
57
|
+
|
58
|
+
apt-get install couchdb
|
59
|
+
|
60
|
+
Take a look at the CouchDB Wiki, where the page http://wiki.apache.org/couchdb/Installation describes the installation for all common systems.
|
61
|
+
|
62
|
+
|
63
|
+
== Installation
|
64
|
+
|
65
|
+
Couch installation is easy.
|
66
|
+
Couch is available as RubyGem, hosted on http://rubygems.org/ (aka Gemcutter) and Rubyforge (http://rubyforge.org).
|
67
|
+
Install the gem with
|
68
|
+
|
69
|
+
gem install couch
|
70
|
+
|
71
|
+
|
72
|
+
== Gettings started
|
73
|
+
|
74
|
+
Once installed, your system will have the brand new +couch+ command.
|
75
|
+
So just type
|
76
|
+
|
77
|
+
couch
|
78
|
+
|
79
|
+
and relax.
|
2
80
|
|
3
|
-
Description goes here.
|
4
81
|
|
5
82
|
== Note on Patches/Pull Requests
|
6
83
|
|
7
84
|
* Fork the project.
|
8
85
|
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
86
|
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
87
|
* Send me a pull request. Bonus points for topic branches.
|
14
88
|
|
89
|
+
|
15
90
|
== Copyright
|
16
91
|
|
17
|
-
Copyright (c) 2010 Johannes
|
92
|
+
Copyright (c) 2010 Johannes Jörg Schmidt, TF. See LICENSE for details.
|
data/couch.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{couch}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Johannes J. Schmidt"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-08}
|
13
13
|
s.default_executable = %q{couch}
|
14
14
|
s.description = %q{With Couch you can easy build a standalone CouchDB application.}
|
15
15
|
s.email = %q{schmidt@netzmerk.com}
|
@@ -19,8 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
"README.rdoc"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
|
-
".
|
23
|
-
".gitignore",
|
22
|
+
".gitignore",
|
24
23
|
"LICENSE",
|
25
24
|
"README.rdoc",
|
26
25
|
"Rakefile",
|
data/lib/couch/mapper.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
module Couch
|
2
2
|
class Mapper
|
3
|
+
MIME_TYPES = {
|
4
|
+
".html" => "text/html",
|
5
|
+
".js" => "text/javascript",
|
6
|
+
".css" => "text/css",
|
7
|
+
}
|
8
|
+
|
3
9
|
def initialize(root)
|
4
10
|
raise "Root invalid" unless root && File.directory?(root)
|
5
11
|
@root = root
|
@@ -36,7 +42,7 @@ module Couch
|
|
36
42
|
map_attachments filename, hash, base
|
37
43
|
else
|
38
44
|
hash[base.join('/')] = {
|
39
|
-
"content_type" =>
|
45
|
+
"content_type" => mime_type(filename),
|
40
46
|
"data" => base64(File.read(filename)),
|
41
47
|
}
|
42
48
|
end
|
@@ -48,5 +54,10 @@ module Couch
|
|
48
54
|
def base64(data)
|
49
55
|
[data].pack("m").gsub(/\s/,'')
|
50
56
|
end
|
57
|
+
|
58
|
+
def mime_type(filename)
|
59
|
+
ext = File.extname(filename)
|
60
|
+
MIME_TYPES[ext] || 'text/plain'
|
61
|
+
end
|
51
62
|
end
|
52
63
|
end
|
data/lib/couch/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Johannes J. Schmidt
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-08 00:00:00 +01:00
|
18
18
|
default_executable: couch
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -83,7 +83,6 @@ extra_rdoc_files:
|
|
83
83
|
- LICENSE
|
84
84
|
- README.rdoc
|
85
85
|
files:
|
86
|
-
- .document
|
87
86
|
- .gitignore
|
88
87
|
- LICENSE
|
89
88
|
- README.rdoc
|