ramaze 2012.12.08b → 2023.01.06

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/README.md +1 -0
  4. data/examples/app/whywiki/spec/whywiki.rb +22 -24
  5. data/examples/app/whywiki/start.rb +10 -9
  6. data/examples/app/whywiki/{template → view}/edit.xhtml +2 -2
  7. data/examples/app/whywiki/view/show.xhtml +20 -0
  8. data/examples/app/wikore/spec/wikore.rb +1 -1
  9. data/guide/AUTHORS +11 -3
  10. data/guide/CHANGELOG +3803 -3592
  11. data/guide/general/sessions.md +42 -0
  12. data/guide/general/upgrading.md +85 -0
  13. data/lib/proto/Gemfile +2 -2
  14. data/lib/ramaze/cache/memcache.rb +3 -3
  15. data/lib/ramaze/cache/moneta.rb +143 -0
  16. data/lib/ramaze/cache/redis.rb +8 -11
  17. data/lib/ramaze/cache/sequel.rb +2 -2
  18. data/lib/ramaze/cache.rb +1 -0
  19. data/lib/ramaze/files.rb +1 -1
  20. data/lib/ramaze/helper/paginate.rb +5 -0
  21. data/lib/ramaze/helper/request_accessor.rb +3 -1
  22. data/lib/ramaze/helper/stack.rb +1 -1
  23. data/lib/ramaze/helper/upload.rb +1 -1
  24. data/lib/ramaze/log/syslog.rb +1 -1
  25. data/lib/ramaze/request.rb +2 -2
  26. data/lib/ramaze/snippets.rb +0 -1
  27. data/lib/ramaze/version.rb +3 -1
  28. data/lib/ramaze/view/nagoro/render_partial.rb +1 -1
  29. data/lib/ramaze.rb +1 -1
  30. data/ramaze.gemspec +19 -15
  31. data/spec/ramaze/cache/moneta.rb +53 -0
  32. data/spec/ramaze/cache/redis.rb +1 -1
  33. data/spec/ramaze/cache/sequel.rb +2 -0
  34. data/spec/ramaze/dispatcher/directory.rb +24 -14
  35. data/spec/ramaze/dispatcher/file.rb +0 -5
  36. data/spec/ramaze/error.rb +13 -17
  37. data/spec/ramaze/helper/paginate.rb +41 -13
  38. data/spec/ramaze/log/syslog.rb +75 -63
  39. data/spec/ramaze/session/redis.rb +2 -2
  40. data/spec/ramaze/session/sequel.rb +2 -0
  41. data/spec/ramaze/view/haml.rb +3 -3
  42. data/spec/ramaze/view/slim.rb +1 -1
  43. metadata +95 -164
  44. data/.gems +0 -28
  45. data/.gitignore +0 -14
  46. data/.mailmap +0 -34
  47. data/.rvmrc +0 -2
  48. data/.travis.yml +0 -16
  49. data/.yardopts +0 -14
  50. data/examples/app/blog/public/.htaccess +0 -24
  51. data/examples/app/whywiki/template/show.xhtml +0 -18
  52. data/lib/ramaze/cache/localmemcache.rb +0 -53
  53. data/lib/ramaze/snippets/ramaze/lru_hash.rb +0 -247
  54. data/spec/ramaze/cache/localmemcache.rb +0 -50
  55. data/spec/ramaze/session/localmemcache.rb +0 -58
