rad_core 0.0.29 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,8 +31,6 @@ require 'micon/rad'
31
31
 
32
32
  require 'rad/_support/class_loader'
33
33
 
34
- require 'dictionary'
35
-
36
34
  require 'thread'
37
35
  require 'time'
38
36
  require 'uri'
@@ -48,8 +46,6 @@ require 'rad/_support/addressable'
48
46
  #
49
47
  require 'rad/_support/hacks_and_fixes'
50
48
 
51
- autoload :Nokogiri, 'nokogiri'
52
-
53
49
  [
54
50
  'module',
55
51
  'callbacks',
data/lib/rad/gems.rb CHANGED
@@ -1,21 +1,19 @@
1
1
  # core gems dependencies
2
- gem 'i18n', '0.5.0'
3
- gem 'polyglot', '0.3.1'
4
- gem 'treetop', '1.4.9'
5
- gem 'mime-types', '1.16'
2
+ # gem 'i18n', '0.5.0'
3
+ # gem 'polyglot', '0.3.1'
4
+ # gem 'treetop', '1.4.9'
5
+ # gem 'mime-types', '1.16'
6
6
 
7
7
  # core gems
8
8
  gem 'activesupport', '3.0.7'
9
- gem 'builder', '2.1.2'
9
+ # gem 'builder', '2.1.2'
10
10
 
11
11
  gem 'haml', '3.0.25'
12
12
  gem 'tilt', '1.2.1'
13
13
 
14
14
  gem 'json', '1.4.6'
15
15
  gem 'addressable', '2.2.2'
16
- gem 'nokogiri', '1.4.4'
17
-
18
- gem 'dictionary', '1.0.0'
16
+ # gem 'nokogiri', '1.4.4'
19
17
 
20
18
  gem 'rack', '1.3.0'
21
19
  gem 'thin', '1.2.7'
@@ -14,7 +14,7 @@ class Rad::Router
14
14
  end
15
15
 
16
16
  def routers= routers
17
- @routers = Dictionary.new
17
+ @routers = {}
18
18
  routers.each do |k, v|
19
19
  k.must_be.present
20
20
  v.must_be.present
@@ -56,8 +56,7 @@ rspec do
56
56
  end
57
57
 
58
58
  protected
59
- def parse_wcall_arguments *args
60
-
59
+ def parse_wcall_arguments *args
61
60
  # parsing params
62
61
  params = args.extract_options!
63
62
  first = args.first
@@ -66,16 +65,10 @@ rspec do
66
65
  if args.size == 1 and first.is_a?(String) and first =~ /^\/|^http:/
67
66
  uri = Uri.parse first
68
67
  workspace_variables[:path] = uri.path
69
- workspace_variables[:params] = uri.query_values
70
68
  workspace_variables[:env] = Rad::Http::Request.stub_environment(first)
71
- # if first =~ /^\//
72
- # workspace_variables[:path] = first
73
- # else
74
- # uri = Uri.parse first
75
- # workspace_variables[:path] = uri.path
76
- # workspace_variables[:params] = uri.query_values
77
- # workspace_variables[:env] = Rad::Http::Request.stub_environment(first)
78
- # end
69
+
70
+ # some params may be defined in :url ans some in :params, merging both
71
+ params = uri.query_values.merge params if uri.query_values
79
72
  elsif (first.is_a?(String) or first.is_a?(Symbol)) and args.size <= 2
80
73
  workspace_variables[:path] = '/'
81
74
  workspace_variables[:class] = wcall_options[:controller] || raise("not defined wcall controller (use set_wcall controller: SomeController)!")
@@ -89,7 +82,7 @@ rspec do
89
82
  else
90
83
  raise "Invalid input!"
91
84
  end
92
-
85
+
93
86
  # preparing environment
94
87
  workspace_variables[:env] ||= {}
95
88
  workspace_variables[:env].reverse_merge! Rad::Http::Request.stub_environment
@@ -1,3 +1,5 @@
1
+ require 'nokogiri'
2
+
1
3
  class String
2
4
  def to_xhtml css = nil
3
5
  node = Nokogiri::HTML(self)
data/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rad - Ruby Web Framework
2
2
 
3
- Simple and highly customizable Web Framework encouraging to build an app as a set of low-coupled components instead of monolith.
3
+ Simple and highly customizable Web Framework encouraging to build an app as a set of cooperating components instead of monolith.
4
4
  With an architecture heavily inspired by Rails, Spring IoC, JBoss Seam and JEE (but without config burden).
5
5
 
6
6
  You can start instantly using one of predefined profiles, or take a total control over all aspects of environment and completelly modify it according to Your goals (everything is a component, if You don't like the router, controller or views - throw it out and introduce Your own).
@@ -20,6 +20,7 @@ Here's the classic **sample blog app** [rad-sample.heroku.com](http://rad-sample
20
20
  - Simple things should be simple (simple API, instant start with minimal config)
21
21
  - Complete control if You need it, it's designed to be open and customizable
22
22
  - Agile/Extreme development should be easy (specs, iterative development, fast prototyping)
23
+ - Be small (and it's small, actually it's nothing more than a thin integration layer over a lot's of other gems)
23
24
 
24
25
  ## Some thecnical thoughts and ideas:
25
26
 
@@ -29,7 +30,15 @@ Here's the classic **sample blog app** [rad-sample.heroku.com](http://rad-sample
29
30
  - I also tried to comply to KISS principle - always fighting complex stuff, seeking for not needed API or code that can be eliminated or delegated to external library.
30
31
  - I tried to reuse existing good stuff as much as possible, for example - web tier looks kinda like Rails (so, You don't have to learn much of new stuff and API) but the behaviour of it is slightly (or sometimes significally) different.
31
32
 
33
+ ## It's small
34
+
35
+ I would like to mention it one more time - Rad is not a super-specialized framework like Sinatra, it's the universal and full-featured Web Framework, but it's size is small, really small!
36
+ Take a look at [code statistics](http://ruby-lang.info/blog/simple-approach-to-measure-the-agility-and-complexi-4mu), find there the 'rad_core' word and compare it's size with others, actually it's even smaller, because the half of code belongs to specs.
37
+
38
+ I believe **small code size is very important**, it means that the project is easy to understand, easy to refactor and customize and it's agile (by agility I mean high speed of reaction and adoption to changing world environment and requirements).
39
+
32
40
  ## Why did I make another Rails?
41
+
33
42
  There are many things that I like in Rails:
34
43
 
35
44
  - high productivity
@@ -25,9 +25,10 @@ describe "Router Basic" do
25
25
  end
26
26
 
27
27
  it "encode_method" do
28
- lambda{@router.encode_method :class_method, false}.should raise_error(/route method/)
29
- @router.routers.first.should_receive(:encode_method).and_return([BlogsController, :show])
30
- @router.encode_method(:class_method, false).should == [BlogsController, :show]
28
+ lambda{@router.encode_method :some_method, false}.should raise_error(/route method/)
29
+ first_router_in_chain = @router.routers.to_a[0][1]
30
+ first_router_in_chain.should_receive(:encode_method).and_return([BlogsController, :show])
31
+ @router.encode_method(:some_method, false).should == [BlogsController, :show]
31
32
  end
32
33
 
33
34
  it "decode" do
@@ -52,7 +52,7 @@ describe "spec helper" do
52
52
  describe "routes" do
53
53
  before do
54
54
  router = rad[:router]
55
- router.routers.unshift :restful_router, Rad::Router::RestfulRouter.new
55
+ router.routers[:restful_router] = Rad::Router::RestfulRouter.new
56
56
  router.routers[:restful_router].add :planes, class_name: 'Planes'
57
57
  end
58
58
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rad_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.29
4
+ version: 0.0.30
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,56 +10,12 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-29 00:00:00 +04:00
13
+ date: 2011-07-30 00:00:00 +04:00
14
14
  default_executable:
15
15
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: i18n
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
23
- version: 0.5.0
24
- type: :runtime
25
- prerelease: false
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: polyglot
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - "="
33
- - !ruby/object:Gem::Version
34
- version: 0.3.1
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: treetop
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - "="
44
- - !ruby/object:Gem::Version
45
- version: 1.4.9
46
- type: :runtime
47
- prerelease: false
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: mime-types
51
- requirement: &id004 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - "="
55
- - !ruby/object:Gem::Version
56
- version: "1.16"
57
- type: :runtime
58
- prerelease: false
59
- version_requirements: *id004
60
16
  - !ruby/object:Gem::Dependency
61
17
  name: activesupport
62
- requirement: &id005 !ruby/object:Gem::Requirement
18
+ requirement: &id001 !ruby/object:Gem::Requirement
63
19
  none: false
64
20
  requirements:
65
21
  - - "="
@@ -67,21 +23,10 @@ dependencies:
67
23
  version: 3.0.7
68
24
  type: :runtime
69
25
  prerelease: false
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: builder
73
- requirement: &id006 !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - "="
77
- - !ruby/object:Gem::Version
78
- version: 2.1.2
79
- type: :runtime
80
- prerelease: false
81
- version_requirements: *id006
26
+ version_requirements: *id001
82
27
  - !ruby/object:Gem::Dependency
83
28
  name: haml
84
- requirement: &id007 !ruby/object:Gem::Requirement
29
+ requirement: &id002 !ruby/object:Gem::Requirement
85
30
  none: false
86
31
  requirements:
87
32
  - - "="
@@ -89,10 +34,10 @@ dependencies:
89
34
  version: 3.0.25
90
35
  type: :runtime
91
36
  prerelease: false
92
- version_requirements: *id007
37
+ version_requirements: *id002
93
38
  - !ruby/object:Gem::Dependency
94
39
  name: tilt
95
- requirement: &id008 !ruby/object:Gem::Requirement
40
+ requirement: &id003 !ruby/object:Gem::Requirement
96
41
  none: false
97
42
  requirements:
98
43
  - - "="
@@ -100,10 +45,10 @@ dependencies:
100
45
  version: 1.2.1
101
46
  type: :runtime
102
47
  prerelease: false
103
- version_requirements: *id008
48
+ version_requirements: *id003
104
49
  - !ruby/object:Gem::Dependency
105
50
  name: json
106
- requirement: &id009 !ruby/object:Gem::Requirement
51
+ requirement: &id004 !ruby/object:Gem::Requirement
107
52
  none: false
108
53
  requirements:
109
54
  - - "="
@@ -111,10 +56,10 @@ dependencies:
111
56
  version: 1.4.6
112
57
  type: :runtime
113
58
  prerelease: false
114
- version_requirements: *id009
59
+ version_requirements: *id004
115
60
  - !ruby/object:Gem::Dependency
116
61
  name: addressable
117
- requirement: &id010 !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
118
63
  none: false
119
64
  requirements:
120
65
  - - "="
@@ -122,32 +67,10 @@ dependencies:
122
67
  version: 2.2.2
123
68
  type: :runtime
124
69
  prerelease: false
125
- version_requirements: *id010
126
- - !ruby/object:Gem::Dependency
127
- name: nokogiri
128
- requirement: &id011 !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - "="
132
- - !ruby/object:Gem::Version
133
- version: 1.4.4
134
- type: :runtime
135
- prerelease: false
136
- version_requirements: *id011
137
- - !ruby/object:Gem::Dependency
138
- name: dictionary
139
- requirement: &id012 !ruby/object:Gem::Requirement
140
- none: false
141
- requirements:
142
- - - "="
143
- - !ruby/object:Gem::Version
144
- version: 1.0.0
145
- type: :runtime
146
- prerelease: false
147
- version_requirements: *id012
70
+ version_requirements: *id005
148
71
  - !ruby/object:Gem::Dependency
149
72
  name: rack
150
- requirement: &id013 !ruby/object:Gem::Requirement
73
+ requirement: &id006 !ruby/object:Gem::Requirement
151
74
  none: false
152
75
  requirements:
153
76
  - - "="
@@ -155,10 +78,10 @@ dependencies:
155
78
  version: 1.3.0
156
79
  type: :runtime
157
80
  prerelease: false
158
- version_requirements: *id013
81
+ version_requirements: *id006
159
82
  - !ruby/object:Gem::Dependency
160
83
  name: thin
161
- requirement: &id014 !ruby/object:Gem::Requirement
84
+ requirement: &id007 !ruby/object:Gem::Requirement
162
85
  none: false
163
86
  requirements:
164
87
  - - "="
@@ -166,10 +89,10 @@ dependencies:
166
89
  version: 1.2.7
167
90
  type: :runtime
168
91
  prerelease: false
169
- version_requirements: *id014
92
+ version_requirements: *id007
170
93
  - !ruby/object:Gem::Dependency
171
94
  name: mail
172
- requirement: &id015 !ruby/object:Gem::Requirement
95
+ requirement: &id008 !ruby/object:Gem::Requirement
173
96
  none: false
174
97
  requirements:
175
98
  - - "="
@@ -177,10 +100,10 @@ dependencies:
177
100
  version: 2.2.14
178
101
  type: :runtime
179
102
  prerelease: false
180
- version_requirements: *id015
103
+ version_requirements: *id008
181
104
  - !ruby/object:Gem::Dependency
182
105
  name: ruby_ext
183
- requirement: &id016 !ruby/object:Gem::Requirement
106
+ requirement: &id009 !ruby/object:Gem::Requirement
184
107
  none: false
185
108
  requirements:
186
109
  - - ">="
@@ -188,10 +111,10 @@ dependencies:
188
111
  version: "0"
189
112
  type: :runtime
190
113
  prerelease: false
191
- version_requirements: *id016
114
+ version_requirements: *id009
192
115
  - !ruby/object:Gem::Dependency
193
116
  name: vfs
194
- requirement: &id017 !ruby/object:Gem::Requirement
117
+ requirement: &id010 !ruby/object:Gem::Requirement
195
118
  none: false
196
119
  requirements:
197
120
  - - ">="
@@ -199,10 +122,10 @@ dependencies:
199
122
  version: "0"
200
123
  type: :runtime
201
124
  prerelease: false
202
- version_requirements: *id017
125
+ version_requirements: *id010
203
126
  - !ruby/object:Gem::Dependency
204
127
  name: micon
205
- requirement: &id018 !ruby/object:Gem::Requirement
128
+ requirement: &id011 !ruby/object:Gem::Requirement
206
129
  none: false
207
130
  requirements:
208
131
  - - ">="
@@ -210,10 +133,10 @@ dependencies:
210
133
  version: "0"
211
134
  type: :runtime
212
135
  prerelease: false
213
- version_requirements: *id018
136
+ version_requirements: *id011
214
137
  - !ruby/object:Gem::Dependency
215
138
  name: class_loader
216
- requirement: &id019 !ruby/object:Gem::Requirement
139
+ requirement: &id012 !ruby/object:Gem::Requirement
217
140
  none: false
218
141
  requirements:
219
142
  - - ">="
@@ -221,7 +144,7 @@ dependencies:
221
144
  version: "0"
222
145
  type: :runtime
223
146
  prerelease: false
224
- version_requirements: *id019
147
+ version_requirements: *id012
225
148
  description:
226
149
  email:
227
150
  executables: