snails 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d235bda86922e62754528a0d8ebd0e875266c8101d162bed2d2791b30bbc76a7
4
- data.tar.gz: ebffe464327f0bf09cff4cfdd5736ab9d3f8ed8866d8baa49bf77c74bf9c2870
3
+ metadata.gz: 5bd58d0b9693a06138e4c59111c6549648cedd24187bf8edaf751c2d9631824f
4
+ data.tar.gz: b80ef3591f34a1ac4e8e0180192e3721025a9223f82ce92832cd515dcc49a3a9
5
5
  SHA512:
6
- metadata.gz: 1085f36ee8bd4dd653635407ed22d7a5276d6203ae01da4df9066039f77e9a916f6978b9677d1b4f8357f8291976d4b6e29ef0c79e5b8d44aea0aa98e261b09f
7
- data.tar.gz: 2a7ac9e077c693a152af80d46f52bd1292a901f9299890490248b1208e44a4c8c70c526f34c3d0b3b6f618c4d2c4186d84b7915147509379092de2c9248f5502
6
+ metadata.gz: 0e6497eed09aa83b446ff727d9590418a8a9963cb75cfa85db83671360c3526b49d0adc70817325b44147932578416adaa6faf8a03e4bb44c1d71373afb94adb
7
+ data.tar.gz: 7d77f6f64280dba88e152dc56f9c41569df7a75fbb95ca37d6a6be68670d0e6a117f4d3ac2efae5a662c7924271ab95e111a6068d046d748e0dffe93a0e4d628
data/.gitignore CHANGED
@@ -4,3 +4,5 @@ test
4
4
  example/Gemfile.lock
5
5
  *.sh
6
6
  .ruby-version
7
+ Gemfile.lock
8
+ example/.irb-history
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec # specified in gemspec
data/example/app.rb CHANGED
@@ -1,6 +1,4 @@
1
- require 'bundler/setup'
2
- require 'snails'
3
- require 'snails/mailer'
1
+ require './boot'
4
2
 
5
3
  class MyApp < Snails::App
6
4
 
data/example/app2.rb CHANGED
@@ -1,6 +1,4 @@
1
- require 'bundler/setup'
2
- require 'snails'
3
- require 'snails/mailer'
1
+ require './boot'
4
2
 
5
3
  class MyOtherApp < Snails::App
6
4
 
data/example/boot.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler/setup'
2
+ require 'snails'
3
+ require 'snails/mailer'
4
+ require 'securerandom'
5
+
6
+ SESSION_SECRET = SecureRandom.hex(32) # generates a new session cookie on each login
7
+ MAIN_DOMAIN = 'app.localhost'
data/example/config.ru CHANGED
@@ -1,7 +1,3 @@
1
- require 'securerandom'
2
- SESSION_SECRET = SecureRandom.hex(32) # generates a new session cookie on each login
3
- MAIN_DOMAIN = 'app.localhost'
4
-
5
1
  require './app'
6
2
  require './app2'
7
3
 
data/lib/snails/app.rb CHANGED
@@ -107,7 +107,6 @@ module Snails
107
107
  app.set :assets_precompile, app.setting(:assets_precompile, %w(js/main.js css/main.css))
108
108
  app.set :assets_remove_digests, app.setting(:assets_remove_digests, false)
109
109
 
110
-
111
110
  app.configure do
112
111
  app.assets_paths.each do |path|
113
112
  app.sprockets.append_path cwd.join(path)
@@ -348,9 +347,17 @@ module Snails
348
347
 
349
348
  def partial(name, opts = {})
350
349
  partial_name = name.to_s["/"] ? name.to_s.reverse.sub("/", "_/").reverse : "_#{name}"
351
- erb(partial_name.to_sym, { layout: false }.merge(opts))
350
+ locals = opts.delete(:locals) || {}
351
+ erb(partial_name.to_sym, { layout: false }.merge(opts), locals)
352
352
  end
353
353
 
354
+ # Possible render options are:
355
+ # :content_type The content type to use, same arguments as content_type.
356
+ # :layout If set to something falsy, no layout is rendered, otherwise the specified layout is used (Ignored for sass)
357
+ # :layout_engine Engine to use for rendering the layout. :locals A hash with local variables that should be available in the template
358
+ # :scope If set, template is evaluate with the binding of the given object rather than the application instance.
359
+ # :views Views directory to use.
360
+
354
361
  def view(view_name, opts = {})
355
362
  layout = request.xhr? ? false : true
356
363
  erb(view_name.to_sym, { layout: layout }.merge(opts))
@@ -398,6 +405,9 @@ module Snails
398
405
  path: app.setting(:session_path, '/'),
399
406
  domain: app.setting(:session_domain, nil),
400
407
  expire_after: app.setting(:session_expire_after, 2592000), # one month in seconds
408
+ same_site: app.setting(:session_same_site, false),
409
+ http_only: app.setting(:session_http_only, nil),
410
+ secure: app.setting(:session_secure, false),
401
411
  secret: app.session_secret # uses previous set :session_secret or generates one
402
412
  }
403
413
 
data/lib/snails/mailer.rb CHANGED
@@ -2,6 +2,7 @@ require 'snails/util'
2
2
  require 'erb'
3
3
  require 'tilt/erb'
4
4
  require 'snails'
5
+ require 'stringio'
5
6
 
6
7
  module Snails
7
8
 
@@ -169,8 +170,6 @@ A <%= @exception.class %> occurred in <%= @url %>:
169
170
  def initialize(config = {})
170
171
  @debug = config[:debug]
171
172
 
172
- puts "-- #{config.inspect}"
173
-
174
173
  if key = config.dig(:dkim, :private_key) and File.exist?(key)
175
174
  config[:dkim][:private_key] = IO.read(key)
176
175
  elsif config[:dkim]
data/lib/snails.rb CHANGED
@@ -7,6 +7,7 @@ module Snails
7
7
 
8
8
  def initialize(str); @str = str.to_s.freeze; end
9
9
  def to_s; @str; end
10
+ def to_sym; @str.to_sym; end
10
11
  def <=>(str); @str <=> str.to_s; end
11
12
  def inspect; @str.inspect; end
12
13
 
data/snails.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "snails"
6
- s.version = '0.8.1'
6
+ s.version = '0.9.0'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Tomás Pollak']
9
9
  s.email = ['tomas@forkhq.com']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomás Pollak
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-22 00:00:00.000000000 Z
11
+ date: 2024-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,6 +156,7 @@ files:
156
156
  - example/Rakefile
157
157
  - example/app.rb
158
158
  - example/app2.rb
159
+ - example/boot.rb
159
160
  - example/config.ru
160
161
  - lib/snails.rb
161
162
  - lib/snails/app.rb
@@ -167,10 +168,10 @@ files:
167
168
  - lib/snails/util.rb
168
169
  - snails.gemspec
169
170
  - spec/app_spec.rb
170
- homepage:
171
+ homepage:
171
172
  licenses: []
172
173
  metadata: {}
173
- post_install_message:
174
+ post_install_message:
174
175
  rdoc_options: []
175
176
  require_paths:
176
177
  - lib
@@ -185,8 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  - !ruby/object:Gem::Version
186
187
  version: 1.3.6
187
188
  requirements: []
188
- rubygems_version: 3.4.10
189
- signing_key:
189
+ rubygems_version: 3.5.3
190
+ signing_key:
190
191
  specification_version: 4
191
192
  summary: Ruby on Snails.
192
193
  test_files: []