cauldron 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -1
- data/.rspec +1 -0
- data/Gemfile +16 -9
- data/Gemfile.lock +134 -64
- data/README.md +26 -0
- data/Rakefile +24 -99
- data/build_sandbox.rb +41 -0
- data/cucumber.yml +8 -0
- data/features/chop.feature +23 -0
- data/features/create_dynamic_statements.feature +14 -0
- data/features/generate_known_solution.feature +42 -0
- data/features/generate_new_statement.feature +20 -0
- data/features/step_definitions/cauldron_steps.rb +47 -0
- data/features/support/env.rb +1 -1
- data/features/use_existing_statements.feature +23 -0
- data/lib/cauldron.rb +41 -5
- data/lib/cauldron/actualized_composite.rb +35 -0
- data/lib/cauldron/array_collect_template/default.rb +95 -0
- data/lib/cauldron/array_collect_template/template.rb +57 -0
- data/lib/cauldron/builder.rb +60 -0
- data/lib/cauldron/caret.rb +50 -0
- data/lib/cauldron/dynamic_operator.rb +90 -0
- data/lib/cauldron/dynamic_operator_module.rb +140 -0
- data/lib/cauldron/example.rb +18 -0
- data/lib/cauldron/example_set.rb +36 -0
- data/lib/cauldron/histories.rb +53 -0
- data/lib/cauldron/history.rb +34 -0
- data/lib/cauldron/if_relationship.rb +4 -6
- data/lib/cauldron/number_addition_template/add_five.rb +71 -0
- data/lib/cauldron/number_addition_template/template.rb +56 -0
- data/lib/cauldron/operator.rb +62 -0
- data/lib/cauldron/operator/array_reverse_operator.rb +160 -0
- data/lib/cauldron/operator/concat_operator.rb +72 -0
- data/lib/cauldron/operator/hash_key_value_operator.rb +74 -0
- data/lib/cauldron/operator/numeric_operator.rb +115 -0
- data/lib/cauldron/operator/string_asterisk_operator.rb +131 -0
- data/lib/cauldron/operator/to_s_operator.rb +18 -0
- data/lib/cauldron/operator/var_collect_operator.rb +29 -0
- data/lib/cauldron/pot.rb +136 -26
- data/lib/cauldron/scope.rb +24 -0
- data/lib/cauldron/solution/composite.rb +236 -0
- data/lib/cauldron/solution/one.rb +49 -0
- data/lib/cauldron/statement_generator.rb +298 -0
- data/lib/cauldron/template_base.rb +14 -0
- data/lib/cauldron/tracer.rb +55 -0
- data/lib/cauldron/version.rb +1 -1
- data/lib/pry_tester.rb +76 -0
- data/ruby_to_sexp.rb +74 -0
- data/sandbox.rb +7 -0
- data/sexp_to_ruby.rb +150 -0
- data/spec/cauldron/actualized_composite_spec.rb +140 -0
- data/spec/cauldron/array_collect_template/default_spec.rb +41 -0
- data/spec/cauldron/builder_spec.rb +186 -0
- data/spec/cauldron/dynamic/add_number_template_spec.rb +30 -0
- data/spec/cauldron/dynamic_operator_spec.rb +416 -0
- data/spec/cauldron/example_set_spec.rb +49 -0
- data/spec/cauldron/example_spec.rb +33 -0
- data/spec/cauldron/histories_spec.rb +135 -0
- data/spec/cauldron/history_spec.rb +118 -0
- data/spec/cauldron/if_relationship_spec.rb +1 -1
- data/spec/cauldron/operator/array_reverse_operator_spec.rb +73 -0
- data/spec/cauldron/{concat_operator_spec.rb → operator/concat_operator_spec.rb} +30 -12
- data/spec/cauldron/operator/hash_key_value_operator_spec.rb +98 -0
- data/spec/cauldron/operator/numeric_operator_spec.rb +110 -0
- data/spec/cauldron/operator/string_asterisk_operator_spec.rb +196 -0
- data/spec/cauldron/operator/var_collect_operator_spec.rb +38 -0
- data/spec/cauldron/pot_spec.rb +176 -14
- data/spec/cauldron/solution/composite_spec.rb +421 -0
- data/spec/cauldron/solution/one_spec.rb +24 -0
- data/spec/cauldron/statement_generator_spec.rb +211 -0
- data/spec/cauldron/terminal_spec.rb +2 -2
- data/spec/spec_helper.rb +5 -1
- data/spec/support/code_matcher.rb +55 -0
- data/spec/support/include_instance_of_matcher.rb +9 -0
- data/spec/support/shared_examples_for_leaf_operators.rb +22 -0
- data/spec/support/shared_examples_for_operators.rb +23 -0
- data/syntax_spec.txt +2 -0
- metadata +104 -41
- data/README +0 -1
- data/README.rdoc +0 -19
- data/VERSION +0 -1
- data/features/cauldron_new_approach.feature +0 -46
- data/lib/cauldron/array_reverse_operator.rb +0 -39
- data/lib/cauldron/concat_operator.rb +0 -34
- data/lib/cauldron/numeric_operator.rb +0 -45
- data/lib/cauldron/relationship.rb +0 -5
- data/spec/cauldron/array_reverse_operator_spec.rb +0 -59
- data/spec/cauldron/numeric_operator_spec.rb +0 -70
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dedfa4647815accc4eb122bd68da99c45587899f
|
4
|
+
data.tar.gz: de6686c30eb37dba7ee69436b92feb8dccbd4b28
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6c768e91f010f80cca34b5fe4f5b09c50fc83c38326afabb34d696dcb3ab04210d15f2019e68759508f69c6ad54062caf8083a9f216a596b4a20d3a10a55c811
|
7
|
+
data.tar.gz: 4506c6030f20854024b7198b6a96be9d3625201022e664c77a3941ab1205d20d1375ba0cfee37717bb48374b6f8313966cdc4e33b2b0c35e75a81fc8eb5fbd04
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
@@ -7,19 +7,26 @@ source "http://rubygems.org"
|
|
7
7
|
#require 'rubygems'
|
8
8
|
#require 'lib/cauldron'
|
9
9
|
|
10
|
+
gem 'activesupport'
|
11
|
+
|
10
12
|
# Add dependencies to develop your gem here.
|
11
13
|
# Include everything needed to run rake, tests, features, etc.
|
12
14
|
group :development, :cucumber, :test do
|
13
15
|
#gem "shoulda", ">= 0"
|
14
16
|
#gem "bundler", "~> 1.0.15"
|
15
|
-
gem "jeweler"
|
16
|
-
gem "rspec"
|
17
|
-
gem
|
18
|
-
gem "ruby_parser"
|
19
|
-
gem
|
17
|
+
gem "jeweler"
|
18
|
+
gem "rspec"
|
19
|
+
gem 'simplecov', :require => false
|
20
|
+
gem "ruby_parser"
|
21
|
+
gem 'aruba', '~> 0.14.6'
|
20
22
|
#gem 'ruby-debug', '0.10.4'
|
21
|
-
gem '
|
22
|
-
gem 'pry'
|
23
|
+
#gem 'pry'
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
+
# http://rubytree.anupamsg.me
|
27
|
+
gem 'tree'
|
28
|
+
|
29
|
+
gem 'pry', '~> 0.10.2'
|
30
|
+
|
31
|
+
gem 'ruby2ruby', '~> 2.3'
|
32
|
+
gem 'sorcerer', '~> 1.0.2'
|
data/Gemfile.lock
CHANGED
@@ -1,76 +1,146 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
ffi (~> 1.
|
15
|
-
|
16
|
-
|
17
|
-
|
4
|
+
activesupport (5.2.3)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
+
i18n (>= 0.7, < 2)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
tzinfo (~> 1.1)
|
9
|
+
addressable (2.4.0)
|
10
|
+
aruba (0.14.11)
|
11
|
+
childprocess (>= 0.6.3, < 3.0.0)
|
12
|
+
contracts (~> 0.9)
|
13
|
+
cucumber (>= 1.3.19)
|
14
|
+
ffi (~> 1.9)
|
15
|
+
rspec-expectations (>= 2.99)
|
16
|
+
thor (~> 0.19)
|
17
|
+
backports (3.15.0)
|
18
|
+
builder (3.2.3)
|
19
|
+
childprocess (2.0.0)
|
20
|
+
rake (< 13.0)
|
21
|
+
coderay (1.1.2)
|
22
|
+
concurrent-ruby (1.1.5)
|
23
|
+
contracts (0.16.0)
|
24
|
+
cucumber (3.1.2)
|
18
25
|
builder (>= 2.1.2)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
cucumber-core (~> 3.2.0)
|
27
|
+
cucumber-expressions (~> 6.0.1)
|
28
|
+
cucumber-wire (~> 0.0.1)
|
29
|
+
diff-lcs (~> 1.3)
|
30
|
+
gherkin (~> 5.1.0)
|
31
|
+
multi_json (>= 1.7.5, < 2.0)
|
32
|
+
multi_test (>= 0.1.2)
|
33
|
+
cucumber-core (3.2.1)
|
34
|
+
backports (>= 3.8.0)
|
35
|
+
cucumber-tag_expressions (~> 1.1.0)
|
36
|
+
gherkin (~> 5.0)
|
37
|
+
cucumber-expressions (6.0.1)
|
38
|
+
cucumber-tag_expressions (1.1.1)
|
39
|
+
cucumber-wire (0.0.1)
|
40
|
+
descendants_tracker (0.0.4)
|
41
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
42
|
+
diff-lcs (1.3)
|
43
|
+
docile (1.3.2)
|
44
|
+
faraday (0.9.2)
|
45
|
+
multipart-post (>= 1.2, < 3)
|
46
|
+
ffi (1.11.1)
|
47
|
+
gherkin (5.1.0)
|
48
|
+
git (1.5.0)
|
49
|
+
github_api (0.16.0)
|
50
|
+
addressable (~> 2.4.0)
|
51
|
+
descendants_tracker (~> 0.0.4)
|
52
|
+
faraday (~> 0.8, < 0.10)
|
53
|
+
hashie (>= 3.4)
|
54
|
+
mime-types (>= 1.16, < 3.0)
|
55
|
+
oauth2 (~> 1.0)
|
56
|
+
hashie (3.6.0)
|
57
|
+
highline (2.0.2)
|
58
|
+
i18n (1.6.0)
|
59
|
+
concurrent-ruby (~> 1.0)
|
60
|
+
jeweler (2.3.9)
|
61
|
+
builder
|
62
|
+
bundler
|
36
63
|
git (>= 1.2.5)
|
64
|
+
github_api (~> 0.16.0)
|
65
|
+
highline (>= 1.6.15)
|
66
|
+
nokogiri (>= 1.5.10)
|
67
|
+
psych
|
37
68
|
rake
|
38
|
-
|
69
|
+
rdoc
|
70
|
+
semver2
|
71
|
+
json (2.2.0)
|
72
|
+
jwt (2.2.1)
|
39
73
|
method_source (0.8.2)
|
40
|
-
|
41
|
-
|
42
|
-
|
74
|
+
mime-types (2.99.3)
|
75
|
+
mini_portile2 (2.4.0)
|
76
|
+
minitest (5.11.3)
|
77
|
+
multi_json (1.13.1)
|
78
|
+
multi_test (0.1.2)
|
79
|
+
multi_xml (0.6.0)
|
80
|
+
multipart-post (2.1.1)
|
81
|
+
nokogiri (1.10.4)
|
82
|
+
mini_portile2 (~> 2.4.0)
|
83
|
+
oauth2 (1.4.1)
|
84
|
+
faraday (>= 0.8, < 0.16.0)
|
85
|
+
jwt (>= 1.0, < 3.0)
|
86
|
+
multi_json (~> 1.3)
|
87
|
+
multi_xml (~> 0.5)
|
88
|
+
rack (>= 1.2, < 3)
|
89
|
+
pry (0.10.4)
|
90
|
+
coderay (~> 1.1.0)
|
91
|
+
method_source (~> 0.8.1)
|
43
92
|
slop (~> 3.4)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
rspec (
|
49
|
-
rspec-core (~>
|
50
|
-
rspec-expectations (~>
|
51
|
-
rspec-mocks (~>
|
52
|
-
rspec-core (
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
93
|
+
psych (3.1.0)
|
94
|
+
rack (2.0.7)
|
95
|
+
rake (12.3.3)
|
96
|
+
rdoc (6.1.1)
|
97
|
+
rspec (3.8.0)
|
98
|
+
rspec-core (~> 3.8.0)
|
99
|
+
rspec-expectations (~> 3.8.0)
|
100
|
+
rspec-mocks (~> 3.8.0)
|
101
|
+
rspec-core (3.8.2)
|
102
|
+
rspec-support (~> 3.8.0)
|
103
|
+
rspec-expectations (3.8.4)
|
104
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
105
|
+
rspec-support (~> 3.8.0)
|
106
|
+
rspec-mocks (3.8.1)
|
107
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
108
|
+
rspec-support (~> 3.8.0)
|
109
|
+
rspec-support (3.8.2)
|
110
|
+
ruby2ruby (2.4.3)
|
111
|
+
ruby_parser (~> 3.1)
|
112
|
+
sexp_processor (~> 4.6)
|
113
|
+
ruby_parser (3.13.1)
|
114
|
+
sexp_processor (~> 4.9)
|
115
|
+
semver2 (3.4.2)
|
116
|
+
sexp_processor (4.12.1)
|
117
|
+
simplecov (0.17.0)
|
118
|
+
docile (~> 1.1)
|
119
|
+
json (>= 1.8, < 3)
|
120
|
+
simplecov-html (~> 0.10.0)
|
121
|
+
simplecov-html (0.10.2)
|
122
|
+
slop (3.6.0)
|
123
|
+
sorcerer (1.0.2)
|
124
|
+
thor (0.20.3)
|
125
|
+
thread_safe (0.3.6)
|
126
|
+
tree (0.2.1)
|
127
|
+
tzinfo (1.2.5)
|
128
|
+
thread_safe (~> 0.1)
|
64
129
|
|
65
130
|
PLATFORMS
|
66
131
|
ruby
|
67
132
|
|
68
133
|
DEPENDENCIES
|
69
|
-
|
70
|
-
|
71
|
-
jeweler
|
72
|
-
pry
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
134
|
+
activesupport
|
135
|
+
aruba (~> 0.14.6)
|
136
|
+
jeweler
|
137
|
+
pry (~> 0.10.2)
|
138
|
+
rspec
|
139
|
+
ruby2ruby (~> 2.3)
|
140
|
+
ruby_parser
|
141
|
+
simplecov
|
142
|
+
sorcerer (~> 1.0.2)
|
143
|
+
tree
|
144
|
+
|
145
|
+
BUNDLED WITH
|
146
|
+
1.16.1
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
[![Code Climate](https://codeclimate.com/github/theinbetweens/cauldron/badges/gpa.svg)](https://codeclimate.com/github/theinbetweens/cauldron)
|
2
|
+
|
3
|
+
[![Build Status](https://semaphoreci.com/api/v1/projects/68fafc64-3ef2-41f6-8936-d69d40e0fe2b/617362/badge.svg)](https://semaphoreci.com/theinbetweens/cauldron)
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
**Cauldron** can generate a very limited range of simple ruby functions to solve supplied problem. The following example will print the following ruby code.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
def function(var0)
|
11
|
+
var0 + 1
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'cauldron'
|
17
|
+
|
18
|
+
pot = Cauldron::Pot.new
|
19
|
+
result = pot.solve(
|
20
|
+
[
|
21
|
+
{arguments: [7], response: 8},
|
22
|
+
{arguments: [10], response: 11}
|
23
|
+
]
|
24
|
+
)
|
25
|
+
puts result
|
26
|
+
```
|
data/Rakefile
CHANGED
@@ -1,108 +1,33 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.setup
|
6
|
+
Bundler::GemHelper.install_tasks
|
4
7
|
|
5
|
-
#
|
6
|
-
#
|
8
|
+
#require 'cucumber/rake/task'
|
9
|
+
#require "bundler/gem_tasks"
|
10
|
+
#require 'cucumber'
|
7
11
|
|
8
|
-
# # => TODO This need to be above the bundler for some reason
|
9
|
-
# require "rspec"
|
10
|
-
# require "rspec/core/rake_task"
|
11
12
|
|
12
|
-
|
13
|
+
require 'rubygems'
|
14
|
+
require 'cucumber'
|
15
|
+
require 'cucumber/rake/task'
|
13
16
|
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
# exit e.status_code
|
21
|
-
# end
|
17
|
+
# Copied - https://github.com/cucumber/aruba/blob/master/Rakefile
|
18
|
+
Cucumber::Rake::Task.new do |t|
|
19
|
+
t.cucumber_opts = ""
|
20
|
+
# t.cucumber_opts = "--format Cucumber::Pro --out cucumber-pro.log" if ENV['CUCUMBER_PRO_TOKEN']
|
21
|
+
t.cucumber_opts << "--format pretty"
|
22
|
+
end
|
22
23
|
|
23
|
-
#
|
24
|
+
# https://www.relishapp.com/rspec/rspec-core/docs/command-line/rake-task
|
25
|
+
begin
|
26
|
+
require 'rspec/core/rake_task'
|
24
27
|
|
25
|
-
|
28
|
+
RSpec::Core::RakeTask.new(:spec)
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
#
|
30
|
-
|
31
|
-
# # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
32
|
-
# gem.name = "cauldron"
|
33
|
-
# gem.homepage = "http://github.com/theinbetweens/cauldron"
|
34
|
-
# gem.license = "MIT"
|
35
|
-
# gem.summary = %Q{Generate simple ruby methods from the input(s) and expected output}
|
36
|
-
# gem.description = %Q{Cauldron generates a methd from a number of examples that describe the input and the expected output. It is still at a very early stage of development right now so you're unlikely to get much practical use out of it.}
|
37
|
-
# gem.email = "warrensangster@yahoo.com"
|
38
|
-
# gem.authors = ["Warren Sangster"]
|
39
|
-
# gem.required_ruby_version = '>= 1.6.8'
|
40
|
-
# # dependencies defined in Gemfile
|
41
|
-
# end
|
42
|
-
# Jeweler::RubygemsDotOrgTasks.new
|
43
|
-
|
44
|
-
# # require 'rake/testtask'
|
45
|
-
# # Rake::TestTask.new(:test) do |test|
|
46
|
-
# # test.libs << 'lib' << 'test'
|
47
|
-
# # test.pattern = 'test/**/test_*.rb'
|
48
|
-
# # test.verbose = true
|
49
|
-
# # end
|
50
|
-
|
51
|
-
# # require 'rcov/rcovtask'
|
52
|
-
# # Rcov::RcovTask.new do |test|
|
53
|
-
# # #test.libs << 'test'
|
54
|
-
# # #test.pattern = 'test/**/test_*.rb'
|
55
|
-
# # test.libs << 'spec'
|
56
|
-
# # test.pattern = 'spec/**/*.rb'
|
57
|
-
# # test.verbose = true
|
58
|
-
# # test.rcov_opts << '--exclude "gems/*"'
|
59
|
-
# # end
|
60
|
-
|
61
|
-
# #task :default => :test
|
62
|
-
|
63
|
-
# require 'rake/rdoctask'
|
64
|
-
# Rake::RDocTask.new do |rdoc|
|
65
|
-
# version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
66
|
-
|
67
|
-
# rdoc.rdoc_dir = 'rdoc'
|
68
|
-
# rdoc.title = "cauldron #{version}"
|
69
|
-
# rdoc.rdoc_files.include('README*')
|
70
|
-
# rdoc.rdoc_files.include('lib/**/*.rb')
|
71
|
-
# end
|
72
|
-
|
73
|
-
# # => http://pivotallabs.com/users/alex/blog/articles/1451-upgrading-your-rakefile-from-rspec-1-3-to-rspec-2
|
74
|
-
# RSpec::Core::RakeTask.new(:core) do |spec|
|
75
|
-
# spec.pattern = 'spec/cauldron/*_spec.rb'
|
76
|
-
# spec.rspec_opts = ['--backtrace']
|
77
|
-
# end
|
78
|
-
|
79
|
-
# # RSpec::Core::RakeTask.new(:rcov) do |spec|
|
80
|
-
# # spec.pattern = 'spec/cauldron/*_spec.rb'
|
81
|
-
# # spec.rspec_opts = ['--backtrace']
|
82
|
-
# # end
|
83
|
-
|
84
|
-
# RSpec::Core::RakeTask.new(:coverage) do |t|
|
85
|
-
# t.rcov = true
|
86
|
-
# #t.rcov_opts = %q[--exclude "spec"]
|
87
|
-
# t.verbose = true
|
88
|
-
# end
|
89
|
-
|
90
|
-
# # => =====================
|
91
|
-
|
92
|
-
# # desc "Run all specs with rcov"
|
93
|
-
# # RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
|
94
|
-
# # t.rcov = true
|
95
|
-
# # end
|
96
|
-
|
97
|
-
# # => http://stackoverflow.com/questions/3058676/rcov-with-rspec-2
|
98
|
-
# #require 'spec-core'
|
99
|
-
# #require 'rubygems'
|
100
|
-
# #require 'rspec'
|
101
|
-
# #require 'rspec/core'
|
102
|
-
|
103
|
-
# #
|
104
|
-
# # desc "Run all specs with rcov"
|
105
|
-
# # RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
|
106
|
-
# # t.rcov = true
|
107
|
-
# # t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/}
|
108
|
-
# # end
|
30
|
+
task :default => :spec
|
31
|
+
rescue LoadError
|
32
|
+
# no rspec available
|
33
|
+
end
|
data/build_sandbox.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib',__FILE__)
|
2
|
+
|
3
|
+
require 'cauldron'
|
4
|
+
|
5
|
+
a = %q{
|
6
|
+
def function(var1)
|
7
|
+
var2 = var1.collect {|x| x + 2}
|
8
|
+
var3 = var2.collect {|x| x.to_s }
|
9
|
+
end
|
10
|
+
}
|
11
|
+
|
12
|
+
b = %q{
|
13
|
+
def function2(var1)
|
14
|
+
var2 = var1.collect do |x|
|
15
|
+
x + 2
|
16
|
+
end
|
17
|
+
var3 = var2.collect do |x|
|
18
|
+
x.to_s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
sexp = Ripper::SexpBuilder.new(b).parse
|
26
|
+
|
27
|
+
|
28
|
+
[
|
29
|
+
[ArrayCollect.new, NumericOperator.new(2)]
|
30
|
+
[ArrayCollect.new, ToSOperator.new]
|
31
|
+
]
|
32
|
+
|
33
|
+
|
34
|
+
a.build('var1')
|
35
|
+
|
36
|
+
build(name, next_element)
|
37
|
+
[:sdf, :dsfsd, next_element.build('x')]
|
38
|
+
end
|
39
|
+
a.build('var2')
|
40
|
+
|
41
|
+
build()
|