mcnamara 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/mcnamara.rb +27 -26
  3. metadata +1 -1
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  s.homepage = "http://github.com/kuccello/Mcnamara"
10
10
  s.authors = ['Kristan "Krispy" Uccello']
11
11
  s.files = FileList["[A-Z]*", "{lib,test}/**/*"]
12
- s.version = "0.2"
12
+ s.version = "0.3"
13
13
  end
14
14
  Jeweler::GemcutterTasks.new
15
15
  rescue LoadError
data/lib/mcnamara.rb CHANGED
@@ -65,7 +65,7 @@ module SoldierOfCode
65
65
  possible_overrides << "-#{spy_vs_spy.browser}-#{spy_vs_spy.version.major}.css" if spy_vs_spy.version.major
66
66
 
67
67
  possible_overrides << "-#{spy_vs_spy.browser}.css"
68
-
68
+
69
69
  return possible_overrides
70
70
 
71
71
  end
@@ -73,46 +73,47 @@ module SoldierOfCode
73
73
  def call(env)
74
74
 
75
75
  begin
76
- # establish what browser we are dealing with
77
- # hey! is spy-vs-spy upstream?
78
- spy_vs_spy = env['soldierofcode.spy-vs-spy']
79
- unless spy_vs_spy
80
- http_user_agent = env['HTTP_USER_AGENT']
81
- env['soldierofcode.spy-vs-spy'] = SpyVsSpy.new(http_user_agent)
76
+ # establish what browser we are dealing with
77
+ # hey! is spy-vs-spy upstream?
82
78
  spy_vs_spy = env['soldierofcode.spy-vs-spy']
83
- end
79
+ unless spy_vs_spy
80
+ http_user_agent = env['HTTP_USER_AGENT']
81
+ env['soldierofcode.spy-vs-spy'] = SpyVsSpy.new(http_user_agent)
82
+ spy_vs_spy = env['soldierofcode.spy-vs-spy']
83
+ end
84
84
 
85
- # look for what css we are after
86
- request_path = env['REQUEST_PATH']
87
- if request_path =~ /\.css$/
85
+ # look for what css we are after
86
+ request_path = env['REQUEST_PATH']
87
+ if request_path =~ /\.css$/
88
88
 
89
- # need a base directory to scann...
90
- # TODO -- ripe for a cache
91
- possible_overrides = build_possible_overrides(spy_vs_spy)
89
+ # need a base directory to scann...
90
+ # TODO -- ripe for a cache
91
+ possible_overrides = build_possible_overrides(spy_vs_spy)
92
92
 
93
- Dir["#{@css_dir}/**/*.css"].each do |css_file|
94
- possible_overrides.each do |override|
95
- request_path_sub = request_path[1..-1].downcase.sub(/\.css/, override)
93
+ Dir["#{@css_dir}/**/*.css"].each do |css_file|
94
+ possible_overrides.each do |override|
95
+ request_path_sub = request_path[1..-1].downcase.sub(/\.css/, override)
96
96
 
97
- file_of_intrest = request_path_sub.split("/").last
97
+ file_of_intrest = request_path_sub.split("/").last
98
98
  # puts "#{__FILE__}:#{__LINE__} #{__method__} #{file_of_intrest.downcase} |||| #{css_file.downcase[1..-1]}"
99
99
 
100
- if css_file[1..-1].downcase =~ Regexp.new("#{file_of_intrest.downcase}$")
100
+ if css_file[1..-1].downcase =~ Regexp.new("#{file_of_intrest.downcase}$")
101
101
  # puts "#{__FILE__}:#{__LINE__} #{__method__} I'm IN!!"
102
- # this is the file we want to serve
103
- css = 'Oh oo - I droped the bomb'
104
- File.open(css_file, "r") {|f| css = f.read}
105
- return [200,{"Content-Type"=>"text/css"},css]
102
+ # this is the file we want to serve
103
+ css = 'Oh oo - I droped the bomb'
104
+ File.open(css_file, "r") {|f| css = f.read}
105
+ return [200, {"Content-Type"=>"text/css"}, css]
106
+ end
106
107
  end
107
108
  end
109
+
108
110
  end
109
- else
110
- @app.call(env)
111
- end
112
111
  rescue => e
113
112
  puts "#{__FILE__}:#{__LINE__} #{__method__} #{e} - #{e.backtrace}"
114
113
  end
115
114
 
115
+ @app.call(env)
116
+
116
117
  end
117
118
  end
118
119
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcnamara
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: "0.3"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristan "Krispy" Uccello