dayvan 0.1.2 → 0.1.3
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.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/dayvan.rb +1 -1
- data/lib/dayvan/attachment.rb +1 -1
- data/lib/dayvan/cli.rb +9 -7
- data/lib/dayvan/design.rb +16 -12
- data/lib/dayvan/project.rb +8 -5
- data/lib/dayvan/{security.rb → validation.rb} +3 -3
- data/lib/dayvan/view.rb +1 -1
- data/templates/{security.coffee.erb → validation.coffee.erb} +0 -0
- data/templates/welcome.html.erb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Dayvan
|
2
2
|
|
3
|
-
For a full summary please see the website[http://chrislloyd.github.com/dayvan].
|
3
|
+
For a full summary please see the website[http://chrislloyd.cloudant.com/dayvan/_design/dayvan/index.html] and it's code[http://github.com/chrislloyd/dayvan/tree/example].
|
4
4
|
|
5
5
|
== Copyright
|
6
6
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/dayvan.rb
CHANGED
data/lib/dayvan/attachment.rb
CHANGED
data/lib/dayvan/cli.rb
CHANGED
@@ -17,14 +17,12 @@ class Dayvan::Cli < Thor
|
|
17
17
|
empty_directory 'config'
|
18
18
|
|
19
19
|
create_file "config/#{name}.yaml" do
|
20
|
-
{'
|
21
|
-
'database' => {
|
20
|
+
{'database' => {
|
22
21
|
'url' => "http://localhost:5984/#{name}"
|
23
|
-
|
24
|
-
}.to_yaml.split("\n")[1..-1].join("\n") + "\n"
|
22
|
+
}}.to_yaml.split("\n")[1..-1].join("\n") + "\n"
|
25
23
|
end
|
26
24
|
|
27
|
-
copy_file '
|
25
|
+
copy_file 'validation.coffee.erb', 'config/validation.coffee'
|
28
26
|
|
29
27
|
empty_directory 'views'
|
30
28
|
copy_file 'all.coffee.erb', 'views/all.coffee'
|
@@ -42,10 +40,14 @@ class Dayvan::Cli < Thor
|
|
42
40
|
def push
|
43
41
|
Dayvan.project.create_database!
|
44
42
|
Dayvan.project.push!
|
45
|
-
rescue Errno::ECONNREFUSED, RestClient::Unauthorized
|
43
|
+
rescue SocketError, Errno::ECONNREFUSED, RestClient::Unauthorized
|
46
44
|
abort "fatal: Couldn't connect to CouchDB at #{Dayvan.project.db.url}"
|
47
45
|
rescue Dayvan::ConfigError
|
48
|
-
abort "fatal:
|
46
|
+
abort "fatal: No Dayvan config found, searched for \n" +
|
47
|
+
Dayvan.project.config_search_paths.
|
48
|
+
map {|p| ' - ' + p.relative_path_from(Dayvan.project.dir).to_s}.
|
49
|
+
join("\n") +
|
50
|
+
"\n"
|
49
51
|
end
|
50
52
|
|
51
53
|
private
|
data/lib/dayvan/design.rb
CHANGED
@@ -33,9 +33,8 @@ class Dayvan::Design
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def attachment_path
|
36
|
-
|
37
|
-
|
38
|
-
Dayvan.project.dir.join('public')
|
36
|
+
config_val('attachment_path', 'attachments_path', 'attachments') ||
|
37
|
+
Dayvan.project.dir.join('public')
|
39
38
|
end
|
40
39
|
|
41
40
|
def views
|
@@ -43,27 +42,26 @@ class Dayvan::Design
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def view_path
|
46
|
-
|
47
|
-
|
48
|
-
Dayvan.project.dir.join('views')
|
45
|
+
config_val('view_path', 'views_path', 'views') ||
|
46
|
+
Dayvan.project.dir.join('views')
|
49
47
|
end
|
50
48
|
|
51
49
|
def validate_doc_update
|
52
|
-
Dayvan::
|
50
|
+
Dayvan::Validation.all(validate_doc_update_path)
|
53
51
|
end
|
54
52
|
|
55
53
|
def validate_doc_update_path
|
56
|
-
|
57
|
-
|
54
|
+
config_val('validation_path', 'validate_path', 'validation') ||
|
55
|
+
Dayvan.project.dir.join('config','validation.coffee')
|
58
56
|
end
|
59
57
|
|
60
58
|
|
61
59
|
def to_hash
|
62
|
-
|
60
|
+
{ '_rev' => rev,
|
61
|
+
'_attachments' => attachments,
|
63
62
|
'views' => views,
|
64
63
|
'validate_doc_update' => validate_doc_update
|
65
|
-
}
|
66
|
-
rev ? hsh.merge('_rev' => rev) : hsh
|
64
|
+
}.reject {|key, val| !val}
|
67
65
|
end
|
68
66
|
|
69
67
|
def to_json
|
@@ -74,4 +72,10 @@ class Dayvan::Design
|
|
74
72
|
doc.put to_json
|
75
73
|
end
|
76
74
|
|
75
|
+
private
|
76
|
+
|
77
|
+
def config_val(*keys)
|
78
|
+
keys.find {|key| config.has_key?(key)}
|
79
|
+
end
|
80
|
+
|
77
81
|
end
|
data/lib/dayvan/project.rb
CHANGED
@@ -12,7 +12,7 @@ class Dayvan::Project
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def designs
|
15
|
-
config['designs'].
|
15
|
+
(config['designs'] || [dir.basename]).
|
16
16
|
map {|design| Dayvan::Design.new_from_config(design)}
|
17
17
|
end
|
18
18
|
|
@@ -29,15 +29,18 @@ class Dayvan::Project
|
|
29
29
|
)[dbname]
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def config_search_paths
|
33
33
|
dirname = dir.expand_path.basename
|
34
|
-
["#{dirname}.yaml", "#{dirname}.yml", '
|
34
|
+
["#{dirname}.yaml", "#{dirname}.yml", 'dayvan.yaml', 'dayvan.yml'].
|
35
35
|
inject([]) {|dirs, f|
|
36
36
|
dirs << dir.join('config',f)
|
37
37
|
dirs << dir.join(f)
|
38
38
|
dirs
|
39
|
-
}.
|
40
|
-
|
39
|
+
}.uniq
|
40
|
+
end
|
41
|
+
|
42
|
+
def config_path
|
43
|
+
config_search_paths.find {|f| f.file? && f.readable?} ||
|
41
44
|
raise(Dayvan::ConfigError)
|
42
45
|
end
|
43
46
|
|
data/lib/dayvan/view.rb
CHANGED
File without changes
|
data/templates/welcome.html.erb
CHANGED
@@ -24,4 +24,4 @@ a:hover { color: #06C; }
|
|
24
24
|
</hgroup>
|
25
25
|
<p>Push new versions of your app again with <code>dvn push</code>.</p>
|
26
26
|
<p>Add attachments to <code>public</code> directory and views to the <code>views</code> directory. These settings can be changed in the <code>config/<%= @name %>.yaml</code> file.</p>
|
27
|
-
<p class=footer><a href=http://chrislloyd.
|
27
|
+
<p class=footer><a href=http://chrislloyd.cloudant.com/dayvan/_design/dayvan/index.html>Reference</a> · <a href=http://github.com/chrislloyd/dayvan>Code</a> · <a href=http://thelincolnshirepoacher.com>The Poacher</a></p>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dayvan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Lloyd
|
@@ -81,11 +81,11 @@ files:
|
|
81
81
|
- lib/dayvan/cli.rb
|
82
82
|
- lib/dayvan/design.rb
|
83
83
|
- lib/dayvan/project.rb
|
84
|
-
- lib/dayvan/
|
84
|
+
- lib/dayvan/validation.rb
|
85
85
|
- lib/dayvan/view.rb
|
86
86
|
- templates/all.coffee.erb
|
87
|
-
- templates/security.coffee.erb
|
88
87
|
- templates/size.coffee.erb
|
88
|
+
- templates/validation.coffee.erb
|
89
89
|
- templates/welcome.html.erb
|
90
90
|
has_rdoc: true
|
91
91
|
homepage: http://chrislloyd.github.com/dayvan
|