carte-server 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c467e1cd99ce718cb1debd0ccec6d12ced89426
4
- data.tar.gz: 83d79a8bc6e1fadadb298dba101fc0c90ba16464
3
+ metadata.gz: f0423f8aecc07a944fb1faf5c5bb2af43c106493
4
+ data.tar.gz: d68c7838e9d0af04b83db3e4a92945cbb0bad565
5
5
  SHA512:
6
- metadata.gz: 36231df14cd93e7afd5596b694051b27c71a9592ee95bf1f44bcbe12ac86741b3f2645067bd62d89b3286743b58b7f6d001d804087aa19cc644d6b2711f9515c
7
- data.tar.gz: 332122281586ce0350b0a616948dfd8b8671a19d3eae60d55dbbed6b0a150ea5f20795709e0c3432baf18022ccb6777597d15a4320918a75cb782d6c267346c8
6
+ metadata.gz: de01034eff57261dbc18adb567f0996c5b71a80309179175584b94d7a77528733cbc55ed0b21dfe2320023082e094465954a8db221f9e2d5b37bf7b8a4461dc6
7
+ data.tar.gz: 9f6df969ae49d51467b1a8671c216ab4e9d9dbe743372673e366514d9c1d4a4302356ec704a49a02f4bfa6f59dac93316b93e2a57fcc8f3355eecfb931e54c73
data/README.md CHANGED
@@ -33,8 +33,6 @@ Japanese introduction is [here](http://tily.tumblr.com/post/117678137942/carte).
33
33
 
34
34
  [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/tily/carte-sandbox)
35
35
 
36
- Deploy your carte with the button above. After deployment, you may want to customize your carte.
37
-
38
36
  ```
39
37
  ## change title and description
40
38
  $ vi config.json
@@ -49,3 +47,5 @@ $ docker build -t carte .
49
47
  $ docker run --name mongo -d mongo
50
48
  $ docker run --name carte --link mongo:mongo -p 80:80 -d carte
51
49
  ```
50
+
51
+ After deployment, you may want to [customize your carte](https://github.com/tily/carte/wiki/Configuration).
data/config.ru CHANGED
@@ -11,6 +11,7 @@ class Carte::Server
11
11
  end
12
12
 
13
13
  map('/') do
14
+ use Rack::Deflater
14
15
  use Rack::Static, urls: [""], root: $config['root_dir'], index: $config['html_path']
15
16
  run Rack::Directory.new $config['root_dir']
16
17
  end
@@ -41,7 +41,7 @@ module.exports = React.createClass
41
41
  <div className="container" style={{paddingLeft:"5px",paddingRight:"5px"}}>
42
42
  {if !@props.card
43
43
  <div className="row">
44
- <div className="col-sm-6" style={{padding:"0px"}}>
44
+ <div className="col-sm-4" style={{padding:"0px"}}>
45
45
  <ul className="nav nav-pills">
46
46
  {
47
47
  for menuItem in config.menu_items
@@ -56,7 +56,15 @@ module.exports = React.createClass
56
56
  <li><a href={config.root_path + config.api_path + "/cards.xml?" + @queryParam({}, [])} style={{padding:'6px 12px'}}><i className="fa fa-rss" /></a></li>
57
57
  </ul>
58
58
  </div>
59
- <div className="col-sm-6" style={{padding:"0px"}}>
59
+ <div className="col-sm-4" style={{padding:"0px"}}>
60
+ {
61
+ if @props.cards.pagination
62
+ <a href="javascript:void(0)" className="center-block text-center" style={padding:'6px 12px'}>
63
+ <span className="badge text-center" style={backgroundColor:'#333'}>{@props.cards.pagination.total_entries}</span>
64
+ </a>
65
+ }
66
+ </div>
67
+ <div className="col-sm-4" style={{padding:"0px"}}>
60
68
  {
61
69
  if @props.cards.query.order == 'random'
62
70
  <ul className="nav nav-pills pull-right">
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "carte-client",
3
3
  "description": "something like dictionary, wiki, or information card",
4
- "version": "0.0.22",
4
+ "version": "0.0.23",
5
5
  "main": "lib/carte.coffee",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -234,4 +234,70 @@ describe 'API' do
234
234
  expect(response['tags'].size).to eq(6)
235
235
  end
236
236
  end
237
+
238
+ context 'For document' do
239
+ it 'POST /cards.json' do
240
+ cards = [
241
+ ['The Fool', 'The Fool or The Jester is one of the 78 cards in a Tarot deck; one of the 22 Trump cards that make up the Major Arcana. The Fool is unnumbered; sometimes represented as 0 (the first) or XXI (the second to last) or XXII (the last) Major Arcana in decks. It is used in divination as well as in game playing.'],
242
+ ['The Magician', 'The Magician, The Magus, or The Juggler (I) is the first trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination. In divination it is considered by some to succeed The Fool card, often numbered 0.'],
243
+ ['The High Priestess', 'The High Priestess (II) is the second trump or Major Arcana card in most traditional Tarot decks. This card is used in game playing as well as in divination. In the first Tarot pack with inscriptions, the 18th-century woodcut Marseilles Tarot, this figure is crowned with the Papal tiara and labelled La Papesse, the Popess, a possible reference to the legend of Pope Joan.'],
244
+ ['The Empress', 'The Empress (III) is the third trump or Major Arcana card in traditional Tarot decks. It is used in Tarot card games as well as divination.'],
245
+ ['The Emperor', 'The Emperor (IV) is the fourth trump or Major Arcana card in traditional Tarot decks. It is used in game playing as well as in divination.'],
246
+ ['The Hierophant', 'The Hierophant (V), in some decks named The Pope, is the fifth trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination.'],
247
+ ['The Lovers', 'The Lovers (VI) is the sixth trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination.'],
248
+ ['The Chariot', 'The Chariot (VII) is the seventh trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination.'],
249
+ ['Justice', 'Justice is a Major Arcana Tarot card, numbered either VIII or XI, depending on the deck. This card is used in game playing as well as in divination.'],
250
+ ['The Hermit', 'The Hermit (IX) is the ninth trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination.'],
251
+ ['Wheel of Fortune', 'Wheel of Fortune (X) is the tenth trump or Major Arcana card in most Tarot decks. It is used in game playing as well as in divination.'],
252
+ ['Strength', 'Strength is a Major Arcana Tarot card, and is numbered either XI or VIII, depending on the deck. Historically it was called Fortitude, and in the Thoth Tarot deck it is called Lust. This card is used in game playing as well as in divination.'],
253
+ ['The Hanged Man', 'The Hanged Man (XII) is the twelfth trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination. It depicts a pittura infamante, a shameful image of a traitor being punished in a manner common at the time for traitors in Italy.'],
254
+ ['Death', 'Death (XIII) is the thirteenth trump or Major Arcana card in most traditional Tarot decks. It is used in Tarot, tarock and tarocchi games as well as in divination.'],
255
+ ['Temperance', 'Temperance (XIV) is the fourteenth trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination.'],
256
+ ['The Devil', 'The Devil (XV) is the fifteenth trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination.'],
257
+ ['The Tower', 'The Tower (XVI) (most common modern name) is the 16th trump or Major Arcana card in most Italian-suited Tarot decks. It is used in game playing as well as in divination.'],
258
+ ['The Star', 'The Star (XVII) is the seventeenth trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination.'],
259
+ ['The Moon', 'The Moon (XVIII) is the eighteenth trump or Major Arcana card in most traditional Tarot decks. It is used in game playing as well as in divination.'],
260
+ ['The Sun', 'The Sun (XIX) is a trump card in the tarot deck. Tarot trumps are often called Major Arcana by tarot card readers.'],
261
+ ['Judgement', 'Judgement (XX), or in some decks spelled Judgment, is a Tarot card, part of the Major Arcana suit usually comprising 22 cards.'],
262
+ ['The World', 'The World (XXI) is a trump or Major Arcana card in the tarot deck. It is usually the final card of the Major Arcana or tarot trump sequence. In the tarot family of card games, this card is usually worth five points.'],
263
+ ]
264
+ cards.each do |card|
265
+ body = JSON.pretty_generate(title: card.first, content: card.last, tags: ['tarot', 'arcana'])
266
+ puts body
267
+ response = client.post('/cards.json', body: body)
268
+ puts JSON.pretty_generate response
269
+ end
270
+
271
+ people = [
272
+ ['The Fool', nil],
273
+ ['The Magician', 'I'],
274
+ ['The High Priestess', 'II'],
275
+ ['The Empress', 'III'],
276
+ ['The Emperor', 'IV'],
277
+ ['The Hierophant', 'V'],
278
+ ['The Lovers', 'VI'],
279
+ ['The Chariot', 'VII'],
280
+ ['The Hermit', 'IX'],
281
+ ['The Hanged Man', 'XII']
282
+ ]
283
+ people.each do |person|
284
+ body = JSON.pretty_generate(new_title: "#{person.first} (#{person.last})", tags: %w(tarot arcana people))
285
+ puts body
286
+ response = client.put("/cards/#{URI.escape person.first}.json", body: body)
287
+ puts JSON.pretty_generate response
288
+ end
289
+
290
+ response = client.get('/cards.json', query: {sort:'title', order: 'asc', tags: 'people', title: '^The (C|E)'})
291
+ puts JSON.pretty_generate response
292
+
293
+ response = client.get("/cards/#{URI.escape 'The Hierophant (V)'}.json", query: {context: 'title'})
294
+ puts JSON.pretty_generate response
295
+
296
+ response = client.get("/cards/#{URI.escape 'The Hierophant (V)'}/history.json")
297
+ puts JSON.pretty_generate response
298
+
299
+ response = client.get("/tags.json")
300
+ puts JSON.pretty_generate response
301
+ end
302
+ end
237
303
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carte-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - tily