pakyow-core 0.7.2 → 0.8rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/pakyow-core/bin/pakyow +7 -6
  2. data/pakyow-core/lib/commands/USAGE +2 -1
  3. data/pakyow-core/lib/commands/console.rb +1 -1
  4. data/pakyow-core/lib/commands/server.rb +1 -1
  5. data/pakyow-core/lib/core/application.rb +129 -404
  6. data/pakyow-core/lib/core/base.rb +16 -4
  7. data/pakyow-core/lib/core/configuration/app.rb +6 -2
  8. data/pakyow-core/lib/core/configuration/server.rb +6 -1
  9. data/pakyow-core/lib/core/fn_context.rb +5 -0
  10. data/pakyow-core/lib/core/helpers.rb +16 -0
  11. data/pakyow-core/lib/core/loader.rb +1 -2
  12. data/pakyow-core/lib/core/log.rb +13 -9
  13. data/pakyow-core/lib/core/middleware/logger.rb +37 -0
  14. data/pakyow-core/lib/core/middleware/not_found.rb +40 -0
  15. data/pakyow-core/lib/core/middleware/presenter.rb +25 -0
  16. data/pakyow-core/lib/core/middleware/reloader.rb +14 -0
  17. data/pakyow-core/lib/core/middleware/router.rb +33 -0
  18. data/pakyow-core/lib/core/middleware/setup.rb +15 -0
  19. data/pakyow-core/lib/core/middleware/static.rb +27 -0
  20. data/pakyow-core/lib/core/presenter_base.rb +4 -0
  21. data/pakyow-core/lib/core/request.rb +43 -15
  22. data/pakyow-core/lib/core/response.rb +6 -0
  23. data/pakyow-core/lib/core/route_lookup.rb +37 -0
  24. data/pakyow-core/lib/core/route_set.rb +260 -0
  25. data/pakyow-core/lib/core/route_template.rb +77 -0
  26. data/pakyow-core/lib/core/route_template_defaults.rb +29 -0
  27. data/pakyow-core/lib/core/router.rb +156 -0
  28. data/pakyow-core/lib/generators/pakyow/app/app_generator.rb +12 -2
  29. data/pakyow-core/lib/generators/pakyow/app/templates/app.rb +12 -0
  30. data/pakyow-core/lib/generators/pakyow/app/templates/config.ru +1 -1
  31. data/pakyow-core/lib/generators/pakyow/app/templates/rakefile +1 -1
  32. data/pakyow-core/lib/generators/pakyow/app/templates/{app/views → views}/main.html +0 -0
  33. data/pakyow-core/lib/generators/pakyow/app/templates/{app/views → views}/pakyow.html +1 -1
  34. data/pakyow-core/lib/utils/string.rb +11 -10
  35. metadata +61 -71
  36. data/pakyow-core/lib/core/logger.rb +0 -33
  37. data/pakyow-core/lib/core/reloader.rb +0 -12
  38. data/pakyow-core/lib/core/route_store.rb +0 -220
  39. data/pakyow-core/lib/core/static.rb +0 -25
  40. data/pakyow-core/lib/generators/pakyow/app/templates/app/lib/application_controller.rb +0 -6
  41. data/pakyow-core/lib/generators/pakyow/app/templates/config/application.rb +0 -18
  42. data/pakyow-core/lib/generators/pakyow/app/templates/logs/requests.log +0 -0
@@ -2,16 +2,17 @@
2
2
 
3
3
  CORE_PATH = File.expand_path('../../lib', __FILE__)
4
4
 
5
- if ARGV.first == 'new'
5
+ case ARGV.first
6
+ when 'new'
6
7
  ARGV.shift
7
8
  require 'generators/pakyow/app/app_generator'
8
9
  Pakyow::Generators::AppGenerator.start
9
- elsif ARGV.first == 'server'
10
+ when 'server', 's'
10
11
  ARGV.shift
11
- require 'commands/server'
12
- elsif ARGV.first == 'console'
12
+ require File.join(CORE_PATH, 'commands/server')
13
+ when 'console', 'c'
13
14
  ARGV.shift
14
- require 'commands/console'
15
- elsif ARGV.first == '--help' || ARGV.first == '-h' || ARGV.empty?
15
+ require File.join(CORE_PATH, 'commands/console')
16
+ when '--help', '-h', nil
16
17
  puts File.open(File.join(CORE_PATH, 'commands/USAGE')).read
17
18
  end
@@ -1,8 +1,9 @@
1
1
  Usage:
2
2
  pakyow command
3
3
 
4
- There are two commands:
4
+ There are three commands:
5
5
  new Create a new Pakyow application
6
6
  server Start the application server
7
+ console Start the application console
7
8
 
8
9
  Run a command with -h for more information.
@@ -3,7 +3,7 @@ if ARGV.first == '--help' || ARGV.first == '-h'
3
3
  else
4
4
  $:.unshift(Dir.pwd)
5
5
 
6
- require File.join('config', 'application')
6
+ require 'app'
7
7
  PakyowApplication::Application.stage(ARGV.first)
8
8
 
9
9
  def reload
@@ -3,6 +3,6 @@ if ARGV.first == '--help' || ARGV.first == '-h'
3
3
  else
4
4
  $:.unshift(Dir.pwd)
5
5
 
6
- require File.join('config', 'application')
6
+ require 'app'
7
7
  PakyowApplication::Application.run(ARGV.first)
8
8
  end