carte-server 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.buildpacks +2 -0
- data/.gitignore +0 -1
- data/.travis.yml +14 -0
- data/Gemfile.lock +120 -0
- data/Procfile +1 -0
- data/README.md +2 -2
- data/Rakefile +1 -0
- data/carte.gemspec +2 -1
- data/lib/carte/client/views/header.cjsx +32 -13
- data/lib/carte/client/views/list.cjsx +10 -6
- data/lib/carte/server.rb +9 -5
- data/lib/carte/server/models/history.rb +1 -1
- data/package.json +1 -1
- data/spec/server_spec.rb +3 -3
- metadata +20 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78815b0f269198095f1608e9a498820bb5d0c771
|
4
|
+
data.tar.gz: 8d2833dc30b92f2bca88f3c865333f3dc6edf4ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab54463ad01c2b6f1a1e3b98e71077f33997c539a7b38ec27bb9e27df448ce70e5fd8d6044bb15ffaf2b425542e5428e57652e3d56ba683d01947af1ffc092cb
|
7
|
+
data.tar.gz: ae2b69ccf3300a2b96cdf02d5340774e55f0a91e8dff0f3d52c62fa7606ed993e049e99189c0ac60663556b77d2adb4e58d71924d7e6faa1102b18747f32a56b
|
data/.buildpacks
ADDED
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.0.0
|
4
|
+
- 1.9.3
|
5
|
+
#- jruby-19mode
|
6
|
+
#- rbx-2
|
7
|
+
deploy:
|
8
|
+
provider: heroku
|
9
|
+
api_key:
|
10
|
+
secure: kLO43BYTj0Uo1fGJPYvO0CHZMWBRF2s0nN4SdxkKpHVNlYVPMnuU13s38TVzrFxvoGlUVqJ0UWJ0SFgEpLbLGZ/31rXkS+y+89Ul4qgL8AaC5gEKZE6vQ/b9V7i4Vd3BkUaEEhh2gvv6zwmH/o82/tKS6H8hoktHDNbfuSSCKuY=
|
11
|
+
app: carte-test
|
12
|
+
on:
|
13
|
+
repo: tily/carte
|
14
|
+
run: bundle exec rspec spec/
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
carte-server (0.0.23)
|
5
|
+
activesupport
|
6
|
+
haml
|
7
|
+
mongoid
|
8
|
+
mongoid-geospatial
|
9
|
+
mongoid-simple-tags
|
10
|
+
mongoid_auto_increment_id (= 0.6.5)
|
11
|
+
pry
|
12
|
+
redcarpet
|
13
|
+
rspec
|
14
|
+
sinatra
|
15
|
+
sinatra-contrib
|
16
|
+
will_paginate_mongoid
|
17
|
+
|
18
|
+
GEM
|
19
|
+
remote: https://rubygems.org/
|
20
|
+
specs:
|
21
|
+
activemodel (4.2.1)
|
22
|
+
activesupport (= 4.2.1)
|
23
|
+
builder (~> 3.1)
|
24
|
+
activesupport (4.2.1)
|
25
|
+
i18n (~> 0.7)
|
26
|
+
json (~> 1.7, >= 1.7.7)
|
27
|
+
minitest (~> 5.1)
|
28
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
29
|
+
tzinfo (~> 1.1)
|
30
|
+
backports (3.6.4)
|
31
|
+
bson (2.3.0)
|
32
|
+
builder (3.2.2)
|
33
|
+
coderay (1.1.0)
|
34
|
+
connection_pool (2.2.0)
|
35
|
+
diff-lcs (1.2.5)
|
36
|
+
haml (4.0.6)
|
37
|
+
tilt
|
38
|
+
httparty (0.13.3)
|
39
|
+
json (~> 1.8)
|
40
|
+
multi_xml (>= 0.5.2)
|
41
|
+
i18n (0.7.0)
|
42
|
+
json (1.8.2)
|
43
|
+
method_source (0.8.2)
|
44
|
+
minitest (5.6.1)
|
45
|
+
mongoid (4.0.2)
|
46
|
+
activemodel (~> 4.0)
|
47
|
+
moped (~> 2.0.0)
|
48
|
+
origin (~> 2.1)
|
49
|
+
tzinfo (>= 0.3.37)
|
50
|
+
mongoid-geospatial (4.0.1)
|
51
|
+
mongoid (>= 4.0.0)
|
52
|
+
mongoid-simple-tags (0.1.3)
|
53
|
+
json (~> 1.8)
|
54
|
+
mongoid (>= 3.0.3)
|
55
|
+
mongoid_auto_increment_id (0.6.5)
|
56
|
+
mongoid (>= 3.1.0, < 4.1.0)
|
57
|
+
moped (2.0.4)
|
58
|
+
bson (~> 2.2)
|
59
|
+
connection_pool (~> 2.0)
|
60
|
+
optionable (~> 0.2.0)
|
61
|
+
multi_json (1.11.0)
|
62
|
+
multi_xml (0.5.5)
|
63
|
+
optionable (0.2.0)
|
64
|
+
origin (2.1.1)
|
65
|
+
pry (0.10.1)
|
66
|
+
coderay (~> 1.1.0)
|
67
|
+
method_source (~> 0.8.1)
|
68
|
+
slop (~> 3.4)
|
69
|
+
rack (1.6.0)
|
70
|
+
rack-protection (1.5.3)
|
71
|
+
rack
|
72
|
+
rack-test (0.6.3)
|
73
|
+
rack (>= 1.0)
|
74
|
+
rake (10.4.2)
|
75
|
+
redcarpet (3.2.3)
|
76
|
+
rspec (3.2.0)
|
77
|
+
rspec-core (~> 3.2.0)
|
78
|
+
rspec-expectations (~> 3.2.0)
|
79
|
+
rspec-mocks (~> 3.2.0)
|
80
|
+
rspec-core (3.2.3)
|
81
|
+
rspec-support (~> 3.2.0)
|
82
|
+
rspec-expectations (3.2.1)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.2.0)
|
85
|
+
rspec-mocks (3.2.1)
|
86
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
+
rspec-support (~> 3.2.0)
|
88
|
+
rspec-support (3.2.2)
|
89
|
+
shotgun (0.9.1)
|
90
|
+
rack (>= 1.0)
|
91
|
+
sinatra (1.4.6)
|
92
|
+
rack (~> 1.4)
|
93
|
+
rack-protection (~> 1.4)
|
94
|
+
tilt (>= 1.3, < 3)
|
95
|
+
sinatra-contrib (1.4.2)
|
96
|
+
backports (>= 2.0)
|
97
|
+
multi_json
|
98
|
+
rack-protection
|
99
|
+
rack-test
|
100
|
+
sinatra (~> 1.4.0)
|
101
|
+
tilt (~> 1.3)
|
102
|
+
slop (3.6.0)
|
103
|
+
thread_safe (0.3.5)
|
104
|
+
tilt (1.4.1)
|
105
|
+
tzinfo (1.2.2)
|
106
|
+
thread_safe (~> 0.1)
|
107
|
+
will_paginate (3.0.7)
|
108
|
+
will_paginate_mongoid (2.0.1)
|
109
|
+
mongoid
|
110
|
+
will_paginate (~> 3.0)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
ruby
|
114
|
+
|
115
|
+
DEPENDENCIES
|
116
|
+
bundler (~> 1.7)
|
117
|
+
carte-server!
|
118
|
+
httparty
|
119
|
+
rake (~> 10.0)
|
120
|
+
shotgun
|
data/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: gulp build && rackup -p $PORT
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Carte
|
2
2
|
|
3
|
-
[![npm version](https://badge.fury.io/js/carte-client.svg)](http://badge.fury.io/js/carte-client)
|
4
|
-
[![gem
|
3
|
+
* client: [![npm version](https://badge.fury.io/js/carte-client.svg)](http://badge.fury.io/js/carte-client) [![npm dependencies](https://david-dm.org/tily/carte.svg)](https://david-dm.org/tily/carte)
|
4
|
+
* server: [![gem version](https://badge.fury.io/rb/carte-server.svg)](http://badge.fury.io/rb/carte-server) [![Code Climate](https://codeclimate.com/github/tily/carte/badges/gpa.svg)](https://codeclimate.com/github/tily/carte) [![Build Status](https://travis-ci.org/tily/carte.svg?branch=master)](https://travis-ci.org/tily/carte)
|
5
5
|
|
6
6
|
Something like dictionary, wiki, or information card.
|
7
7
|
|
data/Rakefile
CHANGED
data/carte.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency "shotgun"
|
24
|
-
spec.add_development_dependency "rspec"
|
24
|
+
#spec.add_development_dependency "rspec"
|
25
25
|
spec.add_development_dependency "httparty"
|
26
26
|
|
27
27
|
spec.add_dependency "sinatra"
|
@@ -35,4 +35,5 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_dependency "mongoid-geospatial"
|
36
36
|
spec.add_dependency "redcarpet"
|
37
37
|
spec.add_dependency "pry"
|
38
|
+
spec.add_dependency "rspec"
|
38
39
|
end
|
@@ -12,6 +12,7 @@ module.exports = React.createClass
|
|
12
12
|
|
13
13
|
getInitialState: ()->
|
14
14
|
searchText: ''
|
15
|
+
isCheckedIncludeContent: false
|
15
16
|
|
16
17
|
componentWillMount: ()->
|
17
18
|
console.log 'header mounted'
|
@@ -32,6 +33,8 @@ module.exports = React.createClass
|
|
32
33
|
if @props.router.query.title
|
33
34
|
searchText.push @props.router.query.title
|
34
35
|
@setState searchText: searchText.join(' ')
|
36
|
+
if @props.router.query.content
|
37
|
+
@setState isCheckedIncludeContent: true
|
35
38
|
@forceUpdate()
|
36
39
|
@props.router.on "route", @callback
|
37
40
|
|
@@ -39,24 +42,34 @@ module.exports = React.createClass
|
|
39
42
|
console.log 'componentWillMount un'
|
40
43
|
@props.router.off "route", @callback
|
41
44
|
|
45
|
+
onChangeIncludeContent: (event)->
|
46
|
+
@setState isCheckedIncludeContent: !@state.isCheckedIncludeContent, ()=>
|
47
|
+
@search() if @state.searchText != ''
|
48
|
+
|
42
49
|
onChangeSearchText: (event)->
|
43
50
|
@setState searchText: event.target.value
|
44
51
|
|
45
|
-
|
52
|
+
onKeyDownSearchText: (event)->
|
53
|
+
console.log 'press', event
|
46
54
|
if event.keyCode == 13 # ENTER
|
47
55
|
console.log '13 enter'
|
48
56
|
event.preventDefault()
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
@search()
|
58
|
+
|
59
|
+
search: ->
|
60
|
+
console.log @state
|
61
|
+
tags = []
|
62
|
+
titles = []
|
63
|
+
for searchText in @state.searchText.split(' ')
|
64
|
+
if match = searchText.match(/^#(.+)/)
|
65
|
+
tags.push(match[1])
|
66
|
+
else
|
67
|
+
titles.push(searchText)
|
68
|
+
query = {}
|
69
|
+
query.title = titles.join(' ') if titles.length > 0
|
70
|
+
query.content = titles.join(' ') if titles.length > 0 && @state.isCheckedIncludeContent
|
71
|
+
query.tags = tags.join(',') if tags.length > 0
|
72
|
+
location.hash = '/?' + $.param(query)
|
60
73
|
|
61
74
|
render: ->
|
62
75
|
<nav className="navbar navbar-default" style={{padding:"0px",backgroundColor:"white",marginBottom:"5px"}}>
|
@@ -72,7 +85,13 @@ module.exports = React.createClass
|
|
72
85
|
<div>
|
73
86
|
<form className="navbar-form navbar-left" role="search">
|
74
87
|
<div className="form-group">
|
75
|
-
<input type="text" className="form-control" value={@state.searchText} onChange={@onChangeSearchText}
|
88
|
+
<input type="text" className="form-control" value={@state.searchText} onChange={@onChangeSearchText} onKeyDown={@onKeyDownSearchText} placeholder='Search ...' />
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div className="checkbox">
|
92
|
+
<label>
|
93
|
+
<input type="checkbox" checked={@state.isCheckedIncludeContent} onChange={@onChangeIncludeContent} /> Include content
|
94
|
+
</label>
|
76
95
|
</div>
|
77
96
|
</form>
|
78
97
|
<ul className="nav navbar-nav navbar-right">
|
@@ -57,12 +57,16 @@ module.exports = React.createClass
|
|
57
57
|
</ul>
|
58
58
|
</div>
|
59
59
|
<div className="col-sm-4" style={{padding:"0px"}}>
|
60
|
-
{
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
60
|
+
<a href="javascript:void(0)" className="center-block text-center" style={padding:'6px 12px'}>
|
61
|
+
<span className="badge text-center" style={backgroundColor:'#333'}>
|
62
|
+
{
|
63
|
+
if @props.cards.pagination
|
64
|
+
@props.cards.pagination.total_entries
|
65
|
+
else
|
66
|
+
<i className="glyphicon glyphicon-refresh glyphicon-refresh-animate" />
|
67
|
+
}
|
68
|
+
</span>
|
69
|
+
</a>
|
66
70
|
</div>
|
67
71
|
<div className="col-sm-4" style={{padding:"0px"}}>
|
68
72
|
{
|
data/lib/carte/server.rb
CHANGED
@@ -41,16 +41,20 @@ module Carte
|
|
41
41
|
else
|
42
42
|
cards = Card.send(order, sort)
|
43
43
|
end
|
44
|
+
conditions = []
|
44
45
|
if title = params[:title]
|
45
|
-
|
46
|
+
conditions << {title: /#{title}/i}
|
47
|
+
end
|
48
|
+
if content = params[:content]
|
49
|
+
conditions << {content: /#{content}/i}
|
50
|
+
end
|
51
|
+
if conditions.size > 0
|
52
|
+
cards = cards.any_of(conditions)
|
46
53
|
end
|
47
54
|
if params[:tags]
|
48
55
|
tags = params[:tags].split(',')
|
49
56
|
cards = cards.tagged_with_all(tags)
|
50
57
|
end
|
51
|
-
if content = params[:content]
|
52
|
-
cards = cards.any_of({content: /#{content}/i})
|
53
|
-
end
|
54
58
|
cards = cards.paginate(per_page: 9, page: params[:page])
|
55
59
|
end
|
56
60
|
|
@@ -68,7 +72,7 @@ module Carte
|
|
68
72
|
get '/cards.json' do
|
69
73
|
cards = search(params)
|
70
74
|
{
|
71
|
-
cards: cards.as_json(only: %w(title content version
|
75
|
+
cards: cards.map {|card| card.as_json(only: %w(title content tags)).update(version: card.version) },
|
72
76
|
pagination: {current_page: cards.current_page, total_pages: cards.total_pages, total_entries: cards.total_entries}
|
73
77
|
}.to_json
|
74
78
|
end
|
data/package.json
CHANGED
data/spec/server_spec.rb
CHANGED
@@ -8,14 +8,14 @@ class Carte::Server
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
class
|
11
|
+
class CarteClient
|
12
12
|
include HTTParty
|
13
|
-
base_uri 'http://localhost:9393/api/'
|
13
|
+
base_uri ENV['CARTE_API_ENDPOINT'] || 'http://localhost:9393/api/'
|
14
14
|
format :json
|
15
15
|
end
|
16
16
|
|
17
17
|
def client
|
18
|
-
@client ||=
|
18
|
+
@client ||= CarteClient
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'API' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carte-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tily
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: httparty
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,6 +220,20 @@ dependencies:
|
|
234
220
|
- - '>='
|
235
221
|
- !ruby/object:Gem::Version
|
236
222
|
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: rspec
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - '>='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :runtime
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - '>='
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
237
|
description: something like dictionary, wiki, or information card
|
238
238
|
email:
|
239
239
|
- tidnlyam@gmail.com
|
@@ -241,11 +241,15 @@ executables: []
|
|
241
241
|
extensions: []
|
242
242
|
extra_rdoc_files: []
|
243
243
|
files:
|
244
|
+
- .buildpacks
|
244
245
|
- .gitignore
|
245
246
|
- .rspec
|
247
|
+
- .travis.yml
|
246
248
|
- Dockerfile
|
247
249
|
- Gemfile
|
250
|
+
- Gemfile.lock
|
248
251
|
- LICENSE.txt
|
252
|
+
- Procfile
|
249
253
|
- README.md
|
250
254
|
- Rakefile
|
251
255
|
- carte.gemspec
|