rack-app 2.1.0 → 2.2.0

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: fcb9bbf91b7776d8c02a6c59f386ddb5893e68e9
4
- data.tar.gz: a28f17db847b1242e62407da66beebe838ff7543
3
+ metadata.gz: c3304681bebb6b2cf1f17d467c56de917705dcef
4
+ data.tar.gz: b1ce48173f17fad8673d9ade0f62c155e3db230b
5
5
  SHA512:
6
- metadata.gz: 9e291f4fda263c63f7bba524094789f8ae213cebe6c908453ed39fe8534b31a81d517539d15d0a01fa621213a3d33661ead8da980ca4aefb2d80cb69253b805e
7
- data.tar.gz: 2a70f922341c3bda2209d1728d3e8021a5cd514177f03b4fd3454b6dce67e9d002595325d9e432f11b57063efc563cc6654306bda34f25af14ce74071ec95696
6
+ metadata.gz: e3c61fe0d4bd45eb0e430e1eb20ca0d5792994246a5bfe7089d443495f2be79506b3543a7627c50151203728b6e0e1e88b09118bb515cc8de9329edaca9f180e
7
+ data.tar.gz: d05b9441214071df709ada06ae70f42397911db5071a95a7f583a3934131c47bda92fa03c537dd4733fca62038eb469bba82a00d720338c348026c786c0cee13
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.2.0
@@ -34,11 +34,4 @@ module Rack::App::SingletonMethods::HttpMethods
34
34
  end
35
35
  end
36
36
 
37
- def serve_files_from(file_path, options={})
38
- file_server = Rack::App::FileServer.new(Rack::App::Utils.expand_path(file_path))
39
- request_path = Rack::App::Utils.join(@namespaces, options[:to], '**', '*')
40
- router.register_endpoint!('GET', request_path, @last_description, file_server)
41
- @last_description = nil
42
- end
43
-
44
37
  end
@@ -24,4 +24,32 @@ module Rack::App::SingletonMethods::Mounting
24
24
  return nil
25
25
  end
26
26
 
27
+ def mount_directory(directory_path, options={})
28
+
29
+ directory_full_path = Rack::App::Utils.expand_path(directory_path)
30
+
31
+ namespace options[:to] do
32
+
33
+ Dir.glob(File.join(directory_full_path, '**', '*')).each do |file_path|
34
+
35
+ request_path = file_path.sub(/^#{Regexp.escape(directory_full_path)}/, '')
36
+ get(request_path){ serve_file(file_path) }
37
+ options(request_path){ '' }
38
+
39
+ end
40
+
41
+ end
42
+ nil
43
+
44
+ end
45
+
46
+ alias create_endpoints_for_files_in mount_directory
47
+
48
+ def serve_files_from(file_path, options={})
49
+ file_server = Rack::App::FileServer.new(Rack::App::Utils.expand_path(file_path))
50
+ request_path = Rack::App::Utils.join(@namespaces, options[:to], '**', '*')
51
+ router.register_endpoint!('GET', request_path, @last_description, file_server)
52
+ @last_description = nil
53
+ end
54
+
27
55
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.license = 'Apache License 2.0'
23
23
 
24
24
  spec.add_development_dependency "bundler"
25
- spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rake", '10.4.2'
26
26
  spec.add_development_dependency "rspec"
27
27
 
28
28
  spec.add_dependency "rack"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-03-02 00:00:00.000000000 Z
12
+ date: 2016-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -29,16 +29,16 @@ dependencies:
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
34
+ version: 10.4.2
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: 10.4.2
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement