togostanza 0.0.4 → 0.0.5

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: f475ea5f00c9b5b323d50f3c129186cd37f3cda2
4
- data.tar.gz: 8df394980d0445c507356cdbd4f20fc463c9704c
3
+ metadata.gz: a95f963ba13ba30d3915279e89b17980f2347602
4
+ data.tar.gz: 64ec79fc4621e83f2246d8c96d6b1d05e9d38ad2
5
5
  SHA512:
6
- metadata.gz: b33ea83721ac7d02ca31322e6f18a9cff521abe29e6571ac975993e2dd1123386108bd8aef9e847f484af2556bb766f9421d510ed10d580481a6d436db181dec
7
- data.tar.gz: d54b39c41ee9f35141453a19516e28d8e5ed08091fe3c093e57758b44eb1d077b210e2b67c42e4abe8e60a8a9c6033a80c7ade5e63df97bfcc6c286bebf8e6a5
6
+ metadata.gz: 63b4d8c3ed61593e06ea3376aefb25ba6453704e4182b584996de29c2695266f01c67d18efb917e5a2643ad9f929b01ea41845e5b7cb66192d578c792c2060d3
7
+ data.tar.gz: 1e07f6d3304a57356bd2467ce6410246b1c1e62b08586e96cbefb66a0af2612efcfd5ebfddb758e6581c0faf44cd783d2ad4b310145d060fcdcc7249589bd844
@@ -1,11 +1,13 @@
1
1
  require 'sinatra/base'
2
+ require 'sinatra/json'
2
3
  require 'sinatra/reloader'
3
4
  require 'haml'
4
5
 
5
6
  module TogoStanza
6
7
  class Application < Sinatra::Base
7
- set :root, File.expand_path('../../..', __FILE__)
8
- set :haml, escape_html: true
8
+ set :root, File.expand_path('../../..', __FILE__)
9
+ set :haml, escape_html: true
10
+ set :protection, except: [:json_csrf]
9
11
 
10
12
  configure :development do
11
13
  register Sinatra::Reloader
@@ -28,10 +30,9 @@ module TogoStanza
28
30
  end
29
31
 
30
32
  get '/:id/resources/:resource_id' do |id, resource_id|
31
- content_type :json
32
-
33
33
  value = Stanza.find(id).new(params).resource(resource_id)
34
- {resource_id => value}.to_json
34
+
35
+ json resource_id => value
35
36
  end
36
37
 
37
38
  get '/:id/help' do |id|
@@ -44,6 +44,7 @@ module TogoStanza
44
44
  template 'help.md.erb', "#{file_name}/help.md"
45
45
 
46
46
  create_file "#{file_name}/assets/.keep"
47
+ create_file "#{file_name}/log/.keep"
47
48
  end
48
49
 
49
50
  def inject_gem
@@ -1,3 +1,3 @@
1
1
  module TogoStanza
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -1,5 +1,11 @@
1
1
  require 'bundler'
2
- Bundler.require
2
+
3
+ env = ENV['RACK_ENV'] || :development
4
+ Bundler.require :default, env
5
+
6
+ log = open(File.expand_path("../log/#{env}.log", __FILE__), 'a+').tap {|f| f.sync = true }
7
+
8
+ use Rack::CommonLogger, log
3
9
 
4
10
  map '/stanza/assets' do
5
11
  run TogoStanza.sprockets
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togostanza
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima