RubyApp 0.0.91 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. data/.gitignore +0 -1
  2. data/.rvmrc +56 -1
  3. data/Gemfile.lock +22 -22
  4. data/bin/console.rb +9 -1
  5. data/bin/ruby_app +2 -24
  6. data/features/default.feature +1 -0
  7. data/features/elements/input.feature +2 -0
  8. data/features/elements/page.feature +0 -9
  9. data/features/step_definitions/default_macros.rb +1 -4
  10. data/features/step_definitions/default_steps.rb +1 -1
  11. data/lib/ruby_app.rb +8 -1
  12. data/lib/ruby_app/application.rb +5 -67
  13. data/lib/ruby_app/configuration.rb +2 -3
  14. data/lib/ruby_app/configuration.ru +32 -0
  15. data/lib/ruby_app/configuration.yml +28 -0
  16. data/lib/ruby_app/element.rb +12 -6
  17. data/lib/ruby_app/elements.rb +50 -0
  18. data/lib/ruby_app/elements/base/base_mail.rb +2 -2
  19. data/lib/ruby_app/elements/base/base_page.html.haml +1 -1
  20. data/lib/ruby_app/elements/base/base_page.js.haml +3 -3
  21. data/lib/ruby_app/elements/base/base_page.rb +2 -2
  22. data/lib/ruby_app/elements/dialogs/base/base_ok_dialog.rb +0 -1
  23. data/lib/ruby_app/elements/dialogs/blank_dialog.rb +1 -1
  24. data/lib/ruby_app/elements/dialogs/exception_dialog.rb +1 -2
  25. data/lib/ruby_app/elements/navigation/back_button.rb +1 -1
  26. data/lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb +1 -0
  27. data/lib/ruby_app/elements/navigation/page_link.rb +1 -0
  28. data/lib/ruby_app/elements/pages/authentication/open_id/ax_authentication_page.rb +1 -1
  29. data/lib/ruby_app/elements/pages/authentication/open_id/base/base_authentication_page.rb +1 -3
  30. data/lib/ruby_app/elements/pages/authentication/open_id/email_authentication_page.rb +1 -1
  31. data/lib/ruby_app/elements/pages/authentication/open_id/sreg_authentication_page.rb +1 -1
  32. data/lib/ruby_app/elements/pages/base/base_blank_page.rb +0 -1
  33. data/lib/ruby_app/elements/pages/default_page.rb +2 -1
  34. data/lib/ruby_app/elements/pages/quit_page.html.haml +0 -3
  35. data/lib/ruby_app/elements/pages/quit_page.rb +0 -2
  36. data/lib/ruby_app/elements/pages/settings_page.rb +2 -1
  37. data/lib/ruby_app/elements/pages/test_pages.rb +9 -0
  38. data/lib/ruby_app/elements/pages/test_pages/button_test_page.rb +3 -5
  39. data/lib/ruby_app/elements/pages/test_pages/default_test_page.rb +10 -15
  40. data/lib/ruby_app/elements/pages/test_pages/dialog_test_page.rb +2 -8
  41. data/lib/ruby_app/elements/pages/test_pages/input_test_page.rb +2 -9
  42. data/lib/ruby_app/elements/pages/test_pages/link_test_page.rb +3 -5
  43. data/lib/ruby_app/elements/pages/test_pages/linked_test_page.rb +1 -2
  44. data/lib/ruby_app/elements/pages/test_pages/list_test_page.rb +4 -8
  45. data/lib/ruby_app/elements/pages/test_pages/markdown_test_page.rb +3 -4
  46. data/lib/ruby_app/elements/pages/test_pages/test_page.rb +3 -8
  47. data/lib/ruby_app/exceptions.rb +2 -0
  48. data/lib/ruby_app/exceptions/base/base_exception.rb +1 -1
  49. data/lib/ruby_app/language.rb +9 -15
  50. data/lib/ruby_app/log.rb +32 -28
  51. data/lib/ruby_app/mixins.rb +7 -0
  52. data/lib/ruby_app/mixins/configuration_mixin.rb +1 -1
  53. data/lib/ruby_app/mixins/delegate_mixin.rb +1 -1
  54. data/lib/ruby_app/mixins/hash_mixin.rb +1 -1
  55. data/lib/ruby_app/mixins/render_mixin.rb +37 -39
  56. data/lib/ruby_app/mixins/route_mixin.rb +1 -5
  57. data/lib/ruby_app/mixins/template_mixin.rb +4 -12
  58. data/lib/ruby_app/mixins/translate_mixin.rb +2 -2
  59. data/lib/ruby_app/rack.rb +8 -0
  60. data/lib/ruby_app/rack/application.rb +9 -5
  61. data/lib/ruby_app/rack/duration.rb +22 -0
  62. data/lib/ruby_app/rack/language.rb +26 -0
  63. data/lib/ruby_app/rack/memory.rb +22 -0
  64. data/lib/ruby_app/rack/request.rb +27 -0
  65. data/lib/ruby_app/rack/response.rb +26 -0
  66. data/lib/ruby_app/rack/route.rb +24 -87
  67. data/lib/ruby_app/rack/session.rb +31 -0
  68. data/lib/ruby_app/request.rb +4 -55
  69. data/lib/ruby_app/response.rb +58 -0
  70. data/lib/ruby_app/session.rb +102 -35
  71. data/lib/ruby_app/templates/application/Rakefile +1 -1
  72. data/lib/ruby_app/templates/application/configuration.ru +41 -0
  73. data/lib/ruby_app/templates/application/configuration.yml +16 -0
  74. data/lib/ruby_app/templates/application/console.rb +15 -10
  75. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_.rb +3 -0
  76. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/application.rb +3 -3
  77. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/elements/pages/default_page.rb +1 -1
  78. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/session.rb +3 -3
  79. data/lib/ruby_app/templates/application/spec/application_spec.rb +17 -0
  80. data/lib/ruby_app/templates/application/spec/request_spec.rb +18 -0
  81. data/lib/ruby_app/templates/application/spec/support/shared.rb +34 -9
  82. data/lib/ruby_app/themes/mobile.rb +1 -17
  83. data/lib/ruby_app/themes/mobile/base/base_page.html.haml +1 -1
  84. data/lib/ruby_app/translations/en.yml +133 -144
  85. data/lib/ruby_app/version.rb +1 -1
  86. data/rakefile +1 -16
  87. data/spec/application_spec.rb +5 -13
  88. data/spec/elements/base_element.html.haml +5 -0
  89. data/spec/elements/container_element.html.haml +6 -0
  90. data/spec/elements/derived_element.html.haml +5 -0
  91. data/spec/elements/element_spec.rb +101 -0
  92. data/spec/request_spec.rb +6 -13
  93. data/spec/support/shared.rb +14 -6
  94. metadata +95 -125
  95. data/features/elements/pages/quit_page.feature +0 -8
  96. data/lib/ruby_app/config.ru +0 -25
  97. data/lib/ruby_app/config.yml +0 -16
  98. data/lib/ruby_app/elements/pages/test_pages/select_test_page.rb +0 -44
  99. data/lib/ruby_app/templates/application/config.ru +0 -40
  100. data/lib/ruby_app/templates/application/config.yml +0 -1
  101. data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.css.haml +0 -3
  102. data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.html.haml +0 -4
  103. data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.js.haml +0 -3
  104. data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.rb +0 -14
  105. data/spec/configuration_spec.rb +0 -25
  106. data/spec/element_spec.rb +0 -72
  107. data/spec/elements/navigation/breadcrumbs_spec.rb +0 -62
  108. data/spec/elements/page_spec.rb +0 -20
  109. data/spec/language_spec.rb +0 -25
  110. data/spec/log_spec.rb +0 -25
  111. data/spec/mixins/configuration_mixin_spec.rb +0 -24
  112. data/spec/mixins/delegate_mixin_spec.rb +0 -28
  113. data/spec/mixins/hash_mixin_spec.rb +0 -39
  114. data/spec/mixins/render_mixin_spec.rb +0 -127
  115. data/spec/mixins/route_mixin_spec.rb +0 -60
  116. data/spec/mixins/template_mixin_spec.rb +0 -78
  117. data/spec/mixins/test_a.css.haml +0 -4
  118. data/spec/mixins/test_a.html.haml +0 -2
  119. data/spec/mixins/test_a.js.haml +0 -4
  120. data/spec/mixins/test_b.css.haml +0 -4
  121. data/spec/mixins/test_b.html.haml +0 -3
  122. data/spec/mixins/test_b.js.haml +0 -4
  123. data/spec/mixins/test_c.css.haml +0 -4
  124. data/spec/mixins/test_c.html.haml +0 -2
  125. data/spec/mixins/test_c.js.haml +0 -4
  126. data/spec/mixins/translate_mixin_spec.rb +0 -25
  127. data/spec/session_spec.rb +0 -39
