welltreat-store-framework 0.2.2 → 0.2.3

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.
@@ -1,7 +1,5 @@
1
- require 'welltreat_store_framework/haml_renderer/paths'
2
- require 'welltreat_store_framework/haml_renderer/partial'
3
- require 'welltreat_store_framework/haml_renderer/tags_helper'
4
- require 'welltreat_store_framework/haml_renderer/lorem_helper'
1
+ require 'welltreat_store_framework/haml_renderer/context'
2
+ require 'welltreat_store_framework/haml_renderer/url_join'
5
3
 
6
4
  module WelltreatStoreFramework
7
5
  module HamlRenderer
@@ -72,92 +70,6 @@ module WelltreatStoreFramework
72
70
  )).first
73
71
  end
74
72
 
75
- class Context
76
- include Paths, Partial, TagsHelper, LoremHelper
77
73
 
78
- attr_accessor :request, :response, :options
79
-
80
- def initialize(app, request, response, options)
81
- @app = app
82
- @request = request
83
- @response = response
84
- @options = options || { }
85
- @locals = { }
86
- end
87
-
88
- def app;
89
- @app
90
- end
91
-
92
- def set_local(k, v)
93
- @locals[k] = v
94
- end
95
-
96
- def get_local(k)
97
- @locals[k]
98
- end
99
-
100
- def local_exists?(k)
101
- @locals.include?(k)
102
- end
103
-
104
- def local_present?(k)
105
- local_exists?(k) && get_local(k).present?
106
- end
107
-
108
- def session
109
- options[:session]
110
- end
111
-
112
- def notice
113
- get_flash :notice
114
- end
115
-
116
- def alert
117
- get_flash :alert
118
- end
119
-
120
- def success
121
- get_flash :success
122
- end
123
-
124
- def flash_exist?
125
- notice || alert || success
126
- end
127
-
128
- def get_flash(k)
129
- @flash_values ||= { }
130
- @flash_values[k] ||= flash[k]
131
- flash[k] = nil if @flash_values[k].present?
132
-
133
- @flash_values[k]
134
- end
135
-
136
- def set_flash(k, v)
137
- flash[k] = v
138
- end
139
-
140
- def flash
141
- options[:session][:flash] ||= { }
142
- end
143
-
144
- delegate :exists?, :present?, :set, :get, :to => :response
145
- end
146
-
147
- class UrlJoin
148
- def initialize(*_base_paths)
149
- @paths = []
150
- join(_base_paths)
151
- end
152
-
153
- def join(*_paths)
154
- @paths += _paths
155
- self
156
- end
157
-
158
- def to_s
159
- @paths.join('/')
160
- end
161
- end
162
74
  end
163
75
  end
@@ -0,0 +1,84 @@
1
+ require 'welltreat_store_framework/haml_renderer/paths'
2
+ require 'welltreat_store_framework/haml_renderer/partial'
3
+ require 'welltreat_store_framework/haml_renderer/tags_helper'
4
+ require 'welltreat_store_framework/haml_renderer/lorem_helper'
5
+
6
+ module WelltreatStoreFramework
7
+ module HamlRenderer
8
+ class Context
9
+ include Paths, Partial, TagsHelper, LoremHelper
10
+
11
+ # Include Recaptcha helpers if it's provided
12
+ include Rack::Recaptcha::Helpers if defined?(Rack::Recaptcha::Helpers)
13
+
14
+ attr_accessor :request, :response, :options
15
+
16
+ def initialize(app, request, response, options)
17
+ @app = app
18
+ @request = request
19
+ @response = response
20
+ @options = options || { }
21
+ @locals = { }
22
+ end
23
+
24
+ def app;
25
+ @app
26
+ end
27
+
28
+ def set_local(k, v)
29
+ @locals[k] = v
30
+ end
31
+
32
+ def get_local(k)
33
+ @locals[k]
34
+ end
35
+
36
+ def local_exists?(k)
37
+ @locals.include?(k)
38
+ end
39
+
40
+ def local_present?(k)
41
+ local_exists?(k) && get_local(k).present?
42
+ end
43
+
44
+ def session
45
+ options[:session]
46
+ end
47
+
48
+ def notice
49
+ get_flash :notice
50
+ end
51
+
52
+ def alert
53
+ get_flash :alert
54
+ end
55
+
56
+ def success
57
+ get_flash :success
58
+ end
59
+
60
+ def flash_exist?
61
+ notice || alert || success
62
+ end
63
+
64
+ def get_flash(k)
65
+ @flash_values ||= { }
66
+ @flash_values[k] ||= flash[k]
67
+ flash[k] = nil if @flash_values[k].present?
68
+
69
+ @flash_values[k]
70
+ end
71
+
72
+ def set_flash(k, v)
73
+ flash[k] = v
74
+ end
75
+
76
+ def flash
77
+ options[:session][:flash] ||= { }
78
+ end
79
+
80
+ delegate :exists?, :present?, :set, :get, :to => :response
81
+ end
82
+
83
+ end
84
+ end
@@ -13,7 +13,7 @@ module WelltreatStoreFramework
13
13
  elsif sprockets_enabled?
