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,39 +0,0 @@
1
- require 'ruby_app/mixins/hash_mixin'
2
-
3
- describe RubyApp::Mixins::HashMixin do
4
-
5
- describe 'positive' do
6
-
7
- before(:all) do
8
-
9
- class TestHashMixin
10
- include RubyApp::Mixins::HashMixin
11
-
12
- def initialize
13
- @data = { :get_a => TestHashMixin }
14
- end
15
-
16
- def [](key)
17
- @data[key]
18
- end
19
-
20
- def []=(key, value)
21
- @data[key] = value
22
- end
23
-
24
- end
25
-
26
- end
27
-
28
- let(:instance_a) { TestHashMixin.new }
29
-
30
- specify { instance_a.get_a.should == TestHashMixin }
31
-
32
- specify do
33
- instance_a.get_a = RubyApp::Mixins::HashMixin
34
- instance_a.get_a.should == RubyApp::Mixins::HashMixin
35
- end
36
-
37
- end
38
-
39
- end
@@ -1,127 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
-
4
- require 'haml'
5
-
6
- require 'spec_helper'
7
-
8
- require 'ruby_app/mixins/render_mixin'
9
- require 'ruby_app/mixins/template_mixin'
10
-
11
- describe RubyApp::Mixins::RenderMixin do
12
- include_context 'RubyApp::Request'
13
-
14
- before(:all) do
15
-
16
- class TestA
17
- extend RubyApp::Mixins::TemplateMixin
18
- extend Haml::Helpers
19
- include Haml::Helpers
20
- extend RubyApp::Mixins::RenderMixin
21
- include RubyApp::Mixins::RenderMixin
22
- template_path(:all, File.dirname(__FILE__))
23
- end
24
-
25
- class TestB < TestA
26
- template_path(:all, File.dirname(__FILE__))
27
- end
28
-
29
- class TestC < TestA
30
- template_path(:all, File.dirname(__FILE__))
31
- exclude_parent_template(:html)
32
- end
33
-
34
- class TestD < TestC
35
- template_path(:all, File.dirname(__FILE__))
36
- end
37
-
38
- end
39
-
40
- describe 'positive' do
41
-
42
- describe 'class' do
43
-
44
- specify { TestA.render(:css).should include('/* TestA */') }
45
- specify { TestA.render(:css).scan(/TestA/).length.should == 1 }
46
- specify { TestA.render(:js).should include('// TestA') }
47
- specify { TestA.render(:js).scan(/TestA/).length.should == 1 }
48
-
49
- describe 'including all derived class' do
50
-
51
- specify { TestB.render(:css).should include('/* TestA */') }
52
- specify { TestB.render(:css).should include('/* TestB */') }
53
- specify { TestB.render(:js).should include('// TestA') }
54
- specify { TestB.render(:js).should include('// TestB') }
55
-
56
- end
57
-
58
- describe 'including some derived class' do
59
-
60
- specify { TestC.render(:css).should include('/* TestA */') }
61
- specify { TestC.render(:css).should include('/* TestC */') }
62
- specify { TestC.render(:js).should include('// TestA') }
63
- specify { TestC.render(:js).should include('// TestC') }
64
-
65
- end
66
-
67
- describe 'render a derived class with no templates' do
68
-
69
- specify { TestD.render(:css).should include('/* TestA */') }
70
- specify { TestD.render(:css).should include('/* TestC */') }
71
- specify { TestD.render(:js).should include('// TestA') }
72
- specify { TestD.render(:js).should include('// TestC') }
73
-
74
- end
75
-
76
- end
77
-
78
- describe 'instance' do
79
-
80
- let(:instance_a) { TestA.new }
81
- let(:instance_b) { TestB.new }
82
- let(:instance_c) { TestC.new }
83
- let(:instance_d) { TestD.new }
84
-
85
- specify { instance_a.render(:html).should include('<!-- TestA -->') }
86
- specify { instance_a.render(:html).scan(/TestA/).length.should == 1 }
87
-
88
- describe 'include all derived instance' do
89
-
90
- specify { instance_b.render(:html).should include('<!-- TestA -->') }
91
- specify { instance_b.render(:html).should include('<!-- TestB -->') }
92
-
93
- end
94
-
95
- describe 'include some derived instance' do
96
-
97
- specify { instance_c.render(:html).should include('<!-- TestC -->') }
98
-
99
- end
100
-
101
- describe 'render a derived instance with no templates' do
102
-
103
- specify { instance_d.render(:html).should include('<!-- TestC -->') }
104
-
105
- end
106
-
107
- end
108
-
109
- end
110
-
111
- describe 'negative' do
112
-
113
- describe 'instance' do
114
-
115
- describe 'should not include some derived instance' do
116
-
117
- let(:instance_c) { TestC.new }
118
-
119
- specify { instance_c.render(:html).should_not include('<!-- TestA -->') }
120
-
121
- end
122
-
123
- end
124
-
125
- end
126
-
127
- end
@@ -1,60 +0,0 @@
1
- require 'ruby_app/mixins/route_mixin'
2
-
3
- describe RubyApp::Mixins::RouteMixin do
4
-
5
- before(:all) do
6
- Object.extend RubyApp::Mixins::RouteMixin
7
- end
8
-
9
- before(:each) do
10
- @value = false
11
- @parameters = nil
12
- Object.clear_routes
13
- end
14
-
15
- describe 'positive' do
16
-
17
- it 'should match a blank pattern on GET' do
18
- Object.route(RubyApp::Mixins::RouteMixin::GET, /^$/) { @value = true }
19
- @value.should be_false
20
- Object.do_route(RubyApp::Mixins::RouteMixin::GET, '')
21
- @value.should be_true
22
- end
23
-
24
- it 'should match a pattern on GET' do
25
- Object.route(RubyApp::Mixins::RouteMixin::GET, /^pattern$/) { @value = true }
26
- @value.should be_false
27
- Object.do_route(RubyApp::Mixins::RouteMixin::GET, 'pattern')
28
- @value.should be_true
29
- end
30
-
31
- it 'should match a pattern on POST' do
32
- Object.route(RubyApp::Mixins::RouteMixin::POST, /^pattern$/) { @value = true }
33
- @value.should be_false
34
- Object.do_route(RubyApp::Mixins::RouteMixin::POST, 'pattern')
35
- @value.should be_true
36
- end
37
-
38
- it 'should match a pattern on GET with a parameter' do
39
- Object.route(RubyApp::Mixins::RouteMixin::GET, /^pattern (.*)$/) { |method, path, parameter| @value, @parameters = true, parameter }
40
- @value.should be_false
41
- @parameter.should be_nil
42
- Object.do_route(RubyApp::Mixins::RouteMixin::GET, 'pattern parameter')
43
- @value.should be_true
44
- @parameters.should == 'parameter'
45
- end
46
-
47
- end
48
-
49
- describe 'negative' do
50
-
51
- it 'should not match a not matching pattern on GET' do
52
- Object.route(RubyApp::Mixins::RouteMixin::GET, /^pattern$/) { @value = true }
53
- @value.should be_false
54
- Object.do_route(RubyApp::Mixins::RouteMixin::GET, 'not matching pattern')
55
- @value.should be_false
56
- end
57
-
58
- end
59
-
60
- end
@@ -1,78 +0,0 @@
1
- require 'ruby_app/mixins/template_mixin'
2
-
3
- describe RubyApp::Mixins::TemplateMixin do
4
-
5
- before(:all) do
6
-
7
- class TestA
8
- extend RubyApp::Mixins::TemplateMixin
9
- template_path(:all, File.dirname(__FILE__))
10
- end
11
-
12
- class TestB < TestA
13
- template_path(:all, File.dirname(__FILE__))
14
- end
15
-
16
- class TestC < TestA
17
- template_path(:all, File.dirname(__FILE__))
18
- exclude_parent_template(:html)
19
- end
20
-
21
- class TestD < TestC
22
- template_path(:all, File.dirname(__FILE__))
23
- end
24
-
25
- end
26
-
27
- describe 'positive' do
28
-
29
- specify { TestA.get_templates(:html).should include File.join(File.dirname(__FILE__), %w[test_a.html.haml]) }
30
- specify { TestA.get_templates(:css).should include File.join(File.dirname(__FILE__), %w[test_a.css.haml]) }
31
- specify { TestA.get_templates(:js).should include File.join(File.dirname(__FILE__), %w[test_a.js.haml]) }
32
-
33
- describe 'include all parent' do
34
-
35
- specify { TestB.get_templates(:html).should include File.join(File.dirname(__FILE__), %w[test_a.html.haml]) }
36
- specify { TestB.get_templates(:html).should include File.join(File.dirname(__FILE__), %w[test_b.html.haml]) }
37
- specify { TestB.get_templates(:css).should include File.join(File.dirname(__FILE__), %w[test_a.css.haml]) }
38
- specify { TestB.get_templates(:css).should include File.join(File.dirname(__FILE__), %w[test_b.css.haml]) }
39
- specify { TestB.get_templates(:js).should include File.join(File.dirname(__FILE__), %w[test_a.js.haml]) }
40
- specify { TestB.get_templates(:js).should include File.join(File.dirname(__FILE__), %w[test_b.js.haml]) }
41
-
42
- end
43
-
44
- describe 'include some parents' do
45
-
46
- specify { TestC.get_templates(:html).should include File.join(File.dirname(__FILE__), %w[test_c.html.haml]) }
47
- specify { TestC.get_templates(:css).should include File.join(File.dirname(__FILE__), %w[test_a.css.haml]) }
48
- specify { TestC.get_templates(:css).should include File.join(File.dirname(__FILE__), %w[test_c.css.haml]) }
49
- specify { TestC.get_templates(:js).should include File.join(File.dirname(__FILE__), %w[test_a.js.haml]) }
50
- specify { TestC.get_templates(:js).should include File.join(File.dirname(__FILE__), %w[test_c.js.haml]) }
51
-
52
- end
53
-
54
- describe 'with no templates' do
55
-
56
- specify { TestD.get_templates(:html).should include File.join(File.dirname(__FILE__), %w[test_c.html.haml]) }
57
- specify { TestD.get_templates(:css).should include File.join(File.dirname(__FILE__), %w[test_c.css.haml]) }
58
- specify { TestD.get_templates(:js).should include File.join(File.dirname(__FILE__), %w[test_c.js.haml]) }
59
-
60
- end
61
-
62
- end
63
-
64
- describe 'negative' do
65
-
66
- specify { TestA.get_templates(:htm).should_not include File.join(File.dirname(__FILE__), %w[test_a.htm.haml]) }
67
- specify { TestA.get_templates(:sass).should_not include File.join(File.dirname(__FILE__), %w[test_a.scss.haml]) }
68
- specify { TestA.get_templates(:javascript).should_not include File.join(File.dirname(__FILE__), %w[test_a.javascript.haml]) }
69
-
70
- describe 'include some parents' do
71
-
72
- specify { TestC.get_templates(:html).should_not include File.join(File.dirname(__FILE__), %w[test_a.html.haml]) }
73
-
74
- end
75
-
76
- end
77
-
78
- end
@@ -1,4 +0,0 @@
1
- - self.rendered?(__FILE__) do
2
- :sass
3
- /* TestA
4
- = yield
@@ -1,2 +0,0 @@
1
- / TestA
2
- = yield :next_1
@@ -1,4 +0,0 @@
1
- - self.rendered?(__FILE__) do
2
- :plain
3
- // TestA
4
- = yield
@@ -1,4 +0,0 @@
1
- - self.rendered?(__FILE__) do
2
- :sass
3
- /* TestB
4
- = yield
@@ -1,3 +0,0 @@
1
- - self.content_for(:next_1) do
2
- / TestB
3
- = yield :next_2
@@ -1,4 +0,0 @@
1
- - self.rendered?(__FILE__) do
2
- :plain
3
- // TestB
4
- = yield
@@ -1,4 +0,0 @@
1
- - self.rendered?(__FILE__) do
2
- :sass
3
- /* TestC
4
- = yield
@@ -1,2 +0,0 @@
1
- / TestC
2
- = yield :next_3
@@ -1,4 +0,0 @@
1
- - self.rendered?(__FILE__) do
2
- :plain
3
- // TestC
4
- = yield
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/mixins/translate_mixin'
4
-
5
- describe RubyApp::Mixins::TranslateMixin do
6
- include_context 'RubyApp::Request'
7
-
8
- describe 'positive' do
9
-
10
- before(:all) do
11
-
12
- class TestTranslateMixin
13
- include RubyApp::Mixins::TranslateMixin
14
- end
15
-
16
- end
17
-
18
- let(:instance_a) { TestTranslateMixin.new }
19
-
20
- specify { instance_a.should respond_to(:translate) }
21
- specify { instance_a.should respond_to(:localize) }
22
-
23
- end
24
-
25
- end
@@ -1,39 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby_app/session'
4
-
5
- describe RubyApp::Session do
6
- include_context 'RubyApp::Request'
7
-
8
- describe 'positive' do
9
-
10
- describe 'class' do
11
-
12
- specify { RubyApp::Session.should respond_to('create!') }
13
- specify { RubyApp::Session.should respond_to('get') }
14
- specify { RubyApp::Session.should respond_to('destroy!') }
15
-
16
- specify { RubyApp::Session.get.should_not be_nil }
17
-
18
- end
19
-
20
- describe 'instance' do
21
-
22
- let(:session) { RubyApp::Session.get }
23
-
24
- specify { session.should respond_to('pages') }
25
- specify { session.should respond_to('[]') }
26
- specify { session.should respond_to('[]=') }
27
- specify { session.should respond_to('identity') }
28
- specify { session.should respond_to('identity=') }
29
- specify { session.should respond_to('show_dialog') }
30
- specify { session.should respond_to('quit') }
31
-
32
- end
33
-
34
- end
35
-
36
- describe 'negative' do
37
- end
38
-
39
- end