danica 2.7.4 → 2.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +28 -0
- data/.gitignore +6 -1
- data/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +100 -0
- data/Dockerfile +26 -0
- data/Gemfile +2 -1
- data/Rakefile +4 -0
- data/config/rubycritc.rb +12 -0
- data/config/yardstick.rb +13 -0
- data/config/yardstick.yml +33 -0
- data/danica.gemspec +14 -7
- data/docker-compose.yml +14 -9
- data/lib/danica.rb +2 -1
- data/lib/danica/base_operations.rb +2 -0
- data/lib/danica/builder.rb +2 -0
- data/lib/danica/common.rb +5 -2
- data/lib/danica/dsl.rb +8 -6
- data/lib/danica/dsl/builder.rb +3 -1
- data/lib/danica/equation.rb +3 -3
- data/lib/danica/equation/builder.rb +2 -0
- data/lib/danica/exception.rb +3 -2
- data/lib/danica/expressable.rb +14 -8
- data/lib/danica/expression.rb +4 -2
- data/lib/danica/expression/gauss.rb +5 -5
- data/lib/danica/formatted.rb +4 -2
- data/lib/danica/function.rb +5 -3
- data/lib/danica/function/name.rb +2 -0
- data/lib/danica/operator.rb +12 -9
- data/lib/danica/operator/addition.rb +4 -3
- data/lib/danica/operator/chained.rb +4 -3
- data/lib/danica/operator/cos.rb +2 -1
- data/lib/danica/operator/division.rb +2 -1
- data/lib/danica/operator/exponential.rb +2 -1
- data/lib/danica/operator/functional.rb +3 -2
- data/lib/danica/operator/multiplication.rb +4 -2
- data/lib/danica/operator/power.rb +4 -3
- data/lib/danica/operator/sin.rb +2 -1
- data/lib/danica/operator/squared_root.rb +2 -1
- data/lib/danica/variables_holder.rb +7 -4
- data/lib/danica/variables_holder/alias_builder.rb +4 -4
- data/lib/danica/variables_holder/calculator.rb +2 -0
- data/lib/danica/variables_holder/store.rb +3 -2
- data/lib/danica/variables_holder/variables_builder.rb +2 -1
- data/lib/danica/version.rb +3 -1
- data/lib/danica/wrapper.rb +11 -9
- data/lib/danica/wrapper/constant.rb +9 -14
- data/lib/danica/wrapper/container.rb +2 -3
- data/lib/danica/wrapper/group.rb +2 -2
- data/lib/danica/wrapper/negative.rb +2 -1
- data/lib/danica/wrapper/number.rb +4 -3
- data/lib/danica/wrapper/plus_minus.rb +2 -1
- data/lib/danica/wrapper/variable.rb +10 -8
- data/scripts/check_readme.sh +6 -0
- data/scripts/rubycritic.sh +10 -0
- data/spec/integration/global/danica/formatted_spec.rb +87 -0
- data/spec/integration/global/danica/operator/addition_spec.rb +32 -0
- data/spec/integration/{multiplication_spec.rb → global/danica/operator/multiplication_spec.rb} +12 -9
- data/spec/integration/{power_spec.rb → global/danica/operator/power_spec.rb} +4 -2
- data/spec/integration/{negative_spec.rb → global/danica/wrapper/negative_spec.rb} +9 -8
- data/spec/integration/{plus_minus_spec.rb → global/danica/wrapper/plus_minus_spec.rb} +5 -4
- data/spec/integration/readme/constant_spec.rb +4 -1
- data/spec/integration/readme/danica/formatted_spec.rb +24 -0
- data/spec/integration/readme/danica_spec.rb +20 -4
- data/spec/integration/readme/equation_spec.rb +4 -2
- data/spec/integration/readme/expression_spec.rb +11 -8
- data/spec/integration/readme/function_spec.rb +11 -7
- data/spec/integration/readme/number_spec.rb +9 -8
- data/spec/integration/readme/operator_spec.rb +3 -1
- data/spec/integration/readme/variables_spec.rb +8 -6
- data/spec/lib/danica/common_spec.rb +23 -9
- data/spec/lib/danica/dsl_spec.rb +5 -2
- data/spec/lib/danica/equation_spec.rb +10 -8
- data/spec/lib/danica/expressable_spec.rb +5 -2
- data/spec/lib/danica/expression/gauss_spec.rb +6 -3
- data/spec/lib/danica/expression_spec.rb +48 -26
- data/spec/lib/danica/formatted_spec.rb +20 -14
- data/spec/lib/danica/function/name_spec.rb +3 -1
- data/spec/lib/danica/function_spec.rb +14 -10
- data/spec/lib/danica/operator/addition_spec.rb +16 -15
- data/spec/lib/danica/operator/cos_spec.rb +9 -8
- data/spec/lib/danica/operator/division_spec.rb +18 -17
- data/spec/lib/danica/operator/exponential_spec.rb +9 -8
- data/spec/lib/danica/operator/multiplication_spec.rb +16 -15
- data/spec/lib/danica/operator/power_spec.rb +17 -16
- data/spec/lib/danica/operator/sin_spec.rb +9 -8
- data/spec/lib/danica/operator/squared_root_spec.rb +9 -8
- data/spec/lib/danica/operator_spec.rb +13 -4
- data/spec/lib/danica/variables_holder/store_spec.rb +19 -13
- data/spec/lib/danica/variables_holder_spec.rb +76 -59
- data/spec/lib/danica/wrapper/constant_spec.rb +9 -2
- data/spec/lib/danica/wrapper/group_spec.rb +4 -1
- data/spec/lib/danica/wrapper/negative_spec.rb +4 -1
- data/spec/lib/danica/wrapper/number_spec.rb +8 -3
- data/spec/lib/danica/wrapper/plus_minus_spec.rb +4 -1
- data/spec/lib/danica/wrapper/variable_spec.rb +6 -3
- data/spec/lib/danica/wrapper_spec.rb +14 -12
- data/spec/lib/danica_spec.rb +6 -5
- data/spec/spec_helper.rb +2 -1
- data/spec/support/models/expression/baskara.rb +3 -3
- data/spec/support/models/expression/parabole.rb +2 -0
- data/spec/support/models/expression/quadratic_sum.rb +3 -1
- data/spec/support/models/expression/spatial.rb +2 -1
- data/spec/support/models/function/my_function.rb +3 -1
- data/spec/support/models/function/parabole.rb +1 -1
- data/spec/support/models/function/quadratic_sum.rb +2 -0
- data/spec/support/models/function/spatial.rb +2 -0
- data/spec/support/models/operator/inverse.rb +3 -1
- data/spec/support/models/operator/my_operator.rb +3 -1
- data/spec/support/models/variables_holder/dummy.rb +3 -1
- data/spec/support/shared_contexts/common.rb +4 -2
- data/spec/support/shared_examples/base_operations.rb +7 -4
- data/spec/support/shared_examples/common.rb +3 -1
- data/spec/support/shared_examples/operator/chained.rb +12 -6
- data/spec/support/shared_examples/operator/dual_term.rb +9 -8
- data/spec/support/shared_examples/operator/single_input.rb +7 -2
- data/spec/support/shared_examples/variable.rb +8 -4
- metadata +109 -30
- data/spec/integration/addition_spec.rb +0 -28
- data/spec/integration/formatted_spec.rb +0 -75
- data/spec/integration/readme/formatting_spec.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0aa87c4f5832d6ab5e0ecf3ee864cf2482938d15b2deaaff5409d295a664606b
|
4
|
+
data.tar.gz: 7e9f79d9fd199f3f17983d48487d7d0b84c42e976a684100357ac88fab3e67db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f6254fa99e724a04a00bc0f943e082fc8f59f9e3efc60b6bdfa1d6e3f0554a22841849027588b7377619781d098badbb31480ff80857d6d9f3c3122203ec8bd
|
7
|
+
data.tar.gz: 5e14fef2c26461a234e18b73a8eea187117336aed2a2c0fcb7ca30f324a4ff2ba6bcb2c1d4ddfe7c0ac1d97de99d1b3af9af92bc5c1fdd5ae0ab0e13cecd24e3
|
@@ -0,0 +1,28 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
- image: darthjee/circleci_ruby_gems:0.1.0
|
6
|
+
steps:
|
7
|
+
- checkout
|
8
|
+
- run:
|
9
|
+
name: Prepare Coverage Test Report
|
10
|
+
command: cc-test-reporter before-build
|
11
|
+
- run:
|
12
|
+
name: Bundle Install
|
13
|
+
command: bundle install
|
14
|
+
- run:
|
15
|
+
name: RSpec
|
16
|
+
command: bundle exec rspec
|
17
|
+
- run:
|
18
|
+
name: Rubocop
|
19
|
+
command: rubocop
|
20
|
+
- run:
|
21
|
+
name: Coverage Test Report
|
22
|
+
command: cc-test-reporter after-build --exit-code $?
|
23
|
+
- run:
|
24
|
+
name: Yardstick coverage check
|
25
|
+
command: bundle exec rake verify_measurements
|
26
|
+
- run:
|
27
|
+
name: Rubycritcs check
|
28
|
+
command: scripts/rubycritic.sh
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2019-07-14 10:50:19 +0000 using RuboCop version 0.58.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 3
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 19
|
12
|
+
|
13
|
+
# Offense count: 8
|
14
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
+
# ExcludedMethods: refine
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Max: 54
|
18
|
+
|
19
|
+
# Offense count: 4
|
20
|
+
# Configuration parameters: CountComments.
|
21
|
+
Metrics/MethodLength:
|
22
|
+
Max: 16
|
23
|
+
|
24
|
+
# Offense count: 1
|
25
|
+
# Configuration parameters: CustomIncludeMethods.
|
26
|
+
RSpec/EmptyExampleGroup:
|
27
|
+
Exclude:
|
28
|
+
- 'spec/lib/danica/variables_holder/store_spec.rb'
|
29
|
+
|
30
|
+
# Offense count: 4
|
31
|
+
# Configuration parameters: CustomTransform, IgnoreMethods.
|
32
|
+
RSpec/FilePath:
|
33
|
+
Exclude:
|
34
|
+
- 'spec/integration/readme/constant_spec.rb'
|
35
|
+
- 'spec/integration/readme/equation_spec.rb'
|
36
|
+
- 'spec/integration/readme/number_spec.rb'
|
37
|
+
- 'spec/integration/readme/variables_spec.rb'
|
38
|
+
|
39
|
+
# Offense count: 4
|
40
|
+
RSpec/MultipleDescribes:
|
41
|
+
Exclude:
|
42
|
+
- 'spec/integration/readme/expression_spec.rb'
|
43
|
+
- 'spec/integration/readme/formatting_spec.rb'
|
44
|
+
- 'spec/integration/readme/function_spec.rb'
|
45
|
+
- 'spec/integration/readme/operator_spec.rb'
|
46
|
+
|
47
|
+
# Offense count: 294
|
48
|
+
RSpec/NamedSubject:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
# Offense count: 73
|
52
|
+
RSpec/NestedGroups:
|
53
|
+
Max: 6
|
54
|
+
|
55
|
+
# Offense count: 35
|
56
|
+
# Cop supports --auto-correct.
|
57
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
58
|
+
# SupportedStyles: nested, compact
|
59
|
+
Style/ClassAndModuleChildren:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
# Offense count: 36
|
63
|
+
Style/Documentation:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
# Offense count: 1
|
67
|
+
Style/EvalWithLocation:
|
68
|
+
Exclude:
|
69
|
+
- 'lib/danica/operator/functional.rb'
|
70
|
+
|
71
|
+
# Offense count: 1
|
72
|
+
Style/MethodMissingSuper:
|
73
|
+
Exclude:
|
74
|
+
- 'lib/danica/formatted.rb'
|
75
|
+
|
76
|
+
# Offense count: 1
|
77
|
+
Style/MissingRespondToMissing:
|
78
|
+
Exclude:
|
79
|
+
- 'lib/danica/formatted.rb'
|
80
|
+
|
81
|
+
# Offense count: 1
|
82
|
+
Style/MultilineBlockChain:
|
83
|
+
Exclude:
|
84
|
+
- 'spec/lib/danica/function_spec.rb'
|
85
|
+
|
86
|
+
# Offense count: 2
|
87
|
+
# Cop supports --auto-correct.
|
88
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
89
|
+
# SupportedStyles: predicate, comparison
|
90
|
+
Style/NumericPredicate:
|
91
|
+
Exclude:
|
92
|
+
- 'spec/**/*'
|
93
|
+
- 'lib/danica/wrapper.rb'
|
94
|
+
- 'lib/danica/wrapper/number.rb'
|
95
|
+
|
96
|
+
# Offense count: 83
|
97
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
98
|
+
# URISchemes: http, https
|
99
|
+
Metrics/LineLength:
|
100
|
+
Max: 181
|
data/Dockerfile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
FROM darthjee/ruby_gems:0.1.0 as base
|
2
|
+
FROM darthjee/scripts:0.0.2 as scripts
|
3
|
+
|
4
|
+
######################################
|
5
|
+
|
6
|
+
FROM base as builder
|
7
|
+
|
8
|
+
COPY --chown=app ./ /home/app/app/
|
9
|
+
COPY --chown=app:app --from=scripts /home/scripts/ ./
|
10
|
+
|
11
|
+
ENV HOME_DIR /home/app
|
12
|
+
RUN /bin/bash bundle_builder.sh
|
13
|
+
|
14
|
+
#######################
|
15
|
+
#FINAL IMAGE
|
16
|
+
FROM base
|
17
|
+
|
18
|
+
USER root
|
19
|
+
|
20
|
+
COPY --chown=app:app --from=builder /home/app/bundle/gems /usr/local/bundle/gems
|
21
|
+
COPY --chown=app:app --from=builder /home/app/bundle/cache /usr/local/bundle/cache
|
22
|
+
COPY --chown=app:app --from=builder /home/app/bundle/specifications /usr/local/bundle/specifications
|
23
|
+
COPY --chown=app:app --from=builder /home/app/bundle/bin /usr/local/bundle/bin
|
24
|
+
COPY --chown=app:app --from=builder /home/app/bundle/extensions /usr/local/bundle/extensions
|
25
|
+
|
26
|
+
USER app
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/config/rubycritc.rb
ADDED
data/config/yardstick.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yardstick/rake/measurement'
|
4
|
+
require 'yardstick/rake/verify'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
options = YAML.load_file('config/yardstick.yml')
|
8
|
+
|
9
|
+
Yardstick::Rake::Measurement.new(:yardstick_measure, options) do |measurement|
|
10
|
+
measurement.output = 'measurement/report.txt'
|
11
|
+
end
|
12
|
+
|
13
|
+
Yardstick::Rake::Verify.new(:verify_measurements, options)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
threshold: 0
|
2
|
+
require_exact_threshold: false
|
3
|
+
rules:
|
4
|
+
ApiTag::Presence:
|
5
|
+
enabled: true
|
6
|
+
exclude: []
|
7
|
+
ApiTag::Inclusion:
|
8
|
+
enabled: true
|
9
|
+
exclude: []
|
10
|
+
ApiTag::ProtectedMethod:
|
11
|
+
enabled: true
|
12
|
+
exclude: []
|
13
|
+
ApiTag::PrivateMethod:
|
14
|
+
enabled: true
|
15
|
+
exclude: []
|
16
|
+
ExampleTag:
|
17
|
+
enabled: true
|
18
|
+
exclude: []
|
19
|
+
ReturnTag:
|
20
|
+
enabled: true
|
21
|
+
exclude: []
|
22
|
+
Summary::Presence:
|
23
|
+
enabled: true
|
24
|
+
exclude: []
|
25
|
+
Summary::Length:
|
26
|
+
enabled: true
|
27
|
+
exclude: []
|
28
|
+
Summary::Delimiter:
|
29
|
+
enabled: true
|
30
|
+
exclude: []
|
31
|
+
Summary::SingleLine:
|
32
|
+
enabled: true
|
33
|
+
exclude: []
|
data/danica.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'danica/version'
|
5
6
|
|
@@ -18,10 +19,16 @@ Gem::Specification.new do |spec|
|
|
18
19
|
spec.add_runtime_dependency 'activesupport', '~> 5.2.x'
|
19
20
|
spec.add_runtime_dependency 'darthjee-core_ext', '~> 1.7.3'
|
20
21
|
|
21
|
-
spec.add_development_dependency 'bundler',
|
22
|
-
spec.add_development_dependency '
|
23
|
-
spec.add_development_dependency '
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.16.1'
|
23
|
+
spec.add_development_dependency 'pry-nav', '~> 0.2.4'
|
24
|
+
spec.add_development_dependency 'rake', '>= 12.3.1'
|
25
|
+
spec.add_development_dependency 'rspec', '>= 3.8'
|
26
|
+
spec.add_development_dependency 'rubocop', '0.58.1'
|
27
|
+
spec.add_development_dependency 'rubocop-rspec', '1.30.0'
|
28
|
+
spec.add_development_dependency 'rubycritic', '>= 4.0.2'
|
29
|
+
spec.add_development_dependency 'simplecov', '~> 0.16.x'
|
30
|
+
spec.add_development_dependency 'yard', '>= 0.9.18'
|
31
|
+
spec.add_development_dependency 'yardstick', '>= 0.9.9'
|
32
|
+
|
24
33
|
spec.add_development_dependency 'rspec-mocks'
|
25
|
-
spec.add_development_dependency 'pry-nav'
|
26
|
-
spec.add_development_dependency 'simplecov'
|
27
34
|
end
|
data/docker-compose.yml
CHANGED
@@ -1,18 +1,23 @@
|
|
1
|
-
version: '
|
1
|
+
version: '3'
|
2
2
|
services:
|
3
3
|
base: &base
|
4
|
-
image:
|
5
|
-
working_dir: /home/app/
|
4
|
+
image: danica
|
5
|
+
working_dir: /home/app/app
|
6
6
|
volumes:
|
7
|
-
- .:/home/app/
|
8
|
-
- danica_gems_2_4_0:/usr/local/bundle
|
7
|
+
- .:/home/app/app
|
9
8
|
|
10
|
-
|
9
|
+
base_build:
|
10
|
+
<<: *base
|
11
|
+
build: .
|
12
|
+
command: echo done
|
11
13
|
|
12
14
|
danica:
|
13
15
|
<<: *base
|
14
16
|
container_name: danica
|
15
|
-
|
17
|
+
depends_on: [base_build]
|
18
|
+
command: /bin/bash -c 'rspec'
|
16
19
|
|
17
|
-
|
18
|
-
|
20
|
+
test_all:
|
21
|
+
<<: *base
|
22
|
+
depends_on: [base_build]
|
23
|
+
command: /bin/bash -c 'rspec && yard && rake yardstick_measure && rake verify_measurements'
|
data/lib/danica.rb
CHANGED
data/lib/danica/builder.rb
CHANGED
data/lib/danica/common.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Danica
|
2
|
-
module Common
|
4
|
+
module Common
|
5
|
+
extend ::ActiveSupport::Concern
|
3
6
|
included do
|
4
7
|
include Wrapper
|
5
8
|
include DSL
|
@@ -42,7 +45,7 @@ module Danica
|
|
42
45
|
when :f
|
43
46
|
to_f
|
44
47
|
else
|
45
|
-
raise Exception::FormattedNotFound
|
48
|
+
raise Exception::FormattedNotFound
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
data/lib/danica/dsl.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Danica
|
2
4
|
module DSL
|
3
5
|
autoload :Builder, 'danica/dsl/builder'
|
4
6
|
|
5
7
|
class << self
|
6
|
-
def register_operator(method, clazz=nil)
|
8
|
+
def register_operator(method, clazz = nil)
|
7
9
|
register(method, clazz, 'Danica::Operator')
|
8
10
|
end
|
9
11
|
|
10
|
-
def register_wrapper(method, clazz=nil)
|
12
|
+
def register_wrapper(method, clazz = nil)
|
11
13
|
register(method, clazz, 'Danica::Wrapper')
|
12
14
|
end
|
13
15
|
|
14
|
-
def register(method, clazz=nil, base=nil)
|
16
|
+
def register(method, clazz = nil, base = nil)
|
15
17
|
Builder.new(method, clazz, base).build
|
16
18
|
end
|
17
19
|
|
@@ -39,14 +41,14 @@ module Danica
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
|
-
%i
|
44
|
+
%i[
|
43
45
|
addition multiplication division sin cos power
|
44
46
|
squared_root exponential
|
45
|
-
|
47
|
+
].each do |method|
|
46
48
|
DSL.register_operator(method)
|
47
49
|
end
|
48
50
|
|
49
|
-
%i
|
51
|
+
%i[number group negative plus_minus variable constant].each do |method|
|
50
52
|
DSL.register_wrapper(method)
|
51
53
|
end
|
52
54
|
|
data/lib/danica/dsl/builder.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Danica
|
2
4
|
module DSL
|
3
5
|
class Builder
|
4
6
|
attr_reader :method, :claz, :base
|
5
7
|
|
6
|
-
def initialize(method, claz=nil, base=nil)
|
8
|
+
def initialize(method, claz = nil, base = nil)
|
7
9
|
@method = method
|
8
10
|
@claz = claz
|
9
11
|
@base = base
|
data/lib/danica/equation.rb
CHANGED