boltless 2.0.0 → 2.1.0
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.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/lib/boltless/configuration.rb +40 -2
- data/lib/boltless/version.rb +1 -1
- data/lib/boltless.rb +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8b7c4416097390006b201dcec4ce9beaa8190659d079da12af5e01689670aff
|
|
4
|
+
data.tar.gz: 434205668e628cb4b0d12a1451a83dac804cea38c1a045f3982f8157e9e25873
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d20881d61af51e69287d45b36358c8bd35f2709e16b43439b598c542fe92a09f33a182260a2cc19360ddf3586f6c918e79957d1bb3b20b3eb5dafedfdd12273a
|
|
7
|
+
data.tar.gz: 163eb7a5a639a046a2801ecc002772c0eac9f0b6fe9113f9c35c0271cf41e3aee75137fd17d3c6278957caa67a29e1919e0fd7fcdfac6feb5a4939b65ddf1b59
|
data/Gemfile
CHANGED
|
@@ -9,9 +9,10 @@ gemspec
|
|
|
9
9
|
|
|
10
10
|
# Development dependencies
|
|
11
11
|
gem 'appraisal', '~> 2.4'
|
|
12
|
+
gem 'benchmark', '>= 0.5'
|
|
12
13
|
gem 'benchmark-ips', '~> 2.10'
|
|
13
14
|
gem 'bundler', '~> 2.6'
|
|
14
|
-
gem 'countless', '~> 2.
|
|
15
|
+
gem 'countless', '~> 2.2'
|
|
15
16
|
gem 'guard-rspec', '~> 4.7'
|
|
16
17
|
gem 'irb', '~> 1.2'
|
|
17
18
|
gem 'rspec', '~> 3.12'
|
|
@@ -2,8 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
module Boltless
|
|
4
4
|
# The configuration for the Boltless gem.
|
|
5
|
-
class Configuration
|
|
6
|
-
|
|
5
|
+
class Configuration < ActiveSupport::OrderedOptions
|
|
6
|
+
# Track our configurations settings (+Symbol+ keys) and their defaults as
|
|
7
|
+
# lazy-loaded +Proc+'s values
|
|
8
|
+
class_attribute :defaults,
|
|
9
|
+
instance_reader: true,
|
|
10
|
+
instance_writer: false,
|
|
11
|
+
instance_predicate: false,
|
|
12
|
+
default: {}
|
|
13
|
+
|
|
14
|
+
# Create a new +Configuration+ instance with all settings populated with
|
|
15
|
+
# their respective defaults.
|
|
16
|
+
#
|
|
17
|
+
# @param args [Hash{Symbol => Mixed}] additional settings which
|
|
18
|
+
# overwrite the defaults
|
|
19
|
+
# @return [Configuration] the new configuration instance
|
|
20
|
+
def initialize(**args)
|
|
21
|
+
super()
|
|
22
|
+
defaults.each { |key, default| self[key] = instance_exec(&default) }
|
|
23
|
+
merge!(**args)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# A simple DSL method to define new configuration accessors/settings with
|
|
27
|
+
# their defaults. The defaults can be retrieved with
|
|
28
|
+
# +Configuration.defaults+ or +Configuration.new.defaults+.
|
|
29
|
+
#
|
|
30
|
+
# @param name [Symbol, String] the name of the configuration
|
|
31
|
+
# accessor/setting
|
|
32
|
+
# @param default [Mixed, nil] a non-lazy-loaded static value, serving as a
|
|
33
|
+
# default value for the setting
|
|
34
|
+
# @param block [Proc] when given, the default value will be lazy-loaded
|
|
35
|
+
# (result of the Proc)
|
|
36
|
+
def self.config_accessor(name, default = nil, &block)
|
|
37
|
+
# Save the given configuration accessor default value
|
|
38
|
+
defaults[name.to_sym] = block || -> { default }
|
|
39
|
+
|
|
40
|
+
# Compile reader/writer methods so we don't have to go through
|
|
41
|
+
# +ActiveSupport::OrderedOptions#method_missing+.
|
|
42
|
+
define_method(name) { self[name] }
|
|
43
|
+
define_method("#{name}=") { |value| self[name] = value }
|
|
44
|
+
end
|
|
7
45
|
|
|
8
46
|
# The base URL of the neo4j HTTP API (port 7474 for HTTP, port 7473
|
|
9
47
|
# for HTTPS when configured at server side)
|
data/lib/boltless/version.rb
CHANGED
data/lib/boltless.rb
CHANGED
|
@@ -10,6 +10,8 @@ require 'colorize'
|
|
|
10
10
|
require 'logger'
|
|
11
11
|
require 'active_support'
|
|
12
12
|
require 'active_support/concern'
|
|
13
|
+
require 'active_support/ordered_options'
|
|
14
|
+
require 'active_support/core_ext/class/attribute'
|
|
13
15
|
require 'active_support/core_ext/module/delegation'
|
|
14
16
|
require 'active_support/core_ext/numeric/time'
|
|
15
17
|
require 'active_support/core_ext/enumerable'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: boltless
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hermann Mayer
|
|
@@ -27,16 +27,16 @@ dependencies:
|
|
|
27
27
|
name: base64
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- - "
|
|
30
|
+
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.
|
|
32
|
+
version: '0.3'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - "
|
|
37
|
+
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.
|
|
39
|
+
version: '0.3'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: colorize
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|