otto 0.2.0.001 → 0.2.1.003

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/CHANGES.txt +4 -0
  2. data/Rakefile +1 -19
  3. data/VERSION.yml +2 -2
  4. data/lib/otto.rb +20 -3
  5. data/otto.gemspec +20 -21
  6. metadata +7 -9
data/CHANGES.txt CHANGED
@@ -1,5 +1,9 @@
1
1
  OTTO, CHANGES
2
2
 
3
+ #### 0.2.1 (2011-07-07) ###############################
4
+
5
+ * ADDED: Otto#add_static_path
6
+
3
7
  #### 0.2.0 (2011-07-06) ###############################
4
8
 
5
9
  Initial public release
data/Rakefile CHANGED
@@ -26,7 +26,7 @@ begin
26
26
  gem.homepage = "http://github.com/delano/otto"
27
27
  gem.authors = ["Delano Mandelbaum"]
28
28
  gem.add_dependency('rack', '>= 1.2.1')
29
- gem.add_dependency('addressable', '= 2.2.4')
29
+ gem.add_dependency('addressable', '>= 2.2.6')
30
30
  end
31
31
  Jeweler::GemcutterTasks.new
32
32
  rescue LoadError
@@ -45,21 +45,3 @@ Rake::RDocTask.new do |rdoc|
45
45
  end
46
46
 
47
47
 
48
- # Rubyforge Release / Publish Tasks ==================================
49
-
50
- #about 'Publish website to rubyforge'
51
- task 'publish:rdoc' => 'doc/index.html' do
52
- sh "scp -rp doc/* rubyforge.org:/var/www/gforge-projects/#{name}/"
53
- end
54
-
55
- #about 'Public release to rubyforge'
56
- task 'publish:gem' => [:package] do |t|
57
- sh <<-end
58
- rubyforge add_release -o Any -a CHANGES.txt -f -n README.md #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.gem &&
59
- rubyforge add_file -o Any -a CHANGES.txt -f -n README.md #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.tgz
60
- end
61
- end
62
-
63
-
64
-
65
-
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  :MAJOR: 0
2
2
  :MINOR: 2
3
- :PATCH: 0
4
- :BUILD: '001'
3
+ :PATCH: 1
4
+ :BUILD: '003'
data/lib/otto.rb CHANGED
@@ -61,13 +61,30 @@ class Otto
61
61
  }
62
62
  self
63
63
  end
64
- def safe_file?(path)
64
+
65
+ def safe_file? path
65
66
  globstr = File.join(option[:public], '*')
66
67
  pathstr = File.join(option[:public], path)
67
- File.fnmatch?(globstr, pathstr) && File.owned?(pathstr) && !File.directory?(pathstr)
68
+ File.fnmatch?(globstr, pathstr) && (File.owned?(pathstr) || File.grpowned?(pathstr)) && File.readable?(pathstr) && !File.directory?(pathstr)
69
+ end
70
+
71
+ def safe_dir? path
72
+ (File.owned?(path) || File.grpowned?(path)) && File.directory?(path)
68
73
  end
74
+
75
+ def add_static_path path
76
+ if safe_file?(path)
77
+ base_path = File.split(path).first
78
+ # Files in the root directory can refer to themselves
79
+ base_path = path if base_path == '/'
80
+ static_path = File.join(option[:public], base_path)
81
+ STDERR.puts "new static route: #{base_path} (#{path})"
82
+ routes_static[:GET][base_path] = base_path
83
+ end
84
+ end
85
+
69
86
  def call env
70
- if option[:public] && File.owned?(option[:public])
87
+ if option[:public] && safe_dir?(option[:public])
71
88
  @static_route ||= Rack::File.new(option[:public])
72
89
  end
73
90
  path_info = Rack::Utils.unescape(env['PATH_INFO'])