14
14
  asset_path _path
15
15
  else
16
- asset_path 'images', _path
16
+ asset_path app.name, _path
17
17
  end
18
18
  end
19
19
 
@@ -26,7 +26,7 @@ module WelltreatStoreFramework
26
26
  elsif sprockets_enabled?
27
27
  asset_path _path
28
28
  else
29
- asset_path 'stylesheets', _path
29
+ asset_path app.name, _path
30
30
  end
31
31
  end
32
32
 
@@ -39,7 +39,7 @@ module WelltreatStoreFramework
39
39
  elsif sprockets_enabled?
40
40
  asset_path _path
41
41
  else
42
- asset_path 'javascripts', _path
42
+ asset_path app.name, _path
43
43
  end
44
44
  end
45
45
 
@@ -0,0 +1,19 @@
1
+ module WelltreatStoreFramework
2
+ module HamlRenderer
3
+ class UrlJoin
4
+ def initialize(*_base_paths)
5
+ @paths = []
6
+ join(_base_paths)
7
+ end
8
+
9
+ def join(*_paths)
10
+ @paths += _paths
11
+ self
12
+ end
13
+
14
+ def to_s
15
+ @paths.join('/')
16
+ end
17
+ end
18
+ end
19
+ end
@@ -244,11 +244,11 @@ module WelltreatStoreFramework
244
244
  CODE
245
245
 
246
246
  AppStack.generate_partition_object_getter(self, [base_const::Models])
247
+ self.started = true
247
248
 
248
249
  base_const
249
250
  end
250
251
 
251
-
252
252
  # Provide utilities for bootstrapping new app stack
253
253
  class AppStack
254
254
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: welltreat-store-framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,52 +9,19 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-23 00:00:00.000000000 Z
12
+ date: 2012-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jeweler
16
- requirement: &2161426880 !ruby/object:Gem::Requirement
16
+ requirement: &2153993660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
- type: :runtime
22
+ type: :development
23
23
  prerelease: false
24
- version_requirements: *2161426880
25
- - !ruby/object:Gem::Dependency
26
- name: activesupport
27
- requirement: &2161426340 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ~>
31
- - !ruby/object:Gem::Version
32
- version: 3.2.0
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *2161426340
36
- - !ruby/object:Gem::Dependency
37
- name: haml
38
- requirement: &2161425620 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
44
- type: :runtime
45
- prerelease: false
46
- version_requirements: *2161425620
47
- - !ruby/object:Gem::Dependency
48
- name: flexi_model
49
- requirement: &2161423420 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: *2161423420
24
+ version_requirements: *2153993660
58
25
  description: WellTreat Store Framework
59
26
  email:
60
27
  - hasan83bd@gmail.com
@@ -74,10 +41,12 @@ files:
74
41
  - lib/welltreat_store_framework/controller.rb
75
42
  - lib/welltreat_store_framework/core.rb
76
43
  - lib/welltreat_store_framework/haml_renderer.rb
44
+ - lib/welltreat_store_framework/haml_renderer/context.rb
77
45
  - lib/welltreat_store_framework/haml_renderer/lorem_helper.rb
78
46
  - lib/welltreat_store_framework/haml_renderer/partial.rb
79
47
  - lib/welltreat_store_framework/haml_renderer/paths.rb
80
48
  - lib/welltreat_store_framework/haml_renderer/tags_helper.rb
49
+ - lib/welltreat_store_framework/haml_renderer/url_join.rb
81
50
  - lib/welltreat_store_framework/rack_server.rb
82
51
  - lib/welltreat_store_framework/store_app.rb
83
52
  - sample/hello-store/assets/javascripts/app.js