rack-git-up 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/rack-git-up.rb +7 -4
  3. data/rack-git-up.gemspec +52 -0
  4. metadata +13 -5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -3,7 +3,7 @@ require 'rack/file'
3
3
 
4
4
  module Rack
5
5
  class GitUp
6
-
6
+
7
7
  def initialize(app, options={})
8
8
  @app = app
9
9
  @repo = Grit::Repo.new(options[:repo])
@@ -11,22 +11,25 @@ module Rack
11
11
  @root = options[:root] || Dir.pwd
12
12
  @file_server = Rack::File.new(@root)
13
13
  end
14
-
14
+
15
15
  def call(env)
16
16
  path = env["PATH_INFO"]
17
17
  can_serve = @urls.any? { |url| path.index(url) == 0 }
18
-
18
+
19
19
  if can_serve
20
20
  pull_from_git path
21
21
  result = @file_server.call(env)
22
22
  return result if result[0] == 200
23
23
  end
24
-
24
+
25
25
  @app.call(env)
26
26
  end
27
27
 
28
28
  def pull_from_git path
29
29
  blob = (@repo.tree/path[1..-1]) #remove leading slash
30
+
31
+ return unless blob
32
+
30
33
  f = ::File.new(::File.join(@root, path), "w")
31
34
  f.syswrite(blob.data)
32
35
  f.close
@@ -0,0 +1,52 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rack-git-up}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["rubyyot"]
12
+ s.date = %q{2010-03-22}
13
+ s.description = %q{Rack app to pull blobs from git and return them in the response, based on rack static}
14
+ s.email = %q{jamal.hansen@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ ".gitmodules",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/rack-git-up.rb",
28
+ "rack-git-up.gemspec",
29
+ "test/helper.rb",
30
+ "test/test_rack-git-up.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/rubyyot/rack-git-up}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.6}
36
+ s.summary = %q{pulls blobs from git if they are found}
37
+ s.test_files = [
38
+ "test/test_rack-git-up.rb",
39
+ "test/helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ else
48
+ end
49
+ else
50
+ end
51
+ end
52
+
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-git-up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - rubyyot
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-09 00:00:00 -06:00
17
+ date: 2010-03-22 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -31,6 +36,7 @@ files:
31
36
  - Rakefile
32
37
  - VERSION
33
38
  - lib/rack-git-up.rb
39
+ - rack-git-up.gemspec
34
40
  - test/helper.rb
35
41
  - test/test_rack-git-up.rb
36
42
  has_rdoc: true
@@ -46,18 +52,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
52
  requirements:
47
53
  - - ">="
48
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
49
57
  version: "0"
50
- version:
51
58
  required_rubygems_version: !ruby/object:Gem::Requirement
52
59
  requirements:
53
60
  - - ">="
54
61
  - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
55
64
  version: "0"
56
- version:
57
65
  requirements: []
58
66
 
59
67
  rubyforge_project:
60
- rubygems_version: 1.3.5
68
+ rubygems_version: 1.3.6
61
69
  signing_key:
62
70
  specification_version: 3
63
71
  summary: pulls blobs from git if they are found