snails 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snails.rb +16 -8
- data/lib/snails/app.rb +11 -6
- data/lib/snails/rspec.rb +7 -0
- data/snails.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0139ffb8929e8bbf7455b932634891b49b6ce21e'
|
4
|
+
data.tar.gz: 1ee0b9696376d5ce411b8997d767aa49c98aa64c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32e8d129242be198cf7000ca15e21ee9401fe8297edaaf864f542443fda71c91d556f0983d51e96e31f1b0b8ac2bc0c150b26e175af2ffe6fa8b6d69e98c6f8b
|
7
|
+
data.tar.gz: cab0a4118662cce34ebd2b4ca4ea0ca72f10cdd7eff0aa375128b18936004ce16087928fc454fc7136c417815a39d19a457548b211c778bb4f70315d3da35757
|
data/lib/snails.rb
CHANGED
@@ -1,19 +1,27 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'pathname'
|
3
|
-
require 'active_support/string_inquirer'
|
4
3
|
|
5
4
|
module Snails
|
6
|
-
class
|
7
|
-
def
|
8
|
-
def
|
9
|
-
|
5
|
+
class Environment
|
6
|
+
def initialize(str); @str = str.to_sym; end
|
7
|
+
def to_s; @str.to_s; end
|
8
|
+
def inspect; to_s.inspect; end
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
%i(production staging development test).each do |key|
|
11
|
+
define_method("#{key}?") { @str == key }
|
12
|
+
end
|
13
|
+
|
14
|
+
alias_method :dev?, :development?
|
15
|
+
alias_method :prod?, :production?
|
16
|
+
alias_method :testing?, :test?
|
13
17
|
end
|
14
18
|
|
15
19
|
def self.env
|
16
|
-
@env ||=
|
20
|
+
@env ||= Environment.new(ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development')
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.root
|
24
|
+
@root ||= Pathname.new(Dir.pwd)
|
17
25
|
end
|
18
26
|
|
19
27
|
def self.apps
|
data/lib/snails/app.rb
CHANGED
@@ -17,7 +17,7 @@ module Snails
|
|
17
17
|
app.register Snails::Locales
|
18
18
|
app.register Snails::Assets
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
end
|
22
22
|
|
23
23
|
module Database
|
@@ -36,23 +36,28 @@ module Snails
|
|
36
36
|
|
37
37
|
module Locales
|
38
38
|
|
39
|
+
def self.load!(path, lang = nil)
|
40
|
+
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
41
|
+
I18n.load_path = Dir[File.join(path, '*.yml')]
|
42
|
+
I18n.enforce_available_locales = false
|
43
|
+
I18n.backend.load_translations
|
44
|
+
I18n.locale = lang if lang
|
45
|
+
end
|
46
|
+
|
39
47
|
def self.registered(app)
|
40
48
|
require 'i18n'
|
41
49
|
require 'i18n/backend/fallbacks'
|
42
50
|
|
43
51
|
cwd = Pathname.new(Dir.pwd)
|
44
52
|
app.set :locale, :es
|
45
|
-
app.set :locales_path, cwd.join('config', 'locales')
|
53
|
+
app.set :locales_path, app.respond_to?(:locales_path) ? app.locales_path : cwd.join('config', 'locales')
|
46
54
|
|
47
55
|
app.helpers do
|
48
56
|
def t(key); I18n.t(key); end
|
49
57
|
end
|
50
58
|
|
51
59
|
app.configure do
|
52
|
-
|
53
|
-
I18n.load_path = Dir[File.join(app.settings.locales_path, '*.yml')]
|
54
|
-
I18n.enforce_available_locales = false
|
55
|
-
I18n.backend.load_translations
|
60
|
+
Locales.load!(app.settings.locales_path)
|
56
61
|
end
|
57
62
|
|
58
63
|
app.before do
|
data/lib/snails/rspec.rb
CHANGED
@@ -18,6 +18,13 @@ RSpec.configure do |config|
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
# config.include Capybara
|
22
|
+
# config.include FactoryGirl::Syntax::Methods
|
23
|
+
# config.include RequestHelpers, type: :request
|
24
|
+
# config.include ControllerTestHelpers, type: :controller
|
25
|
+
# config.expect_with(:rspec) { |c| c.syntax = :expect }
|
26
|
+
|
27
|
+
# config.order = 'random'
|
21
28
|
config.formatter = 'Fuubar' if defined?(Fuubar)
|
22
29
|
config.color = true
|
23
30
|
config.before(:suite) { load_db! }
|
data/snails.gemspec
CHANGED
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|