vitreous_standalone 0.0.15 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vitreous_standalone (0.0.13)
4
+ vitreous_standalone (0.0.17)
5
5
  json
6
- mustache
7
6
  sinatra
8
7
  vitreous_share
9
8
 
@@ -28,7 +27,7 @@ GEM
28
27
  rack (~> 1.1)
29
28
  tilt (>= 1.2.2, < 2.0)
30
29
  tilt (1.3.2)
31
- vitreous_share (0.0.21)
30
+ vitreous_share (0.0.25)
32
31
  dropbox
33
32
  json
34
33
  mustache
@@ -15,7 +15,7 @@ rescue LoadError
15
15
  require 'vitreous_standalone'
16
16
  end
17
17
 
18
- puts "Starting Vitreous Standalone version #{Vitreous::Standalone::VERSION}"
18
+ puts "Starting Vitreous Standalone version '#{Vitreous::Standalone::VERSION}' with Vitreous Share version '#{Vitreous::Share::VERSION}'"
19
19
  puts "Go to: http://localhost:4567"
20
20
 
21
21
  Vitreous::Standalone::App.run!
@@ -1,6 +1,4 @@
1
1
  VITREOUS_FOLDER = ENV['VITREOUS_FOLDER']
2
- Mustache.template_path = "#{VITREOUS_FOLDER}/template"
3
- Mustache.template_extension = 'html'
4
2
 
5
3
  module Vitreous
6
4
  module Share
@@ -14,7 +12,12 @@ end
14
12
 
15
13
  module Vitreous
16
14
  module Standalone
17
- class App < Sinatra::Base
15
+ class App < Sinatra::Base
16
+ if( test? )
17
+ set :raise_errors, true
18
+ set :show_exceptions, false
19
+ end
20
+
18
21
  # assets
19
22
  get "/assets/*" do |asset|
20
23
  send_file "#{VITREOUS_FOLDER}/template/assets/#{asset}"
@@ -32,20 +35,16 @@ module Vitreous
32
35
 
33
36
  # element
34
37
  get '/*' do |resource|
35
- index = Vitreous::Share::Element.new( create_index )
36
- element = Vitreous::Share::IndexSearcher.search( index, "/#{resource}" )
37
-
38
- raise Sinatra::NotFound if element.nil?
39
-
40
- Mustache.render(
41
- File.read( "#{VITREOUS_FOLDER}/template/layout.html" ),
42
- {
43
- :domain => 'mydomain.com',
44
- :index => index,
45
- :element => element,
46
- :assets => "/assets"
47
- }
48
- )
38
+ result =
39
+ Vitreous::Share::Render.render(
40
+ :resource => "/#{resource}",
41
+ :index => create_index,
42
+ :assets => '/assets',
43
+ :templates => "#{VITREOUS_FOLDER}/template"
44
+ )
45
+
46
+ status result.status
47
+ result.body
49
48
  end
50
49
 
51
50
  def create_index
@@ -1,5 +1,5 @@
1
1
  module Vitreous
2
2
  module Standalone
3
- VERSION = "0.0.15"
3
+ VERSION = "0.0.17"
4
4
  end
5
5
  end
@@ -1,8 +1,8 @@
1
1
  require 'rubygems'
2
2
  require 'sinatra/base'
3
- require 'mustache'
4
3
  require 'yaml'
5
4
  require 'json'
6
5
  require 'vitreous_share'
6
+
7
7
  require File.expand_path "#{File.dirname(__FILE__)}/vitreous/standalone/app.rb"
8
- require File.expand_path "#{File.dirname(__FILE__)}/vitreous/standalone/version.rb"
8
+ require File.expand_path "#{File.dirname(__FILE__)}/vitreous/standalone/version.rb"
@@ -1,4 +1,5 @@
1
1
  ENV['VITREOUS_FOLDER'] = File.expand_path "#{File.dirname(__FILE__)}/fixtures/vitreous_folder"
2
+ ENV['RACK_ENV'] = 'test'
2
3
 
3
4
  require File.expand_path "#{File.dirname(__FILE__)}/../lib/vitreous_standalone.rb"
4
5
  require 'rack/test'
@@ -17,16 +18,19 @@ class VitreousStandaloneTest < Test::Unit::TestCase
17
18
  def test_show_root
18
19
  get '/'
19
20
  assert_equal File.read( "#{FIXTURES_PATH}/responses/show.txt" ), last_response.body
21
+ assert_equal 200, last_response.status
20
22
  end
21
23
 
22
24
  def test_show_collection
23
25
  get '/folder'
24
26
  assert_equal File.read( "#{FIXTURES_PATH}/responses/collection.txt" ), last_response.body
27
+ assert_equal 200, last_response.status
25
28
  end
26
29
 
27
30
  def test_show_element
28
31
  get '/folder/file'
29
32
  assert_equal File.read( "#{FIXTURES_PATH}/responses/element.txt" ), last_response.body
33
+ assert_equal 200, last_response.status
30
34
  end
31
35
 
32
36
  def test_404
@@ -49,8 +53,6 @@ class VitreousStandaloneTest < Test::Unit::TestCase
49
53
  def test_structure
50
54
  get '/structure'
51
55
  assert_equal 'application/json', last_response.content_type
52
- assert_equal 816, last_response.content_length
56
+ assert_equal 909, last_response.content_length
53
57
  end
54
-
55
-
56
58
  end
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_dependency "sinatra"
22
22
  s.add_dependency "json"
23
- s.add_dependency "mustache"
24
23
  s.add_dependency "vitreous_share"
25
24
 
26
25
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 15
9
- version: 0.0.15
8
+ - 17
9
+ version: 0.0.17
10
10
  platform: ruby
11
11
  authors:
12
12
  - Fernando Guillen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-12 00:00:00 +02:00
17
+ date: 2011-08-13 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -100,7 +100,7 @@ dependencies:
100
100
  type: :runtime
101
101
  version_requirements: *id006
102
102
  - !ruby/object:Gem::Dependency
103
- name: mustache
103
+ name: vitreous_share
104
104
  prerelease: false
105
105
  requirement: &id007 !ruby/object:Gem::Requirement
106
106
  none: false
@@ -112,19 +112,6 @@ dependencies:
112
112
  version: "0"
113
113
  type: :runtime
114
114
  version_requirements: *id007
115
- - !ruby/object:Gem::Dependency
116
- name: vitreous_share
117
- prerelease: false
118
- requirement: &id008 !ruby/object:Gem::Requirement
119
- none: false
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- segments:
124
- - 0
125
- version: "0"
126
- type: :runtime
127
- version_requirements: *id008
128
115
  description: Standalone version for the VitreousCloud
129
116
  email:
130
117
  - fguillen.mail@gmail.com