delorean_lang 2.1.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemignore +2 -0
- data/.rubocop.yml +3 -2
- data/.rubocop_todo.yml +19 -29
- data/Gemfile +1 -2
- data/README.md +57 -17
- data/delorean.gemspec +7 -1
- data/lib/delorean/base.rb +25 -3
- data/lib/delorean/cache.rb +42 -4
- data/lib/delorean/delorean.rb +357 -36
- data/lib/delorean/delorean.treetop +12 -2
- data/lib/delorean/engine.rb +44 -5
- data/lib/delorean/nodes.rb +32 -2
- data/lib/delorean/version.rb +1 -1
- data/spec/eval_spec.rb +40 -0
- data/spec/node_level_cache_spec.rb +135 -0
- data/spec/parse_spec.rb +20 -1
- data/spec/perf_spec.rb +42 -0
- data/spec/spec_helper.rb +17 -1
- data/spec/support/simplecov_helper.rb +30 -0
- metadata +7 -3
- data/.gitlab-ci.yml +0 -37
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'support/simplecov_helper'
|
4
|
+
SimpleCovHelper.start!
|
5
|
+
|
3
6
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
7
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
8
|
|
@@ -10,7 +13,7 @@ require 'active_record'
|
|
10
13
|
|
11
14
|
# Requires supporting files with custom matchers and macros, etc,
|
12
15
|
# in ./support/ and its subdirectories.
|
13
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
16
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
14
17
|
|
15
18
|
RSpec.configure do |config|
|
16
19
|
end
|
@@ -44,6 +47,14 @@ class Dummy < ActiveRecord::Base
|
|
44
47
|
a.inject(0, :+)
|
45
48
|
end
|
46
49
|
|
50
|
+
delorean_fn :time_minute_ago do
|
51
|
+
Time.current - 1.minute
|
52
|
+
end
|
53
|
+
|
54
|
+
delorean_fn :time_minute_from_now do
|
55
|
+
Time.current + 1.minute
|
56
|
+
end
|
57
|
+
|
47
58
|
def self.this_is_crazy; end
|
48
59
|
|
49
60
|
def self.miss_you_so_bad
|
@@ -59,6 +70,11 @@ class Dummy < ActiveRecord::Base
|
|
59
70
|
{ a: 123, 'a' => 456, b: 789 }
|
60
71
|
end
|
61
72
|
|
73
|
+
# Emulates typical DB query
|
74
|
+
delorean_fn :sleep_1ms do
|
75
|
+
sleep 0.001
|
76
|
+
end
|
77
|
+
|
62
78
|
def name2
|
63
79
|
"#{name}-#{number.round(4)}"
|
64
80
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Credit to: https://gitlab.com/gitlab-org/gitlab-foss/blob/master/spec/simplecov_env.rb
|
4
|
+
|
5
|
+
require 'simplecov'
|
6
|
+
|
7
|
+
module SimpleCovHelper
|
8
|
+
def self.configure_profile
|
9
|
+
SimpleCov.configure do
|
10
|
+
load_profile 'test_frameworks'
|
11
|
+
load_profile 'root_filter'
|
12
|
+
load_profile 'bundler_filter'
|
13
|
+
track_files '{lib}/**/*.rb'
|
14
|
+
|
15
|
+
add_filter 'lib/delorean/delorean.rb'
|
16
|
+
add_filter '/vendor/ruby/'
|
17
|
+
add_filter 'spec/'
|
18
|
+
|
19
|
+
add_group 'Library', 'lib'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.start!
|
24
|
+
return unless ENV['COVERAGE'] == 'true'
|
25
|
+
|
26
|
+
configure_profile
|
27
|
+
|
28
|
+
SimpleCov.start
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delorean_lang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -129,8 +129,8 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".gemignore"
|
132
133
|
- ".gitignore"
|
133
|
-
- ".gitlab-ci.yml"
|
134
134
|
- ".rspec"
|
135
135
|
- ".rubocop.yml"
|
136
136
|
- ".rubocop_todo.yml"
|
@@ -170,11 +170,13 @@ files:
|
|
170
170
|
- spec/dev_spec.rb
|
171
171
|
- spec/eval_spec.rb
|
172
172
|
- spec/func_spec.rb
|
173
|
+
- spec/node_level_cache_spec.rb
|
173
174
|
- spec/parse_spec.rb
|
174
175
|
- spec/perf_spec.rb
|
175
176
|
- spec/ruby/error_handling_spec.rb
|
176
177
|
- spec/ruby/whitelist_spec.rb
|
177
178
|
- spec/spec_helper.rb
|
179
|
+
- spec/support/simplecov_helper.rb
|
178
180
|
homepage: https://github.com/arman000/delorean_lang
|
179
181
|
licenses:
|
180
182
|
- MIT
|
@@ -203,8 +205,10 @@ test_files:
|
|
203
205
|
- spec/dev_spec.rb
|
204
206
|
- spec/eval_spec.rb
|
205
207
|
- spec/func_spec.rb
|
208
|
+
- spec/node_level_cache_spec.rb
|
206
209
|
- spec/parse_spec.rb
|
207
210
|
- spec/perf_spec.rb
|
208
211
|
- spec/ruby/error_handling_spec.rb
|
209
212
|
- spec/ruby/whitelist_spec.rb
|
210
213
|
- spec/spec_helper.rb
|
214
|
+
- spec/support/simplecov_helper.rb
|
data/.gitlab-ci.yml
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
image: ruby:2.6.3-buster
|
2
|
-
|
3
|
-
before_script:
|
4
|
-
- gem install bundler:2.0.2
|
5
|
-
- bundle install --jobs $(nproc) --path vendor "${FLAGS[@]}"
|
6
|
-
|
7
|
-
.base-test:
|
8
|
-
stage: test
|
9
|
-
# Use only the following CI runners
|
10
|
-
tags:
|
11
|
-
- gitlabci-runner-eks-shared-dev
|
12
|
-
|
13
|
-
rubocop:
|
14
|
-
extends: .base-test
|
15
|
-
stage: test
|
16
|
-
script:
|
17
|
-
- bundle exec rubocop
|
18
|
-
|
19
|
-
rspec:
|
20
|
-
extends: .base-test
|
21
|
-
stage: test
|
22
|
-
script:
|
23
|
-
- bundle exec rspec
|
24
|
-
|
25
|
-
cache:
|
26
|
-
key: 'delorean_bundler_cache'
|
27
|
-
paths:
|
28
|
-
- vendor/ruby
|
29
|
-
|
30
|
-
variables:
|
31
|
-
GIT_SSL_NO_VERIFY: "true"
|
32
|
-
BUNDLER_VERSION: "2.0.2"
|
33
|
-
POSTGRES_USER: "runner"
|
34
|
-
POSTGRES_PASSWORD: ""
|
35
|
-
RAILS_ENV: "test"
|
36
|
-
RAILS_DUMP_SCHEMA: "false"
|
37
|
-
|