frank 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -137,13 +137,7 @@ Configuration
137
137
  In `settings.yml`, you can change your folder names, and server port & host name.
138
138
  Check the comments there if you need help.
139
139
 
140
- Once you've gotten comfortable with Frank, you will probably no longer want
141
- the example files included whenever you start a new project. You may also have
142
- preferred folder names, and languages that you always want to start
143
- projects with.
144
-
145
- To do this, create a new base project. Then just copy your base project to `~/.frank`.
146
- This folder will then be copied for you whenever you run the `frank` command.
140
+ (NOTE: In order to reduce confusion, Frank no longer checks for a `~/.frank` folder to copy when you run the `frank` command. Instead, the preferred method is just to create a base Frank project wherever you please, and just `cp -r` to the location of your new project, since this is all the `frank` command did anyway)
147
141
 
148
142
  Installation
149
143
  ------------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/frank.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{frank}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["blahed", "nwah"]
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
48
48
  "lib/frank/templates/imager/frank6.jpg",
49
49
  "lib/frank/templates/imager/frank7.jpg",
50
50
  "lib/frank/templates/imager/frank8.jpg",
51
- "lib/frank/templates/imager/frank9.png",
51
+ "lib/frank/templates/imager/frank9.jpg",
52
52
  "lib/frank/tilt.rb",
53
53
  "lib/template/dynamic/css/frank.sass",
54
54
  "lib/template/dynamic/index.haml",
data/lib/frank/base.rb CHANGED
@@ -120,7 +120,7 @@ module Frank
120
120
 
121
121
  TMPL_EXTS[ kind.nil? ? :html : kind.intern ].each do |ext|
122
122
  tmpl = "#{(name||'')}.#{ext}"
123
- default = File.join((name||''), "#{@templates['default']}.#{ext}")
123
+ default = File.join((name||''), "index.#{ext}")
124
124
 
125
125
  if File.exists? File.join(@proj_dir, @dynamic_folder, tmpl)
126
126
  tmpl_ext = [tmpl, ext]
data/lib/frank/rescue.rb CHANGED
@@ -3,7 +3,7 @@ module Frank
3
3
 
4
4
  def render_404
5
5
  template = File.expand_path(File.dirname(__FILE__)) + '/templates/404.haml'
6
- locals = { :request => @env, :dynamic_folder => @dynamic_folder }
6
+ locals = { :request => @env, :dynamic_folder => @dynamic_folder, :static_folder => @static_folder }
7
7
 
8
8
  @response['Content-Type'] = 'text/html'
9
9
  @response.status = 404
data/lib/frank/statik.rb CHANGED
@@ -13,16 +13,26 @@ module Frank
13
13
  # looks for static access, if not found,
14
14
  # passes request to frank
15
15
  def call(env)
16
- path = env['PATH_INFO']
16
+ path = env['PATH_INFO'].dup
17
17
 
18
18
  if path.include? '__frank__'
19
19
  env['PATH_INFO'].gsub!('/__frank__', '')
20
20
  result = @frank_server.call(env)
21
- elsif path.index('/') == 0
21
+ else
22
+ env['PATH_INFO'] << '/' unless path.match(/(\.\w+|\/)$/)
23
+ env['PATH_INFO'] << 'index.html' if path[-1..-1] == '/'
22
24
  result = @static_server.call(env)
23
25
  end
24
- return result if result[0] == 200
25
- @app.call(env)
26
+
27
+ # return if static assets found
28
+ # else reset the path and pass to frank
29
+ if result[0] == 200
30
+ result
31
+ else
32
+ env['PATH_INFO'] = path
33
+ @app.call(env)
34
+ end
35
+
26
36
  end
27
37
 
28
38
  end
@@ -13,4 +13,21 @@
13
13
  #wrapper
14
14
  %img{:src=>'/__frank__/frank-404.png'}
15
15
  %h1= "Not Found&mdash;"
16
- %p= "Try creating <tt>#{request['REQUEST_PATH'][1..-1] if request['REQUEST_PATH']}.haml</tt> in the <tt>#{dynamic_folder}</tt> folder."
16
+ %p
17
+ - if request['REQUEST_PATH']
18
+ - path = request['REQUEST_PATH'][1..-1]
19
+ = "Try creating"
20
+
21
+ - if path.match(/\.css$/)
22
+ = "<tt>#{path.match(/([\w\/]+)\./)[1]}.sass</tt>"
23
+ - elsif path.match(/\.js$/)
24
+ = "<tt>#{path.match(/([\w\/]+)\./)[1]}.coffee</tt>"
25
+ - else
26
+ = "<tt>#{path.gsub(/\/$/, '')}.haml</tt>"
27
+ = "in the <tt>#{dynamic_folder}</tt> folder, or"
28
+
29
+ - if path.match(/\.\w+/)
30
+ = "<tt>#{path}</tt>"
31
+ - else
32
+ = "<tt>#{path.gsub(/\/$/, '')}.html</tt>"
33
+ = "in the <tt>#{static_folder}</tt> folder."
@@ -24,7 +24,6 @@ server:
24
24
  hostname: 0.0.0.0
25
25
  port: 3601
26
26
 
27
-
28
27
  # ----------------------
29
28
  # Static folder:
30
29
  #
@@ -44,9 +43,6 @@ dynamic_folder: dynamic
44
43
  # ----------------------
45
44
  # Templates:
46
45
  #
47
- # 'default' is the optional default template to
48
- # serve from a folder (include the root folder)
49
- #
50
46
  # 'layouts' is a list of layouts to use, where
51
47
  # 'name' is the filename (without extension).
52
48
  # You can also use multiple layouts, and limit
@@ -56,7 +52,6 @@ dynamic_folder: dynamic
56
52
  # - name: normal
57
53
  # not: [blog, ajax]
58
54
  templates:
59
- default: index
60
55
  layouts:
61
56
  - name: layout
62
57
 
@@ -45,9 +45,6 @@ dynamic_folder: dynamic
45
45
  # ----------------------
46
46
  # Templates:
47
47
  #
48
- # 'default' is the optional default template to
49
- # serve from a folder (include the root folder)
50
- #
51
48
  # 'layouts' is a list of layouts to use, where
52
49
  # 'name' is the filename (without extension).
53
50
  # You can also use multiple layouts, and limit
@@ -57,8 +54,6 @@ dynamic_folder: dynamic
57
54
  # - name: normal
58
55
  # not: [blog, ajax]
59
56
  templates:
60
- extension: haml
61
- default: index
62
57
  layouts:
63
58
  - name: layout
64
59
  not: [builder, erb, liquid, markdown, mustache, redcloth]
data/test/test_helpers.rb CHANGED
@@ -43,7 +43,7 @@ class TestBase < Test::Unit::TestCase
43
43
 
44
44
  should 'render image url using imager' do
45
45
  template = @frank.render_path('lorem_test.haml')
46
- reg = /<img src='\/_img\/400x300.jpg\?random' \/>/
46
+ reg = /<img src='\/_img\/400x300.jpg\?random\d{5}' \/>/
47
47
  assert_match reg, template
48
48
  end
49
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - blahed
@@ -105,7 +105,7 @@ files:
105
105
  - lib/frank/templates/imager/frank6.jpg
106
106
  - lib/frank/templates/imager/frank7.jpg
107
107
  - lib/frank/templates/imager/frank8.jpg
108
- - lib/frank/templates/imager/frank9.png
108
+ - lib/frank/templates/imager/frank9.jpg
109
109
  - lib/frank/tilt.rb
110
110
  - lib/template/dynamic/css/frank.sass
111
111
  - lib/template/dynamic/index.haml
Binary file