@@ -1,8 +0,0 @@
1
- Feature: Quit page
2
-
3
- Scenario: View the quit page
4
- Given I go to the test pages
5
- When I click "Settings"
6
- Then I should see "Quit the session"
7
- When I am viewing "/quit"
8
- Then I should see "Click here to go to the test pages"
@@ -1,25 +0,0 @@
1
- #\ --warn --port 8008 --pid ./rack.pid --debug true
2
- require 'rubygems'
3
- require 'bundler/setup'
4
-
5
- require 'rack'
6
-
7
- require 'ruby_app/rack/application'
8
- require 'ruby_app/rack/route'
9
- require 'ruby_app/version'
10
-
11
- use Rack::ShowExceptions
12
- use Rack::Session::Pool, :expire_after => 15 * 60 # 15 minutes
13
- use Rack::Reloader
14
- use Rack::ContentLength
15
-
16
- use RubyApp::Rack::Application
17
- run RubyApp::Rack::Route.new
18
-
19
- map '/favicon.ico' do
20
- run Rack::File.new(File.join(RubyApp::ROOT, %w[resources favicon.ico]))
21
- end
22
-
23
- map '/ruby_app/resources' do
24
- run Rack::File.new(File.join(RubyApp::ROOT, %w[resources]))
25
- end
@@ -1,16 +0,0 @@
1
- default:
2
- ruby_app:
3
- elements:
4
- pages:
5
- authentication:
6
- open_id:
7
- google_authentication_page:
8
- identifier: https://www.google.com/accounts/o8/id
9
- attributes:
10
- email: http://schema.openid.net/contact/email
11
- my_open_id_authentication_page:
12
- identifier: http://myopenid.com
13
- yahoo_authentication_page:
14
- identifier: https://www.yahoo.com
15
- attributes:
16
- email: http://axschema.org/contact/email
@@ -1,44 +0,0 @@
1
- module RubyApp
2
-
3
- module Elements
4
-
5
- module Pages
6
-
7
- module TestPages
8
- require 'ruby_app/elements/dialogs/message_dialog'
9
- require 'ruby_app/elements/markdown'
10
- require 'ruby_app/elements/pages/blank_page'
11
- require 'ruby_app/elements/lists/select'
12
- require 'ruby_app/session'
13
-
14
- class SelectTestPage < RubyApp::Elements::Pages::BlankPage
15
-
16
- template_path(:all, File.dirname(__FILE__))
17
-
18
- def initialize
19
- super
20
-
21
- @markdown = RubyApp::Elements::Markdown.new
22
-
23
- @select = RubyApp::Elements::Select.new
24
- @select.items += [ 'Item 01',
25
- 'Item 02',
26
- 'Item 03',
27
- 'Item 04',
28
- 'Item 05' ]
29
- @select.clicked do |element, event|
30
- RubyApp::Session.show_dialog(event, RubyApp::Elements::Dialogs::MessageDialog.new(self.translate.message_dialog.message.title,
31
- self.translate.message_dialog.message.message(@select.selected_item)))
32
- end
33
-
34
- end
35
-
36
- end
37
-
38
- end
39
-
40
- end
41
-
42
- end
43
-
44
- end
@@ -1,40 +0,0 @@
1
- #\ --warn --port 8008 --pid ./rack.pid
2
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[lib]))
3
-
4
- require 'rubygems'
5
- require 'bundler/setup'
6
-
7
- require 'rack'
8
-
9
- require 'ruby_app/rack/application'
10
- require 'ruby_app/rack/route'
11
- require 'ruby_app/version'
12
-
13
- require '_APPLICATION_DOWNCODE_/application'
14
- require '_APPLICATION_DOWNCODE_/session'
15
- require '_APPLICATION_DOWNCODE_/version'
16
-
17
- use Rack::ShowExceptions
18
- use Rack::Session::Pool, :expire_after => 15 * 60
19
- use Rack::Reloader
20
- use Rack::ContentLength
21
-
22
- use RubyApp::Rack::Application, :application_class => _APPLICATION_UPCODE_::Application,
23
- :session_class => _APPLICATION_UPCODE_::Session,
24
- :log_path => File.join(_APPLICATION_UPCODE_::ROOT, %w[log application.log]),
25
- :configuration_paths => File.join(_APPLICATION_UPCODE_::ROOT, %w[config.yml]),
26
- :default_language => :en,
27
- :translations_paths => File.join(_APPLICATION_UPCODE_::ROOT, %w[translations])
28
- run RubyApp::Rack::Route.new
29
-
30
- map '/favicon.ico' do
31
- run Rack::File.new(File.join(RubyApp::ROOT, %w[resources favicon.ico]))
32
- end
33
-
34
- map '/ruby_app/resources' do
35
- run Rack::File.new(File.join(RubyApp::ROOT, %w[resources]))
36
- end
37
-
38
- map '/_APPLICATION_DOWNCODE_/resources' do
39
- run Rack::File.new(File.join(_APPLICATION_UPCODE_::ROOT, %w[resources]))
40
- end
@@ -1 +0,0 @@
1
- _APPLICATION_DOWNCODE_:
@@ -1,3 +0,0 @@
1
- - self.rendered?(__FILE__) do
2
- :sass
3
- = yield
@@ -1,4 +0,0 @@
1
- - self.content_for(:body) do
2
- /
3
- #{__FILE__}
4
- Hello world!
@@ -1,3 +0,0 @@
1
- - self.rendered?(__FILE__) do
2
- :plain
3
- = yield
@@ -1,14 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
-
4
- require 'ruby_app/elements/page'
5
-
6
- class _PAGE_UPCODE_ < RubyApp::Elements::Page
7
-
8
- template_path(:all, File.dirname(__FILE__))
9
-
10
- def initialize
11
- super
12
- end
13
-
14
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/configuration'
4
-
5
- describe RubyApp::Configuration do
6
- include_context 'RubyApp::Application'
7
-
8
- describe 'positive' do
9
-
10
- describe 'class' do
11
-
12
- specify { RubyApp::Configuration.should respond_to('load!') }
13
- specify { RubyApp::Configuration.should respond_to('get') }
14
- specify { RubyApp::Configuration.should respond_to('unload!') }
15
-
16
- specify { RubyApp::Configuration.get.should_not be_nil }
17
-
18
- end
19
-
20
- end
21
-
22
- describe 'negative' do
23
- end
24
-
25
- end
@@ -1,72 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/element'
4
-
5
- describe RubyApp::Element do
6
- include_context 'RubyApp::Request'
7
-
8
- describe RubyApp::Element::Event do
9
-
10
- describe 'positive' do
11
-
12
- describe 'class' do
13
-
14
- specify { RubyApp::Element::Event.should respond_to('from_hash') }
15
-
16
- end
17
-
18
- describe 'instance' do
19
-
20
- let(:element) { RubyApp::Element.new }
21
- let(:event) { RubyApp::Element::Event.new('now' => Time.now.to_s, 'source_id' => element.element_id) }
22
-
23
- specify { event.should respond_to('now') }
24
- specify { event.should respond_to('source') }
25
- specify { event.source.should_not be_nil }
26
- specify { event.source.should == element }
27
-
28
- specify { event.should respond_to('process!') }
29
- specify { event.should respond_to('alert') }
30
- specify { event.should respond_to('refresh') }
31
- specify { event.should respond_to('show_dialog') }
32
- specify { event.should respond_to('hide_dialog') }
33
- specify { event.should respond_to('update_element') }
34
- specify { event.should respond_to('update_text') }
35
- specify { event.should respond_to('update_value') }
36
- specify { event.should respond_to('go') }
37
- specify { event.should respond_to('execute') }
38
- specify { event.should respond_to('to_hash') }
39
-
40
- end
41
-
42
- end
43
-
44
- describe 'negative' do
45
-
46
- end
47
-
48
- end
49
-
50
- describe 'positive' do
51
-
52
- describe 'class' do
53
-
54
- specify { RubyApp::Element.should respond_to('get_element') }
55
-
56
- end
57
-
58
- describe 'instance' do
59
-
60
- let(:element) { RubyApp::Element.new }
61
-
62
- specify { element.should respond_to('attributes') }
63
- specify { RubyApp::Element.get_element(element.element_id).should == element }
64
-
65
- end
66
-
67
- end
68
-
69
- describe 'negative' do
70
- end
71
-
72
- end
@@ -1,62 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/application'
4
- require 'ruby_app/element'
5
- require 'ruby_app/elements/navigation/breadcrumbs'
6
- require 'ruby_app/elements/pages/default_page'
7
- require 'ruby_app/elements/pages/test_pages/default_test_page'
8
- require 'ruby_app/session'
9
-
10
- describe RubyApp::Elements::Navigation::Breadcrumbs do
11
- include_context 'RubyApp::Request'
12
-
13
- describe 'positive' do
14
-
15
- describe 'class' do
16
-
17
- specify { RubyApp::Elements::Navigation::Breadcrumbs.render(:css).should be_nil }
18
- specify { RubyApp::Elements::Navigation::Breadcrumbs.render(:js).should_not be_nil }
19
-
20
- end
21
-
22
- describe 'instance' do
23
-
24
- let(:breadcrumbs) { RubyApp::Elements::Navigation::Breadcrumbs.new }
25
-
26
- specify { breadcrumbs.render(:html).should_not be_nil }
27
-
28
- end
29
-
30
- describe 'pages' do
31
-
32
- before(:all) do
33
- RubyApp::Session.pages.push(RubyApp::Elements::Pages::TestPages::DefaultTestPage.new)
34
- end
35
-
36
- let(:breadcrumbs) { RubyApp::Elements::Navigation::Breadcrumbs.new }
37
- let(:first_page) { RubyApp::Session.pages.first }
38
- let(:second_page) { RubyApp::Session.pages.last }
39
-
40
- specify { RubyApp::Session.pages.length.should == 2 }
41
- specify { breadcrumbs.render(:html).should include(first_page.translate.title) }
42
- specify { breadcrumbs.render(:html).should include(second_page.translate.title) }
43
-
44
- describe 'event' do
45
-
46
- before(:all) do
47
- RubyApp::Element::Event.from_hash({ 'now' => Time.now.to_s,
48
- '_class' => 'RubyApp::Elements::Navigation::Base::BaseBreadcrumbs::ClickedEvent',
49
- 'source_id' => breadcrumbs.element_id,
50
- 'page_id' => first_page.element_id }).process!
51
- end
52
-
53
- specify { RubyApp::Session.pages.length.should == 1 }
54
- specify { RubyApp::Session.pages.last.should == first_page }
55
-
56
- end
57
-
58
- end
59
-
60
- end
61
-
62
- end
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/elements/page'
4
-
5
- describe RubyApp::Elements::Page do
6
- include_context 'RubyApp::Request'
7
-
8
- describe 'positive' do
9
-
10
- describe 'render instance' do
11
-
12
- let(:page) { RubyApp::Elements::Page.new }
13
-
14
- specify { page.should respond_to(:interval) }
15
-
16
- end
17
-
18
- end
19
-
20
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/language'
4
-
5
- describe RubyApp::Language do
6
- include_context 'RubyApp::Request'
7
-
8
- describe 'positive' do
9
-
10
- describe 'class' do
11
-
12
- specify { RubyApp::Language.should respond_to('load!') }
13
- specify { RubyApp::Language.should respond_to('get') }
14
- specify { RubyApp::Language.should respond_to('unload!') }
15
-
16
- specify { RubyApp::Language.get.should_not be_nil }
17
-
18
- end
19
-
20
- end
21
-
22
- describe 'negative' do
23
- end
24
-
25
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/log'
4
-
5
- describe RubyApp::Log do
6
- include_context 'RubyApp::Application'
7
-
8
- describe 'positive' do
9
-
10
- describe 'class' do
11
-
12
- specify { RubyApp::Log.should respond_to('open!') }
13
- specify { RubyApp::Log.should respond_to('get') }
14
- specify { RubyApp::Log.should respond_to('close!') }
15
-
16
- specify { RubyApp::Log.get.should_not be_nil }
17
-
18
- end
19
-
20
- end
21
-
22
- describe 'negative' do
23
- end
24
-
25
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/mixins/configuration_mixin'
4
-
5
- describe RubyApp::Mixins::ConfigurationMixin do
6
- include_context 'RubyApp::Request'
7
-
8
- describe 'positive' do
9
-
10
- before(:all) do
11
-
12
- class TestConfigurationMixin
13
- include RubyApp::Mixins::ConfigurationMixin
14
- end
15
-
16
- end
17
-
18
- let(:instance_a) { TestConfigurationMixin.new }
19
-
20
- specify { instance_a.should respond_to(:configuration) }
21
-
22
- end
23
-
24
- end
@@ -1,28 +0,0 @@
1
- require 'ruby_app/mixins/delegate_mixin'
2
-
3
- describe RubyApp::Mixins::DelegateMixin do
4
-
5
- describe 'positive' do
6
-
7
- before(:all) do
8
-
9
- class TestDelegateMixin
10
- extend RubyApp::Mixins::DelegateMixin
11
-
12
- def get_a
13
- return TestDelegateMixin
14
- end
15
-
16
- def self.get
17
- TestDelegateMixin.new
18
- end
19
-
20
- end
21
-
22
- end
23
-
24
- specify { TestDelegateMixin.get_a.should == TestDelegateMixin }
25
-
26
- end
27
-
28
- end