pakyow-core 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/pakyow-core/CHANGES CHANGED
@@ -1,3 +1,23 @@
1
+ = 0.7.1 / 2012-01-08
2
+
3
+ * Changed loader to only load ruby files
4
+ * Moved session from app to request
5
+ * Replaced autoload with require
6
+ * Fixed generated rackup to use builder
7
+ * Fixed generated rakefile so it runs in a specific environment
8
+ * Fixed issue running with ignore_routes turned on
9
+
10
+ = 0.7.0 / 2011-11-19
11
+
12
+ * Added middleware for logging, static, and reloading
13
+ * Added invoke_route! and invoke_handler! methods
14
+ * Added before, after, and around hooks to routes
15
+ * Added pakyow console
16
+ * Changed methods that modify request/response life cycle to bang methods
17
+ * Fixed regex route error (was removing route vars)
18
+ * App file is no longer loaded twice upon initialization
19
+ * Fix cookie creation when cookie is a non-nil value but not a String
20
+
1
21
  = 0.6.3 / 2011-09-13
2
22
 
3
23
  * Fixes several load path issues
@@ -399,6 +399,10 @@ module Pakyow
399
399
  def reload
400
400
  load_app
401
401
  end
402
+
403
+ def session
404
+ self.request.env['rack.session'] || {}
405
+ end
402
406
 
403
407
  protected
404
408
 
@@ -408,7 +412,7 @@ module Pakyow
408
412
  controller_block, packet = @route_store.get_block(route, method)
409
413
 
410
414
  self.request.params.merge!(HashUtils.strhash(packet[:vars]))
411
- self.request.route_spec = packet[:data][:route_spec] if packet[:data]
415
+ self.request.route_spec = packet[:data][:route_spec] if packet[:data] unless Pakyow::Configuration::App.ignore_routes
412
416
  self.request.restful = packet[:data][:restful] if packet[:data]
413
417
 
414
418
  controller_block
@@ -1,20 +1,21 @@
1
- module Pakyow
2
- autoload :Configuration, 'core/configuration/base'
3
- autoload :Helpers, 'core/helpers'
4
- autoload :GeneralHelpers, 'core/helpers'
5
- autoload :Log, 'core/log'
6
- autoload :Request, 'core/request'
7
- autoload :Loader, 'core/loader'
8
- autoload :Application, 'core/application'
9
- autoload :RouteStore, 'core/route_store'
10
- autoload :Logger, 'core/logger'
11
- autoload :Static, 'core/static'
12
- autoload :Reloader, 'core/reloader'
1
+ require 'core/configuration/base'
2
+ require 'core/helpers'
3
+ require 'core/log'
4
+ require 'core/request'
5
+ require 'core/loader'
6
+ require 'core/application'
7
+ require 'core/route_store'
8
+ require 'core/logger'
9
+ require 'core/static'
10
+ require 'core/reloader'
11
+ require 'core/cache'
12
+ require 'core/presenter_base'
13
13
 
14
- # utils
15
- autoload :StringUtils, 'utils/string'
16
- autoload :HashUtils, 'utils/hash'
17
- autoload :DirUtils, 'utils/dir'
14
+ # utils
15
+ require 'utils/string'
16
+ require 'utils/hash'
17
+ require 'utils/dir'
18
18
 
19
+ module Pakyow
19
20
  attr_accessor :app
20
21
  end
@@ -0,0 +1,25 @@
1
+ module Pakyow
2
+ class Cache
3
+ def initialize
4
+ @store = {}
5
+ end
6
+
7
+ def put(key, v)
8
+ @store[key] = v
9
+ end
10
+
11
+ def get(key, &block)
12
+ v = @store[key]
13
+ if v == nil && block_given?
14
+ v = block.call(key)
15
+ @store[key] = v
16
+ end
17
+ v
18
+ end
19
+
20
+ def invalidate(key)
21
+ put(key, nil)
22
+ end
23
+
24
+ end
25
+ end
@@ -16,9 +16,7 @@ module Pakyow
16
16
  if File.exists?(dir)
17
17
  DirUtils.walk_dir(dir) do |path|
18
18
  next if FileTest.directory?(path)
19
-
20
- split = path.split('/')
21
- next if split[split.length-1].start_with?('.')
19
+ next if path.split('.')[-1] != 'rb'
22
20
 
23
21
  if Configuration::Base.app.auto_reload
24
22
  if !@times[path] || (@times[path] && File.mtime(path) - @times[path] > 0)
@@ -21,10 +21,6 @@ module Pakyow
21
21
  Pakyow.app.response["Content-Type"] = Rack::Mime.mime_type(".#{@format}")
22
22
  end
23
23
 
24
- def session
25
- env['rack.session'] || {}
26
- end
27
-
28
24
  def cookies
29
25
  @cookies ||= HashUtils.strhash(super)
30
26
  end
@@ -1,4 +1,3 @@
1
- env = ENV['RACK_ENV'] || 'production'
2
-
3
1
  require File.expand_path('../config/application', __FILE__)
4
- run PakyowApplication::Application.stage(env)
2
+ PakyowApplication::Application.builder.run(PakyowApplication::Application.stage(ENV['RACK_ENV']))
3
+ run PakyowApplication::Application.builder.to_app
@@ -1,5 +1,2 @@
1
- env = ARGV[1] || 'development'
2
- env = env.split('=')[1] || env
3
-
4
1
  require File.expand_path('../config/application', __FILE__)
5
- PakyowApplication::Application.stage(env.to_sym)
2
+ PakyowApplication::Application.stage(ENV['ENV'])
@@ -9,6 +9,5 @@ require 'logger'
9
9
  require 'cgi'
10
10
 
11
11
  # Base
12
- autoload :Pakyow, 'core/base'
13
-
12
+ require 'core/base'
14
13
  include Pakyow
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakyow-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: pakyow-core/bin
12
12
  cert_chain: []
13
- date: 2011-11-19 00:00:00.000000000Z
13
+ date: 2012-01-08 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
17
- requirement: &70115565134460 !ruby/object:Gem::Requirement
17
+ requirement: &70284532262360 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '1.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70115565134460
25
+ version_requirements: *70284532262360
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: shoulda
28
- requirement: &70115565133760 !ruby/object:Gem::Requirement
28
+ requirement: &70284532261660 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '2.11'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70115565133760
36
+ version_requirements: *70284532261660
37
37
  description: pakyow-core
38
38
  email: bryan@metabahn.com
39
39
  executables:
@@ -52,6 +52,7 @@ files:
52
52
  - pakyow-core/lib/commands/USAGE-SERVER
53
53
  - pakyow-core/lib/core/application.rb
54
54
  - pakyow-core/lib/core/base.rb
55
+ - pakyow-core/lib/core/cache.rb
55
56
  - pakyow-core/lib/core/configuration/app.rb
56
57
  - pakyow-core/lib/core/configuration/base.rb
57
58
  - pakyow-core/lib/core/configuration/server.rb