data/otto.gemspec CHANGED
@@ -1,50 +1,49 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{otto}
8
- s.version = "0.2.0.001"
7
+ s.name = "otto"
8
+ s.version = "0.2.1.003"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Delano Mandelbaum"]
12
- s.date = %q{2011-07-07}
13
- s.description = %q{Auto-define your rack-apps in plaintext.}
14
- s.email = %q{delano@solutious.com}
12
+ s.date = "2011-10-19"
13
+ s.description = "Auto-define your rack-apps in plaintext."
14
+ s.email = "delano@solutious.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.md"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  "CHANGES.txt",
21
- "LICENSE.txt",
22
- "README.md",
23
- "Rakefile",
24
- "VERSION.yml",
25
- "lib/otto.rb",
26
- "otto.gemspec"
21
+ "LICENSE.txt",
22
+ "README.md",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "lib/otto.rb",
26
+ "otto.gemspec"
27
27
  ]
28
- s.homepage = %q{http://github.com/delano/otto}
29
- s.rdoc_options = ["--charset=UTF-8"]
28
+ s.homepage = "http://github.com/delano/otto"
30
29
  s.require_paths = ["lib"]
31
- s.rubyforge_project = %q{otto}
32
- s.rubygems_version = %q{1.5.2}
33
- s.summary = %q{Auto-define your rack-apps in plaintext.}
30
+ s.rubyforge_project = "otto"
31
+ s.rubygems_version = "1.8.10"
32
+ s.summary = "Auto-define your rack-apps in plaintext."
34
33
 
35
34
  if s.respond_to? :specification_version then
36
35
  s.specification_version = 3
37
36
 
38
37
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
39
38
  s.add_runtime_dependency(%q<rack>, [">= 1.2.1"])
40
- s.add_runtime_dependency(%q<addressable>, ["= 2.2.4"])
39
+ s.add_runtime_dependency(%q<addressable>, [">= 2.2.6"])
41
40
  else
42
41
  s.add_dependency(%q<rack>, [">= 1.2.1"])
43
- s.add_dependency(%q<addressable>, ["= 2.2.4"])
42
+ s.add_dependency(%q<addressable>, [">= 2.2.6"])
44
43
  end
45
44
  else
46
45
  s.add_dependency(%q<rack>, [">= 1.2.1"])
47
- s.add_dependency(%q<addressable>, ["= 2.2.4"])
46
+ s.add_dependency(%q<addressable>, [">= 2.2.6"])
48
47
  end
49
48
  end
50
49
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: otto
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0.001
5
+ version: 0.2.1.003
6
6
  platform: ruby
7
7
  authors:
8
8
  - Delano Mandelbaum
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-07 00:00:00 -04:00
14
- default_executable:
13
+ date: 2011-10-19 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rack
@@ -30,9 +29,9 @@ dependencies:
30
29
  requirement: &id002 !ruby/object:Gem::Requirement
31
30
  none: false
32
31
  requirements:
33
- - - "="
32
+ - - ">="
34
33
  - !ruby/object:Gem::Version
35
- version: 2.2.4
34
+ version: 2.2.6
36
35
  type: :runtime
37
36
  version_requirements: *id002
38
37
  description: Auto-define your rack-apps in plaintext.
@@ -52,13 +51,12 @@ files:
52
51
  - VERSION.yml
53
52
  - lib/otto.rb
54
53
  - otto.gemspec
55
- has_rdoc: true
56
54
  homepage: http://github.com/delano/otto
57
55
  licenses: []
58
56
 
59
57
  post_install_message:
60
- rdoc_options:
61
- - --charset=UTF-8
58
+ rdoc_options: []
59
+
62
60
  require_paths:
63
61
  - lib
64
62
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -76,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
74
  requirements: []
77
75
 
78
76
  rubyforge_project: otto
79
- rubygems_version: 1.5.2
77
+ rubygems_version: 1.8.10
80
78
  signing_key:
81
79
  specification_version: 3
82
80
  summary: Auto-define your rack-apps in plaintext.