@@ -138,6 +138,12 @@ To make it easier to display flash based messages you can use
138
138
  {Ramaze::Helper::Flash#flashbox}. You can load this helper by calling
139
139
  ``helper(:flash)`` inside your controller.
140
140
 
141
+ Displaying the flashbox is then as simple as :
142
+
143
+ #{flashbox}
144
+
145
+ anywhere in your layouts or views.
146
+
141
147
  To change the markup of the flashbox' HTML you can use the following trait
142
148
  inside your controller:
143
149
 
@@ -166,3 +172,39 @@ displayed because the flash data isn't there yet. As soon as the client visits
166
172
  "Hello, Ramaze!" would be displayed. Refreshing the page would clear the flash
167
173
  data and the message would no longer be displayed until the client visits
168
174
  /set\_message again.
175
+
176
+ In the above example, the content of the flash is returned by a method in the
177
+ controller. However, the most common scenario is to address the flash object
178
+ directly in the layouts or viems. You can display flash data (in your
179
+ layout for instance), just like any other variable :
180
+
181
+ #{flash[:message]}
182
+
183
+ and you can use any key in flash, and display in a view or in a layout
184
+ afterwards (no just :message of course).
185
+
186
+ For instance, let's say you want to display information boxes at the top of your
187
+ layout page. This information is displayed when an operation succeeds, fails, or
188
+ when you just want to inform the user. You can easily take advantage of your key
189
+ values and use them as css selectors like that :
190
+
191
+ ....
192
+ <div>
193
+ <!-- flash -->
194
+ <?r [:success, :error, :info].each do |type| ?>
195
+ <?r if flash[type] ?>
196
+
197
+ <div class="alert alert-block alert-#{type} fade in">
198
+ <a class="close" data-dismiss="alert" href="#">×</a>
199
+ <h4 class="alert-heading">#{ type.capitalize }</h4>
200
+ #{flash[type]}
201
+ </div>
202
+
203
+ <?r end ?>
204
+ <?r end ?>
205
+
206
+ #{@content}
207
+
208
+ </div>
209
+ ...
210
+
@@ -0,0 +1,85 @@
1
+ # @title Upgrading
2
+ # Upgrading
3
+
4
+ Ramaze strives to be backwards compatible between each release. However, some
5
+ releases may contain changes that are *not* backwards compatible. This document
6
+ describes the steps required to upgrade between these releases.
7
+
8
+ ## Upgrading to Ramaze 2012.12.08
9
+
10
+ Ramaze 2012.12.08 is **not** backwards compatible with previous releases due
11
+ to changes made in Innate 2012.12.
12
+
13
+ ### Middleware
14
+
15
+ In previous versions one could add Rack middleware using `Ramaze.middleware!`.
16
+ This method has been renamed to `Ramaze.middleware` (without the `!`) and its
17
+ use has been changed. Instead of calling `run Ramaze.middleware` one now has to
18
+ use `run Ramaze.core`.
19
+
20
+ An example of the old way of defining middleware:
21
+
22
+ Ramaze.middleware! :dev do |m|
23
+ m.use Rack::Lint
24
+ m.run Ramaze.middleware
25
+ end
26
+
27
+ The new way of defining middleware:
28
+
29
+ Ramaze.middleware :dev do
30
+ use Rack::Lint
31
+ run Ramaze.core
32
+ end
33
+
34
+ ### Commands
35
+
36
+ Various executable commands such as `ramaze start` and `ramaze console` have
37
+ been removed in favour of the use of Rake tasks. For existing projects that do
38
+ not have these Rake tasks you'll have to import them manually, new projects
39
+ will have these tasks automatically. These tasks are located [here][rake
40
+ tasks].
41
+
42
+ These commands were removed as they contained a lot of old and rotting code
43
+ without any tests. Some of them, such as `ramaze start` weren't very useful
44
+ either as most people will use the commands for their webservers (e.g. Thin)
45
+ instead. The use of Rake tasks also makes it possible for people to customize
46
+ these to their liking.
47
+
48
+ ### Snippets
49
+
50
+ Ramaze ships with various snippets that extend various core Ruby classes. In
51
+ Ramaze 2012.12.08 a lot of these snippets have been removed. A list of all the
52
+ removed snippets can be found [here][removed snippets].
53
+
54
+ ### Loggers
55
+
56
+ The following logging classes are no longer available:
57
+
58
+ * Ramaze::Logger::Growl
59
+ * Ramaze::Logger::Analogger
60
+ * Ramaze::Logger::Knotify
61
+ * Ramaze::Logger::Xosd
62
+
63
+ ### Helpers
64
+
65
+ The following helpers have been removed:
66
+
67
+ * Ramaze::Helper::Disqus
68
+ * Ramaze::Helper::Ultraviolet
69
+
70
+ ### Core classes
71
+
72
+ The following core classes have been removed:
73
+
74
+ * Ramaze::AppGraph
75
+ * Ramaze::Plugin
76
+ * Ramaze::MiddlewareCompiler (alias of Innate::MiddlewareCompiler)
77
+
78
+ ### Prototypes
79
+
80
+ The prototype generated by `ramaze create` has been changed. It contains a set
81
+ of Rake tasks, a README, a Gemfile and some other small changes compared to the
82
+ previous prototype. Existing projects are not affected.
83
+
84
+ [rake tasks]: https://github.com/Ramaze/ramaze/blob/master/lib/proto/task/ramaze.rake
85
+ [removed snippets]: https://github.com/Ramaze/ramaze/commit/7e966dcdec50d490eb828f7673f101b1a6b087b3
data/lib/proto/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'ramaze', '>= 2.0.0'
3
+ gem 'ramaze'
4
4
  gem 'rake'
@@ -10,7 +10,7 @@ module Ramaze
10
10
  ##
11
11
  # Cache driver for the Memcache storage engine. Memcache is a key/value
12
12
  # store that's extremely useful for caching data such as views or API
13
- # responses. More inforamtion about Memcache can be found on it's website:
13
+ # responses. More information about Memcache can be found on it's website:
14
14
  # <http://memcached.org/>.
15
15
  #
16
16
  # Note that this cache driver requires the Dalli gem rather than Memcache
@@ -21,7 +21,7 @@ module Ramaze
21
21
  # operate but you won't get the nice speed boost.
22
22
  #
23
23
  # This driver works similar to Ramaze::Cache::Sequel in that it allows you
24
- # to specify instance specific options uisng the using() method:
24
+ # to specify instance specific options using the using() method:
25
25
  #
26
26
  # Ramaze::Cache.options.session = Ramaze::Cache::MemCache.using(
27
27
  # :compression => false
@@ -203,7 +203,7 @@ module Ramaze
203
203
  # specified key.
204
204
  # @return [Mixed]
205
205
  #
206
- def cache_store(key, value, ttl = nil, options = {})
206
+ def cache_store(key, value, options = {})
207
207
  ttl = options.delete(:ttl) || @options[:expires_in]
208
208
 
209
209
  if ttl > MAX_TTL
@@ -0,0 +1,143 @@
1
+ require 'moneta'
2
+
3
+ module Ramaze
4
+ class Cache
5
+ ##
6
+ # The Moneta cache is a cache driver for Moneta (http://github.com/minad/moneta). Moneta is a
7
+ # unified interface to key/value stores.
8
+ #
9
+ # The usage of this cache is very similar to the Memcache driver. You load
10
+ # it by simply specifying the class:
11
+ #
12
+ # Ramaze::Cache.options.session = Ramaze::Cache::Moneta
13
+ #
14
+ # If you want to specify custom options you can do so by calling {.using} on
15
+ # the class:
16
+ #
17
+ # Ramaze::Cache.options.session = Ramaze::Cache::Moneta.using(...)
18
+ #
19
+ # @example Configuring the Moneta backend
20
+ # Ramaze::Cache.options.names.push(:moneta)
21
+ # Ramaze::Cache.options.moneta = Ramaze::Cache::Moneta.using(
22
+ # :adapter => :File,
23
+ # :dir => './ramaze-cache'
24
+ # )
25
+ #
26
+ # @author Daniel Mendler
27
+ #
28
+ class Moneta
29
+ include Cache::API
30
+ include Innate::Traited
31
+
32
+ # Hash containing all the default options to use when no custom ones are
33
+ # specified in .using().
34
+ trait :default => {
35
+ :expires_in => 604800,
36
+ :adapter => :Memory,
37
+ }
38
+
39
+ # Hash containing all the default options merged with the user specified
40
+ # ones.
41
+ attr_accessor :options
42
+
43
+ class << self
44
+ attr_accessor :options
45
+
46
+ ##
47
+ # Creates a new instance of the cache class and merges the default
48
+ # options with the custom ones.
49
+ #
50
+ # Using this method you can specify custom options for various caches.
51
+ # For example, the Moneta cache for your sessions could be located at
52
+ # server #1 while a custom cache is located on server #2.
53
+ #
54
+ # @author Daniel Mendler
55
+ # @param [Hash] options A hash containing custom options.
56
+ # @option options [Fixnum] :expires_in The default time after which a
57
+ # key should expire.
58
+ # @option options [Symbol] :adapter Moneta adapter
59
+ #
60
+ def using(options = {})
61
+ merged = Ramaze::Cache::Moneta.trait[:default].merge(options)
62
+ Class.new(self) { @options = merged }
63
+ end
64
+ end # class << self
65
+
66
+ ##
67
+ # Creates a new instance of the cache and merges the options if they
68
+ # haven't already been set.
69
+ #
70
+ # @author Daniel Mendler
71
+ # @param [Hash] options A hash with custom options. See
72
+ # Ramaze::Cache::Moneta.using() and the trait :default for more
73
+ # information.
74
+ #
75
+ def initialize(options = {})
76
+ self.class.options ||=
77
+ Ramaze::Cache::Moneta.trait[:default].merge(options)
78
+
79
+ @options = options.merge(self.class.options)
80
+ end
81
+
82
+ ##
83
+ # Prepares the cache by setting up the prefix and loading Moneta.
84
+ #
85
+ # @author Daniel Mendler
86
+ #
87
+ def cache_setup(*args)
88
+ opts = options.dup
89
+ opts[:prefix] = ['ramaze', *args].compact.join(':')
90
+ opts[:expires] = opts.delete(:expires_in)
91
+ adapter = opts.delete(:adapter)
92
+ @moneta = ::Moneta.new(adapter, options)
93
+ end
94
+
95
+ ##
96
+ # Clears the entire cache.
97
+ #
98
+ # @author Daniel Mendler
99
+ #
100
+ def cache_clear
101
+ @moneta.clear
102
+ end
103
+
104
+ ##
105
+ # Removes a number of keys from the cache.
106
+ #
107
+ # @author Daniel Mendler
108
+ # @param [Array] keys An array of key names to remove.
109
+ #
110
+ def cache_delete(*keys)
111
+ keys.each {|key| @moneta.delete(key) }
112
+ end
113
+
114
+ ##
115
+ # Retrieves the value of the given key. If no value could be retrieved the
116
+ # default value (set to nil by default) will be returned instead.
117
+ #
118
+ # @author Daniel Mendler
119
+ # @param [String] key The name of the key to retrieve.
120
+ # @param [Mixed] default The default value.
121
+ # @return [Mixed]
122
+ #
123
+ def cache_fetch(key, default = nil)
124
+ @moneta.fetch(key, default)
125
+ end
126
+
127
+ ##
128
+ # Stores a new value under the given key.
129
+ #
130
+ # @author Daniel Mendler
131
+ # @param [String] key The name of the key to store.
132
+ # @param [Mixed] value The value of the key.
133
+ # @param [Fixnum] ttl The Time To Live of the key.
134
+ # @param [Hash] options A hash containing key specific options.
135
+ # @option options :expires_in The time after which the key should expire.
136
+ #
137
+ def cache_store(key, value, options = {})
138
+ options[:expires] = options.delete(:ttl) || @options[:expires_in]
139
+ @moneta.store(key, value, options)
140
+ end
141
+ end # Moneta
142
+ end # Cache
143
+ end # Ramaze
@@ -1,4 +1,4 @@
1
- require 'redis'
1
+ require 'redis-namespace'
2
2
 
3
3
  module Ramaze
4
4
  class Cache
@@ -102,8 +102,8 @@ module Ramaze
102
102
  options[:namespace] = [
103
103
  'ramaze', hostname, username, appname, cachename
104
104
  ].compact.join(':')
105
-
106
- @client = ::Redis.new(options)
105
+ redis_connection = ::Redis.new
106
+ @client = ::Redis::Namespace.new(options[:namespace], redis: redis_connection)
107
107
  end
108
108
 
109
109
  ##
@@ -123,7 +123,7 @@ module Ramaze
123
123
  # @param [Array] keys An array of key names to remove.
124
124
  #
125
125
  def cache_delete(*keys)
126
- @client.del(*keys.map{|key| namespaced_key(key) })
126
+ @client.del(*keys)
127
127
  end
128
128
 
129
129
  ##
@@ -136,7 +136,7 @@ module Ramaze
136
136
  # @return [Mixed]
137
137
  #
138
138
  def cache_fetch(key, default = nil)
139
- value = @client.get(namespaced_key(key))
139
+ value = @client.get(key)
140
140
  value.nil? ? default : ::Marshal.load(value)
141
141
  end
142
142
 
@@ -150,17 +150,14 @@ module Ramaze
150
150
  # @param [Hash] options A hash containing key specific options.
151
151
  # @option options :expires_in The time after which the key should expire.
152
152
  #
153
- def cache_store(key, value, ttl = nil, options = {})
153
+ def cache_store(key, value, options = {})
154
154
  ttl = options[:ttl] || @options[:expires_in]
155
155
 
156
- @client.setex(namespaced_key(key), ttl, ::Marshal.dump(value))
156
+ @client.setex(key, ttl, ::Marshal.dump(value))
157
157
 
158
158
  return value
159
159
  end
160
-
161
- def namespaced_key(key)
162
- [options[:namespace], key].join(':')
163
- end
160
+
164
161
  end # Redis
165
162
  end # Cache
166
163
  end # Ramaze
@@ -108,13 +108,13 @@ module Ramaze
108
108
  # should be set to an integer representing the number of seconds before
109
109
  # a cache item becomes invalidated.
110
110
  # @option options [TrueClass] :display_warnings When this option is set
111
- # to true, failure to serialiaze or deserialize cache items will produce
111
+ # to true, failure to serialize or de-serialize cache items will produce
112
112
  # a warning in the Ramaze log. This option is set to false by default.
113
113
  # Please note that certain objects (for instance Procs) cannot be
114
114
  # serialized by ruby and therefore cannot be cached by this cache class.
115
115
  # Setting this option to true is a good way to find out if the stuff you
116
116
  # are trying to cache is affected by this. Failure to
117
- # serialize/deserialize a cache item will never raise an exception, the
117
+ # serialize/de-serialize a cache item will never raise an exception, the
118
118
  # item will just remain uncached.
119
119
  # @return [Object]
120
120
  #
data/lib/ramaze/cache.rb CHANGED
@@ -12,6 +12,7 @@ module Ramaze
12
12
  autoload :MemCache, 'ramaze/cache/memcache'
13
13
  autoload :Sequel, 'ramaze/cache/sequel'
14
14
  autoload :Redis, 'ramaze/cache/redis'
15
+ autoload :Moneta, 'ramaze/cache/moneta'
15
16
 
16
17
  ##
17
18
  # Overwrites {Innate::Cache#initialize} to make cache classes application
data/lib/ramaze/files.rb CHANGED
@@ -52,7 +52,7 @@ module Ramaze
52
52
  # @since 14-03-2009
53
53
  #
54
54
  def sync
55
- file_apps = @roots.map { |root| Rack::File.new(root) }
55
+ file_apps = @roots.map { |root| Rack::Files.new(root) }
56
56
  @cascade = Rack::Cascade.new(file_apps)
57
57
  end
58
58
  end # Files
@@ -226,6 +226,11 @@ module Ramaze
226
226
 
227
227
  action = Current.action
228
228
  params = request.params.merge(@var.to_s => n)
229
+ params.keys.each do |p|
230
+ if params[p].is_a?(Array) and not p.end_with?('[]')
231
+ params["#{p}[]"] = params.delete(p)
232
+ end
233
+ end
229
234
  hash[:href] = action.node.r(action.path, params)
230
235
 
231
236
  g.a(hash){ text }
@@ -1,12 +1,14 @@
1
+ require 'rack/request'
1
2
  module Ramaze
2
3
  module Helper
3
4
  module RequestAccessor
4
- classes = [Rack::Request, Innate::Request, Ramaze::Request]
5
+ classes = [Rack::Request, Rack::Request::Helpers, Rack::Request::Env, Innate::Request, Ramaze::Request]
5
6
  methods = classes.map { |klass|
6
7
  klass.instance_methods(false)
7
8
  }.flatten.uniq
8
9
 
9
10
  methods.each do |method|
11
+ next if method == :intialize
10
12
  if method =~ /=/
11
13
  eval("def %s(a) request.%s a; end" % [method, method])
12
14
  else
@@ -7,7 +7,7 @@ module Ramaze
7
7
  # Provides an call/answer mechanism, this is useful for example in a
8
8
  # login-system.
9
9
  #
10
- # It is basically good to redirect temporarly somewhere else without
10
+ # It is basically good to redirect temporarily somewhere else without
11
11
  # forgetting where you come from and offering a nice way to get back
12
12
  # to the last urls.
13
13
  #
@@ -2,7 +2,7 @@ module Ramaze
2
2
  module Helper
3
3
  ##
4
4
  # Helper module for handling file uploads. File uploads are mostly handled
5
- # by Rack, but this helper adds some conveniance methods for handling
5
+ # by Rack, but this helper adds some convenience methods for handling
6
6
  # and saving the uploaded files.
7
7
  #
8
8
  # @example
@@ -19,7 +19,7 @@ module Ramaze
19
19
  ALIASES = {:dev => :debug, :warn => :warning, :error => :err}
20
20
 
21
21
  ##
22
- # Open the syslog library, if it is allready open, we reopen it using the
22
+ # Open the syslog library, if it is already open, we reopen it using the
23
23
  # new argument list. The argument list is passed on to the Syslog library
24
24
  # so please check that, and man syslog for detailed information.
25
25
  #
@@ -3,7 +3,7 @@
3
3
  module Ramaze
4
4
  ##
5
5
  # The purpose of this class is to act as a simple wrapper for Rack::Request
6
- # and provide some convinient methods for our own use.
6
+ # and provide some convenient methods for our own use.
7
7
  class Request < Innate::Request
8
8
  ##
9
9
  # you can access the original @request via this method_missing,
@@ -105,7 +105,7 @@ module Ramaze
105
105
  end
106
106
  alias inspect to_s
107
107
 
108
- # Pretty prints current action with parameters, cookies and enviroment
108
+ # Pretty prints current action with parameters, cookies and environment
109
109
  # variables.
110
110
  def pretty_print(pp)
111
111
  pp.object_group(self) do
@@ -4,7 +4,6 @@
4
4
  require 'ramaze/snippets/blankslate'
5
5
  require 'ramaze/snippets/object/__dir__'
6
6
  require 'ramaze/snippets/ramaze/deprecated'
7
- require 'ramaze/snippets/ramaze/lru_hash'
8
7
  require 'ramaze/snippets/string/camel_case'
9
8
  require 'ramaze/snippets/string/color'
10
9
  require 'ramaze/snippets/string/esc'
@@ -1,3 +1,5 @@
1
1
  module Ramaze
2
- VERSION = '2012.12.08b'
2
+ VERSION = Gem::Specification.load(
3
+ File.expand_path('../../../ramaze.gemspec', __FILE__)
4
+ ).version.to_s
3
5
  end
@@ -5,7 +5,7 @@ module Nagoro
5
5
  # Pipe that transforms <render /> tags.
6
6
  #
7
7
  # the src parameter in the render tag will be used as first parameter to
8
- # render_partial, all other paramters are passed on as +variables+.
8
+ # render_partial, all other parameters are passed on as +variables+.
9
9
  #
10
10
  # Example calling render_partial('hello'):
11
11
  # <render src="hello" />
data/lib/ramaze.rb CHANGED
@@ -61,7 +61,7 @@ module Ramaze
61
61
  roots, publics = options[:roots], options[:publics]
62
62
 
63
63
  joined = roots.map { |r| publics.map { |p| File.join(r, p) } }
64
- joined = joined.flatten.map { |p| Rack::File.new(p) }
64
+ joined = joined.flatten.map { |p| Rack::Files.new(p) }
65
65
  current = Current.new(Route.new(AppMap), Rewrite.new(AppMap))
66
66
 
67
67
  return Rack::Cascade.new(joined << current, [404, 405])
data/ramaze.gemspec CHANGED
@@ -1,10 +1,6 @@
1
- require File.expand_path('../lib/ramaze/version', __FILE__)
2
-
3
- path = File.expand_path('../', __FILE__)
4
-
5
1
  Gem::Specification.new do |s|
6
2
  s.name = 'ramaze'
7
- s.version = Ramaze::VERSION
3
+ s.version = '2023.01.06'
8
4
  s.date = Time.now.strftime('%Y-%m-%d')
9
5
  s.authors = ['Michael \'manveru\' Fellinger', 'Yorick Peterse']
10
6
  s.email = ['m.fellinger@gmail.com', 'yorickpeterse@gmail.com']
@@ -13,43 +9,51 @@ Gem::Specification.new do |s|
13
9
  s.description = s.summary
14
10
 
15
11
  s.required_rubygems_version = '>= 1.3.5'
16
- s.files = `cd #{path}; git ls-files`.split("\n").sort
17
- s.has_rdoc = 'yard'
12
+ s.files = (
13
+ Dir['{bin,examples,guide,lib,spec,tasks}/**/*'] |
14
+ %w[Gemfile Rakefile README.md ramaze.gemspec]
15
+ ).sort
16
+
18
17
  s.executables = ['ramaze']
19
18
 
20
- s.add_dependency 'innate', '>= 2012.12'
19
+ s.add_dependency 'innate', '>= 2023.01.05'
21
20
  s.add_dependency 'rake'
22
21
 
23
- s.add_development_dependency 'Remarkably'
24
22
  s.add_development_dependency 'bacon'
23
+ s.add_development_dependency 'bluecloth'
25
24
  s.add_development_dependency 'dalli'
26
25
  s.add_development_dependency 'erector'
27
26
  s.add_development_dependency 'erubis'
28
27
  s.add_development_dependency 'ezamar'
29
28
  s.add_development_dependency 'haml'
30
- s.add_development_dependency 'hpricot'
31
29
  s.add_development_dependency 'liquid'
32
30
  s.add_development_dependency 'locale'
33
31
  s.add_development_dependency 'maruku'
32
+ s.add_development_dependency 'moneta'
34
33
  s.add_development_dependency 'mustache'
35
- s.add_development_dependency 'rack-contrib'
36
34
  s.add_development_dependency 'rack-test'
37
- s.add_development_dependency 'rdiscount'
38
- s.add_development_dependency 'redis'
35
+ s.add_development_dependency 'redis-namespace'
36
+ s.add_development_dependency 'Remarkably'
39
37
  s.add_development_dependency 'sass'
40
38
  s.add_development_dependency 'sequel'
41
39
  s.add_development_dependency 'slim'
42
40
  s.add_development_dependency 'slippers'
43
- s.add_development_dependency 'sqlite3'
44
41
  s.add_development_dependency 'tagz'
45
42
  s.add_development_dependency 'tenjin'
46
43
  s.add_development_dependency 'yard'
47
- s.add_development_dependency 'localmemcache'
48
44
 
49
45
  if RUBY_VERSION.to_f >= 1.9
50
46
  s.add_development_dependency 'lokar'
51
47
  end
52
48
 
49
+ # C extensions don't work reliably on jruby and Travis CI doesn't have them
50
+ # enabled.
51
+ if !RUBY_DESCRIPTION.include?('jruby')
52
+ s.add_development_dependency 'nokogiri'
53
+ s.add_development_dependency 'rdiscount'
54
+ s.add_development_dependency 'sqlite3'
55
+ end
56
+
53
57
  # Nagoro doesn't seem to work on Rbx
54
58
  if !RUBY_DESCRIPTION.include?('rubinius')
55
59
  s.add_development_dependency 'nagoro'
@@ -0,0 +1,53 @@
1
+ require File.expand_path('../../../../spec/helper', __FILE__)
2
+ spec_require 'moneta'
3
+
4
+ describe Ramaze::Cache::Moneta do
5
+ Ramaze.options.cache.names = [:one, :two]
6
+ Ramaze.options.cache.default = Ramaze::Cache::Moneta
7
+ Ramaze.setup_dependencies
8
+
9
+ cache = Ramaze::Cache.one
10
+ hello = 'Hello, World!'
11
+
12
+ should 'store without ttl' do
13
+ cache.store(:hello, hello).should == hello
14
+ end
15
+
16
+ should 'fetch' do
17
+ cache.fetch(:hello).should == hello
18
+ end
19
+
20
+ should 'delete' do
21
+ cache.delete(:hello)
22
+ cache.fetch(:hello).should == nil
23
+ end
24
+
25
+ should 'delete two key/value pairs at once' do
26
+ cache.store(:hello, hello).should == hello
27
+ cache.store(:ramaze, 'ramaze').should == 'ramaze'
28
+ cache.delete(:hello, :ramaze)
29
+ cache.fetch(:hello).should == nil
30
+ cache.fetch(:innate).should == nil
31
+ end
32
+
33
+ should 'store with ttl' do
34
+ cache.store(:hello, @hello, :ttl => 1)
35
+ cache.fetch(:hello).should == @hello
36
+ sleep 2
37
+ cache.fetch(:hello).should == nil
38
+ end
39
+
40
+ should 'clear' do
41
+ cache.store(:hello, @hello)
42
+ cache.fetch(:hello).should == @hello
43
+ cache.clear
44
+ cache.fetch(:hello).should == nil
45
+ end
46
+
47
+ should 'use a custom set of options' do
48
+ klass = Ramaze::Cache::Moneta.using(:answer => 42)
49
+
50
+ klass.options[:answer].should == 42
51
+ klass.new.options[:answer].should == 42
52
+ end
53
+ end
@@ -3,7 +3,7 @@ spec_require 'redis'
3
3
 
4
4
  spec_precondition 'redis is running' do
5
5
  cache = Redis.new
6
- cache['active'] = true
6
+ "OK" == cache.set('testkey', 'testval')
7
7
  end
8
8
 
9
9
  describe Ramaze::Cache::Redis do
@@ -2,6 +2,8 @@
2
2
  # All files in this distribution are subject to the terms of the MIT license.
3
3
 
4
4
  require File.expand_path('../../../../spec/helper', __FILE__)
5
+
6
+ spec_require 'sqlite3'
5
7
  spec_require 'sequel'
6
8
 
7
9
  DB = Sequel.sqlite(':memory:')