vitreous_standalone 0.0.7 → 0.0.9

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vitreous_standalone (0.0.5)
4
+ vitreous_standalone (0.0.7)
5
5
  json
6
6
  mustache
7
7
  sinatra
@@ -23,14 +23,16 @@ GEM
23
23
  rack-test (0.6.1)
24
24
  rack (>= 1.0)
25
25
  rake (0.9.2)
26
+ rdiscount (1.6.8)
26
27
  sinatra (1.2.6)
27
28
  rack (~> 1.1)
28
29
  tilt (>= 1.2.2, < 2.0)
29
30
  tilt (1.3.2)
30
- vitreous_share (0.0.9)
31
+ vitreous_share (0.0.15)
31
32
  dropbox
32
33
  json
33
34
  mustache
35
+ rdiscount
34
36
 
35
37
  PLATFORMS
36
38
  ruby
@@ -6,7 +6,7 @@ if ARGV.size != 1
6
6
  exit 1
7
7
  end
8
8
 
9
- ENV['VITREOUS_FOLDER'] = ARGV[0]
9
+ ENV['VITREOUS_FOLDER'] = File.expand_path ARGV[0]
10
10
 
11
11
  begin
12
12
  require 'vitreous_standalone'
@@ -19,6 +19,11 @@ module Vitreous
19
19
  get "/assets/*" do |asset|
20
20
  send_file "#{VITREOUS_FOLDER}/template/assets/#{asset}"
21
21
  end
22
+
23
+ get '/structure' do
24
+ content_type :json
25
+ JSON.pretty_generate( create_index )
26
+ end
22
27
 
23
28
  # file
24
29
  get "#{Vitreous::Share::LocalStructure.base_uri}/*" do |file|
@@ -27,10 +32,8 @@ module Vitreous
27
32
 
28
33
  # element
29
34
  get '/*' do |resource|
30
- structure = Vitreous::Share::LocalStructure.new( "/#{VITREOUS_FOLDER}/website" )
31
- indexer = Vitreous::Share::Indexer.new( structure.generate )
32
- index = Vitreous::Share::Element.new( indexer.generate[0] )
33
- element = Vitreous::Share::IndexSearcher.search( index, "/#{resource}" )
35
+ index = Vitreous::Share::Element.new( create_index )
36
+ element = Vitreous::Share::IndexSearcher.search( index, "/#{resource}" )
34
37
 
35
38
  raise Sinatra::NotFound if element.nil?
36
39
 
@@ -44,6 +47,13 @@ module Vitreous
44
47
  }
45
48
  )
46
49
  end
50
+
51
+ def create_index
52
+ structure = Vitreous::Share::LocalStructure.new( "/#{VITREOUS_FOLDER}/website" )
53
+ indexer = Vitreous::Share::Indexer.new( structure.generate )
54
+
55
+ indexer.generate[0]
56
+ end
47
57
  end
48
58
  end
49
59
  end
@@ -1,5 +1,5 @@
1
1
  module Vitreous
2
2
  module Standalone
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'sinatra/base'
3
3
  require 'mustache'
4
4
  require 'yaml'
5
+ require 'json'
5
6
  require 'vitreous_share'
6
7
  require File.expand_path "#{File.dirname(__FILE__)}/vitreous/standalone/app.rb"
7
8
  require File.expand_path "#{File.dirname(__FILE__)}/vitreous/standalone/version.rb"
@@ -1,4 +1,4 @@
1
- ENV['VITREOUS_FOLDER'] = "#{File.dirname(__FILE__)}/fixtures/vitreous_folder"
1
+ ENV['VITREOUS_FOLDER'] = File.expand_path "#{File.dirname(__FILE__)}/fixtures/vitreous_folder"
2
2
 
3
3
  require File.expand_path "#{File.dirname(__FILE__)}/../lib/vitreous_standalone.rb"
4
4
  require 'rack/test'
@@ -46,5 +46,11 @@ class VitreousStandaloneTest < Test::Unit::TestCase
46
46
  assert_equal 750, last_response.content_length
47
47
  end
48
48
 
49
+ def test_structure
50
+ get '/structure'
51
+ assert_equal 'application/json', last_response.content_type
52
+ assert_equal 816, last_response.content_length
53
+ end
54
+
49
55
 
50
56
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 7
9
- version: 0.0.7
8
+ - 9
9
+ version: 0.0.9
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-07-29 00:00:00 +02:00
17
+ date: 2011-08-07 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency