alf-shell 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +35 -0
- data/LICENCE.md +22 -0
- data/Manifest.txt +13 -0
- data/README.md +11 -0
- data/Rakefile +11 -0
- data/bin/alf +17 -0
- data/lib/alf-shell.rb +1 -0
- data/lib/alf/shell.rb +48 -0
- data/lib/alf/shell/command.rb +21 -0
- data/lib/alf/shell/command/exec.rb +16 -0
- data/lib/alf/shell/command/help.rb +30 -0
- data/lib/alf/shell/command/main.rb +175 -0
- data/lib/alf/shell/command/show.rb +49 -0
- data/lib/alf/shell/doc_manager.rb +83 -0
- data/lib/alf/shell/ext/signature.rb +45 -0
- data/lib/alf/shell/from_argv.rb +78 -0
- data/lib/alf/shell/loader.rb +2 -0
- data/lib/alf/shell/operator.rb +63 -0
- data/lib/alf/shell/support.rb +28 -0
- data/lib/alf/shell/version.rb +16 -0
- data/spec/integration/__database__/group.alf +3 -0
- data/spec/integration/__database__/parts.rash +6 -0
- data/spec/integration/__database__/suppliers.rash +5 -0
- data/spec/integration/__database__/suppliers_csv.csv +6 -0
- data/spec/integration/__database__/supplies.rash +12 -0
- data/spec/integration/alf/alf.db +0 -0
- data/spec/integration/alf/alf_db.cmd +1 -0
- data/spec/integration/alf/alf_db.stdout +5 -0
- data/spec/integration/alf/alf_e.cmd +1 -0
- data/spec/integration/alf/alf_e.stdout +4 -0
- data/spec/integration/alf/alf_help.cmd +1 -0
- data/spec/integration/alf/alf_help.stdout +72 -0
- data/spec/integration/alf/alf_json.cmd +1 -0
- data/spec/integration/alf/alf_json.stdout +1 -0
- data/spec/integration/alf/alf_r.cmd +1 -0
- data/spec/integration/alf/alf_r.stdout +5 -0
- data/spec/integration/alf/alf_version.cmd +1 -0
- data/spec/integration/alf/alf_version.stdout +2 -0
- data/spec/integration/alf/alf_yaml.cmd +1 -0
- data/spec/integration/alf/alf_yaml.stdout +22 -0
- data/spec/integration/alf/rel.rash +1 -0
- data/spec/integration/autonum/autonum_0.cmd +1 -0
- data/spec/integration/autonum/autonum_0.stdout +9 -0
- data/spec/integration/autonum/autonum_1.cmd +1 -0
- data/spec/integration/autonum/autonum_1.stdout +9 -0
- data/spec/integration/clip/clip_0.cmd +1 -0
- data/spec/integration/clip/clip_0.stdout +9 -0
- data/spec/integration/clip/clip_1.cmd +1 -0
- data/spec/integration/clip/clip_1.stdout +9 -0
- data/spec/integration/coerce/coerce_1.cmd +1 -0
- data/spec/integration/coerce/coerce_1.stdout +5 -0
- data/spec/integration/compact/compact_0.cmd +1 -0
- data/spec/integration/compact/compact_0.stdout +9 -0
- data/spec/integration/defaults/defaults_0.cmd +1 -0
- data/spec/integration/defaults/defaults_0.stdout +9 -0
- data/spec/integration/defaults/defaults_1.cmd +1 -0
- data/spec/integration/defaults/defaults_1.stdout +9 -0
- data/spec/integration/defaults/defaults_2.cmd +1 -0
- data/spec/integration/defaults/defaults_2.stdout +9 -0
- data/spec/integration/extend/extend_0.cmd +1 -0
- data/spec/integration/extend/extend_0.stdout +16 -0
- data/spec/integration/generator/generator_1.cmd +1 -0
- data/spec/integration/generator/generator_1.stdout +10 -0
- data/spec/integration/generator/generator_2.cmd +1 -0
- data/spec/integration/generator/generator_2.stdout +5 -0
- data/spec/integration/generator/generator_3.cmd +1 -0
- data/spec/integration/generator/generator_3.stdout +5 -0
- data/spec/integration/group/group_0.cmd +1 -0
- data/spec/integration/group/group_0.stdout +32 -0
- data/spec/integration/group/group_1.cmd +1 -0
- data/spec/integration/group/group_1.stdout +32 -0
- data/spec/integration/help/help_1.cmd +1 -0
- data/spec/integration/help/help_1.stdout +25 -0
- data/spec/integration/intersect/intersect_0.cmd +1 -0
- data/spec/integration/intersect/intersect_0.stdout +9 -0
- data/spec/integration/join/join_0.cmd +1 -0
- data/spec/integration/join/join_0.stdout +16 -0
- data/spec/integration/matching/matching_0.cmd +1 -0
- data/spec/integration/matching/matching_0.stdout +8 -0
- data/spec/integration/minus/minus_0.cmd +1 -0
- data/spec/integration/minus/minus_0.stdout +4 -0
- data/spec/integration/not-matching/not-matching_0.cmd +1 -0
- data/spec/integration/not-matching/not-matching_0.stdout +5 -0
- data/spec/integration/project/project_0.cmd +1 -0
- data/spec/integration/project/project_0.stdout +9 -0
- data/spec/integration/project/project_1.cmd +1 -0
- data/spec/integration/project/project_1.stdout +9 -0
- data/spec/integration/quota/quota_0.cmd +1 -0
- data/spec/integration/quota/quota_0.stdout +16 -0
- data/spec/integration/rank/rank_1.cmd +1 -0
- data/spec/integration/rank/rank_1.stdout +10 -0
- data/spec/integration/rank/rank_2.cmd +1 -0
- data/spec/integration/rank/rank_2.stdout +10 -0
- data/spec/integration/rank/rank_3.cmd +1 -0
- data/spec/integration/rank/rank_3.stdout +10 -0
- data/spec/integration/rank/rank_4.cmd +1 -0
- data/spec/integration/rank/rank_4.stdout +6 -0
- data/spec/integration/rank/rank_5.cmd +1 -0
- data/spec/integration/rank/rank_5.stdout +6 -0
- data/spec/integration/rename/rename_0.cmd +1 -0
- data/spec/integration/rename/rename_0.stdout +9 -0
- data/spec/integration/restrict/restrict_0.cmd +1 -0
- data/spec/integration/restrict/restrict_0.stdout +6 -0
- data/spec/integration/restrict/restrict_1.cmd +1 -0
- data/spec/integration/restrict/restrict_1.stdout +6 -0
- data/spec/integration/show/show_base.cmd +1 -0
- data/spec/integration/show/show_base.stdout +5 -0
- data/spec/integration/show/show_base_sort_1.cmd +1 -0
- data/spec/integration/show/show_base_sort_1.stdout +9 -0
- data/spec/integration/show/show_base_sort_2.cmd +1 -0
- data/spec/integration/show/show_base_sort_2.stdout +9 -0
- data/spec/integration/show/show_conflictual.cmd +1 -0
- data/spec/integration/show/show_conflictual.stdout +5 -0
- data/spec/integration/show/show_ff.cmd +1 -0
- data/spec/integration/show/show_ff.stdout +10 -0
- data/spec/integration/show/show_rash.cmd +1 -0
- data/spec/integration/show/show_rash.stdout +5 -0
- data/spec/integration/show/show_rash_pretty.cmd +1 -0
- data/spec/integration/show/show_rash_pretty.stdout +30 -0
- data/spec/integration/show/show_yaml.cmd +1 -0
- data/spec/integration/show/show_yaml.stdout +22 -0
- data/spec/integration/sort/sort_0.cmd +1 -0
- data/spec/integration/sort/sort_0.stdout +9 -0
- data/spec/integration/sort/sort_1.cmd +1 -0
- data/spec/integration/sort/sort_1.stdout +9 -0
- data/spec/integration/sort/sort_2.cmd +1 -0
- data/spec/integration/sort/sort_2.stdout +9 -0
- data/spec/integration/sort/sort_3.cmd +1 -0
- data/spec/integration/sort/sort_3.stdout +9 -0
- data/spec/integration/summarize/summarize_0.cmd +1 -0
- data/spec/integration/summarize/summarize_0.stdout +8 -0
- data/spec/integration/test_shell.rb +56 -0
- data/spec/integration/union/union_0.cmd +1 -0
- data/spec/integration/union/union_0.stdout +9 -0
- data/spec/integration/unwrap/unwrap_0.cmd +1 -0
- data/spec/integration/unwrap/unwrap_0.stdout +9 -0
- data/spec/integration/wrap/wrap_0.cmd +1 -0
- data/spec/integration/wrap/wrap_0.stdout +9 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/test_shell.rb +10 -0
- data/spec/unit/doc_manager/dynamic.md +1 -0
- data/spec/unit/doc_manager/example.md +1 -0
- data/spec/unit/doc_manager/example_1.txt +11 -0
- data/spec/unit/doc_manager/static.md +1 -0
- data/spec/unit/doc_manager/test_call.rb +43 -0
- data/spec/unit/ext/signature/test_argv2args.rb +82 -0
- data/spec/unit/ext/signature/test_to_shell.rb +103 -0
- data/spec/unit/from_argv/test_to_attr_list.rb +30 -0
- data/spec/unit/from_argv/test_to_attr_name.rb +27 -0
- data/spec/unit/from_argv/test_to_boolean.rb +32 -0
- data/spec/unit/from_argv/test_to_heading.rb +37 -0
- data/spec/unit/from_argv/test_to_ordering.rb +28 -0
- data/spec/unit/from_argv/test_to_predicate.rb +26 -0
- data/spec/unit/from_argv/test_to_renaming.rb +23 -0
- data/spec/unit/from_argv/test_to_size.rb +32 -0
- data/spec/unit/from_argv/test_to_summarization.rb +19 -0
- data/spec/unit/from_argv/test_to_tuple_computation.rb +18 -0
- data/spec/unit/from_argv/test_to_tuple_expression.rb +38 -0
- data/spec/unit/main/test_class_methods.rb +44 -0
- data/spec/unit/operator/test_autonum.rb +28 -0
- data/spec/unit/operator/test_clip.rb +29 -0
- data/spec/unit/operator/test_coerce.rb +22 -0
- data/spec/unit/operator/test_compact.rb +16 -0
- data/spec/unit/operator/test_defaults.rb +29 -0
- data/spec/unit/operator/test_extend.rb +21 -0
- data/spec/unit/operator/test_generator.rb +37 -0
- data/spec/unit/operator/test_group.rb +32 -0
- data/spec/unit/operator/test_infer_heading.rb +16 -0
- data/spec/unit/operator/test_intersect.rb +18 -0
- data/spec/unit/operator/test_join.rb +18 -0
- data/spec/unit/operator/test_matching.rb +18 -0
- data/spec/unit/operator/test_minus.rb +18 -0
- data/spec/unit/operator/test_not_matching.rb +18 -0
- data/spec/unit/operator/test_project.rb +38 -0
- data/spec/unit/operator/test_quota.rb +23 -0
- data/spec/unit/operator/test_rank.rb +30 -0
- data/spec/unit/operator/test_rename.rb +21 -0
- data/spec/unit/operator/test_restrict.rb +36 -0
- data/spec/unit/operator/test_sort.rb +49 -0
- data/spec/unit/operator/test_summarize.rb +30 -0
- data/spec/unit/operator/test_ungroup.rb +28 -0
- data/spec/unit/operator/test_union.rb +18 -0
- data/spec/unit/operator/test_unwrap.rb +28 -0
- data/spec/unit/operator/test_wrap.rb +30 -0
- data/tasks/gem.rake +8 -0
- data/tasks/test.rake +6 -0
- metadata +317 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Minus do
|
4
|
+
|
5
|
+
let(:left) { suppliers }
|
6
|
+
let(:right){ suppliers }
|
7
|
+
subject{ Minus.run(argv) }
|
8
|
+
|
9
|
+
context "the default config" do
|
10
|
+
let(:argv){ [left, right] }
|
11
|
+
specify{
|
12
|
+
subject.should be_a(Alf::Algebra::Minus)
|
13
|
+
subject.operands.should eq([left, right])
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe NotMatching do
|
4
|
+
|
5
|
+
let(:left) { suppliers }
|
6
|
+
let(:right){ suppliers }
|
7
|
+
subject{ NotMatching.run(argv) }
|
8
|
+
|
9
|
+
context "the default config" do
|
10
|
+
let(:argv){ [left, right] }
|
11
|
+
specify{
|
12
|
+
subject.should be_a(Alf::Algebra::NotMatching)
|
13
|
+
subject.operands.should eq([left, right])
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Project do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Project.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Project)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "--no-allbut" do
|
14
|
+
let(:argv){ [input, "--", "a", "b"] }
|
15
|
+
specify{
|
16
|
+
subject.attributes.should eq(Alf::AttrList[:a, :b])
|
17
|
+
subject.allbut.should eq(false)
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
context "--allbut" do
|
22
|
+
let(:argv){ [input, "--allbut", "--", "a", "b"] }
|
23
|
+
specify{
|
24
|
+
subject.attributes.should eq(Alf::AttrList[:a, :b])
|
25
|
+
subject.allbut.should eq(true)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
context "none projected" do
|
30
|
+
let(:argv){ [input] }
|
31
|
+
specify{
|
32
|
+
subject.attributes.should eq(Alf::AttrList[])
|
33
|
+
subject.allbut.should eq(false)
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Quota do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Quota.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Quota)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "a typical config" do
|
14
|
+
let(:argv){ [input] + ["--", "a", "--", "time", "--", "time_sum", "sum{ time }"] }
|
15
|
+
specify{
|
16
|
+
subject.by.should eq(Alf::AttrList[:a])
|
17
|
+
subject.order.should eq(Alf::Ordering[[:time, :asc]])
|
18
|
+
subject.summarization.should eq(Alf::Summarization[:time_sum => "sum{ time }"])
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Rank do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Rank.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Rank)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "without name" do
|
14
|
+
let(:argv){ [input, "--", "time"] }
|
15
|
+
specify{
|
16
|
+
subject.order.should eq(Alf::Ordering[[:time, :asc]])
|
17
|
+
subject.as.should eq(:rank)
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with explicit name" do
|
22
|
+
let(:argv){ [input, "--","time", "desc", "--", "newname"] }
|
23
|
+
specify{
|
24
|
+
subject.order.should eq(Alf::Ordering[[:time, :desc]])
|
25
|
+
subject.as.should eq(:newname)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Rename do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Rename.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Rename)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "a typical config" do
|
14
|
+
let(:argv){ [input, '--', 'a', 'z'] }
|
15
|
+
specify{
|
16
|
+
subject.renaming.should eq(Alf::Renaming[:a => :z])
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Restrict do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Restrict.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Restrict)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "without arg" do
|
14
|
+
let(:argv){ [input] }
|
15
|
+
specify{
|
16
|
+
subject.predicate.should eq(Alf::Predicate.coerce(true))
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with a single arg" do
|
21
|
+
let(:argv){ [ input ] + ["--", "status > 10"] }
|
22
|
+
specify{
|
23
|
+
subject.predicate.should be_a(Alf::Predicate)
|
24
|
+
subject.predicate.to_ruby_code.should eq("status > 10")
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
context "with two args" do
|
29
|
+
let(:argv){ [ input ] + ["--", "status", "10"] }
|
30
|
+
specify{
|
31
|
+
subject.predicate.should eq(Alf::Predicate.comp(:eq, :status => 10))
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Sort do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Sort.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Sort)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with empty args" do
|
14
|
+
let(:argv){ [input] + %w{} }
|
15
|
+
specify{
|
16
|
+
subject.ordering.should eq(Alf::Ordering.new([]))
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with one arg" do
|
21
|
+
let(:argv){ [input] + %w{-- name} }
|
22
|
+
specify{
|
23
|
+
subject.ordering.should eq(Alf::Ordering[[:name, :asc]])
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with two args" do
|
28
|
+
let(:argv){ [input] + %w{-- first last} }
|
29
|
+
specify{
|
30
|
+
subject.ordering.should eq(Alf::Ordering[[[:first, :asc], [:last, :asc]]])
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
context "with explicit ordering" do
|
35
|
+
let(:argv){ [input] + %w{-- first desc} }
|
36
|
+
specify{
|
37
|
+
subject.ordering.should eq(Alf::Ordering[[[:first, :desc]]])
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
context "with explicit ordering on multiple" do
|
42
|
+
let(:argv){ [input] + %w{-- first desc last asc} }
|
43
|
+
specify{
|
44
|
+
subject.ordering.should eq(Alf::Ordering[[[:first, :desc], [:last, :asc]]])
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Summarize do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Summarize.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Summarize)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
subject.by.should eq(Alf::AttrList[:a])
|
12
|
+
subject.summarization.should eq(Alf::Summarization[:time_sum => "sum{ time }"])
|
13
|
+
end
|
14
|
+
|
15
|
+
context "--no-allbut" do
|
16
|
+
let(:argv){ [input] + ["--", "a", "--", "time_sum", "sum{ time }"] }
|
17
|
+
specify{
|
18
|
+
subject.allbut.should eq(false)
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
context "--allbut" do
|
23
|
+
let(:argv){ [input] + ["--allbut", "--", "a", "--", "time_sum", "sum{ time }"] }
|
24
|
+
specify{
|
25
|
+
subject.allbut.should eq(true)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Ungroup do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Ungroup.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Ungroup)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "without name" do
|
14
|
+
let(:argv){ [input] }
|
15
|
+
specify{
|
16
|
+
subject.attribute.should eq(:grouped)
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with a name" do
|
21
|
+
let(:argv){ [input] + %w{-- attrname} }
|
22
|
+
specify{
|
23
|
+
subject.attribute.should eq(:attrname)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Union do
|
4
|
+
|
5
|
+
let(:left) { suppliers }
|
6
|
+
let(:right){ suppliers }
|
7
|
+
subject{ Union.run(argv) }
|
8
|
+
|
9
|
+
context "the default config" do
|
10
|
+
let(:argv){ [left, right] }
|
11
|
+
specify{
|
12
|
+
subject.should be_a(Alf::Algebra::Union)
|
13
|
+
subject.operands.should eq([left, right])
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Unwrap do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Unwrap.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Unwrap)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "without name" do
|
14
|
+
let(:argv){ [input] }
|
15
|
+
specify{
|
16
|
+
subject.attribute.should eq(:wrapped)
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with a name" do
|
21
|
+
let(:argv){ [input] + %w{-- attrname} }
|
22
|
+
specify{
|
23
|
+
subject.attribute.should eq(:attrname)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf::Shell::Operator
|
3
|
+
describe Wrap do
|
4
|
+
|
5
|
+
let(:input){ suppliers }
|
6
|
+
subject{ Wrap.run(argv) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject.should be_a(Alf::Algebra::Wrap)
|
10
|
+
subject.operands.should eq([input])
|
11
|
+
end
|
12
|
+
|
13
|
+
context "without name" do
|
14
|
+
let(:argv){ [input, "--", "a", "b"] }
|
15
|
+
specify{
|
16
|
+
subject.attributes.should eq(Alf::AttrList[:a, :b])
|
17
|
+
subject.as.should eq(:wrapped)
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with a name" do
|
22
|
+
let(:argv){ [input, "--", "a", "b", "--", "attrname"] }
|
23
|
+
specify{
|
24
|
+
subject.attributes.should eq(Alf::AttrList[:a, :b])
|
25
|
+
subject.as.should eq(:attrname)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'rubygems/package_task'
|
2
|
+
gemspec_file = File.expand_path('../../alf-shell.gemspec', __FILE__)
|
3
|
+
gemspec = Kernel.eval(File.read(gemspec_file))
|
4
|
+
Gem::PackageTask.new(gemspec) do |t|
|
5
|
+
t.name = gemspec.name
|
6
|
+
t.version = gemspec.version
|
7
|
+
t.package_files = gemspec.files
|
8
|
+
end
|
data/tasks/test.rake
ADDED
metadata
ADDED
@@ -0,0 +1,317 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alf-shell
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.13.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bernard Lambeau
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '10.1'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '10.1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.14'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.14'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: highline
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.6'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: alf-core
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.13.0
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.13.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: quickl
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.4.3
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.4.3
|
94
|
+
description: This project implements the `alf` commandline tool.
|
95
|
+
email:
|
96
|
+
- blambeau at gmail.com
|
97
|
+
executables:
|
98
|
+
- alf
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- CHANGELOG.md
|
103
|
+
- Gemfile
|
104
|
+
- Gemfile.lock
|
105
|
+
- bin/alf
|
106
|
+
- lib/alf/shell/command/exec.rb
|
107
|
+
- lib/alf/shell/command/help.rb
|
108
|
+
- lib/alf/shell/command/main.rb
|
109
|
+
- lib/alf/shell/command/show.rb
|
110
|
+
- lib/alf/shell/command.rb
|
111
|
+
- lib/alf/shell/doc_manager.rb
|
112
|
+
- lib/alf/shell/ext/signature.rb
|
113
|
+
- lib/alf/shell/from_argv.rb
|
114
|
+
- lib/alf/shell/loader.rb
|
115
|
+
- lib/alf/shell/operator.rb
|
116
|
+
- lib/alf/shell/support.rb
|
117
|
+
- lib/alf/shell/version.rb
|
118
|
+
- lib/alf/shell.rb
|
119
|
+
- lib/alf-shell.rb
|
120
|
+
- LICENCE.md
|
121
|
+
- Manifest.txt
|
122
|
+
- Rakefile
|
123
|
+
- README.md
|
124
|
+
- spec/integration/__database__/group.alf
|
125
|
+
- spec/integration/__database__/parts.rash
|
126
|
+
- spec/integration/__database__/suppliers.rash
|
127
|
+
- spec/integration/__database__/suppliers_csv.csv
|
128
|
+
- spec/integration/__database__/supplies.rash
|
129
|
+
- spec/integration/alf/alf.db
|
130
|
+
- spec/integration/alf/alf_db.cmd
|
131
|
+
- spec/integration/alf/alf_db.stdout
|
132
|
+
- spec/integration/alf/alf_e.cmd
|
133
|
+
- spec/integration/alf/alf_e.stdout
|
134
|
+
- spec/integration/alf/alf_help.cmd
|
135
|
+
- spec/integration/alf/alf_help.stdout
|
136
|
+
- spec/integration/alf/alf_json.cmd
|
137
|
+
- spec/integration/alf/alf_json.stdout
|
138
|
+
- spec/integration/alf/alf_r.cmd
|
139
|
+
- spec/integration/alf/alf_r.stdout
|
140
|
+
- spec/integration/alf/alf_version.cmd
|
141
|
+
- spec/integration/alf/alf_version.stdout
|
142
|
+
- spec/integration/alf/alf_yaml.cmd
|
143
|
+
- spec/integration/alf/alf_yaml.stdout
|
144
|
+
- spec/integration/alf/rel.rash
|
145
|
+
- spec/integration/autonum/autonum_0.cmd
|
146
|
+
- spec/integration/autonum/autonum_0.stdout
|
147
|
+
- spec/integration/autonum/autonum_1.cmd
|
148
|
+
- spec/integration/autonum/autonum_1.stdout
|
149
|
+
- spec/integration/clip/clip_0.cmd
|
150
|
+
- spec/integration/clip/clip_0.stdout
|
151
|
+
- spec/integration/clip/clip_1.cmd
|
152
|
+
- spec/integration/clip/clip_1.stdout
|
153
|
+
- spec/integration/coerce/coerce_1.cmd
|
154
|
+
- spec/integration/coerce/coerce_1.stdout
|
155
|
+
- spec/integration/compact/compact_0.cmd
|
156
|
+
- spec/integration/compact/compact_0.stdout
|
157
|
+
- spec/integration/defaults/defaults_0.cmd
|
158
|
+
- spec/integration/defaults/defaults_0.stdout
|
159
|
+
- spec/integration/defaults/defaults_1.cmd
|
160
|
+
- spec/integration/defaults/defaults_1.stdout
|
161
|
+
- spec/integration/defaults/defaults_2.cmd
|
162
|
+
- spec/integration/defaults/defaults_2.stdout
|
163
|
+
- spec/integration/extend/extend_0.cmd
|
164
|
+
- spec/integration/extend/extend_0.stdout
|
165
|
+
- spec/integration/generator/generator_1.cmd
|
166
|
+
- spec/integration/generator/generator_1.stdout
|
167
|
+
- spec/integration/generator/generator_2.cmd
|
168
|
+
- spec/integration/generator/generator_2.stdout
|
169
|
+
- spec/integration/generator/generator_3.cmd
|
170
|
+
- spec/integration/generator/generator_3.stdout
|
171
|
+
- spec/integration/group/group_0.cmd
|
172
|
+
- spec/integration/group/group_0.stdout
|
173
|
+
- spec/integration/group/group_1.cmd
|
174
|
+
- spec/integration/group/group_1.stdout
|
175
|
+
- spec/integration/help/help_1.cmd
|
176
|
+
- spec/integration/help/help_1.stdout
|
177
|
+
- spec/integration/intersect/intersect_0.cmd
|
178
|
+
- spec/integration/intersect/intersect_0.stdout
|
179
|
+
- spec/integration/join/join_0.cmd
|
180
|
+
- spec/integration/join/join_0.stdout
|
181
|
+
- spec/integration/matching/matching_0.cmd
|
182
|
+
- spec/integration/matching/matching_0.stdout
|
183
|
+
- spec/integration/minus/minus_0.cmd
|
184
|
+
- spec/integration/minus/minus_0.stdout
|
185
|
+
- spec/integration/not-matching/not-matching_0.cmd
|
186
|
+
- spec/integration/not-matching/not-matching_0.stdout
|
187
|
+
- spec/integration/project/project_0.cmd
|
188
|
+
- spec/integration/project/project_0.stdout
|
189
|
+
- spec/integration/project/project_1.cmd
|
190
|
+
- spec/integration/project/project_1.stdout
|
191
|
+
- spec/integration/quota/quota_0.cmd
|
192
|
+
- spec/integration/quota/quota_0.stdout
|
193
|
+
- spec/integration/rank/rank_1.cmd
|
194
|
+
- spec/integration/rank/rank_1.stdout
|
195
|
+
- spec/integration/rank/rank_2.cmd
|
196
|
+
- spec/integration/rank/rank_2.stdout
|
197
|
+
- spec/integration/rank/rank_3.cmd
|
198
|
+
- spec/integration/rank/rank_3.stdout
|
199
|
+
- spec/integration/rank/rank_4.cmd
|
200
|
+
- spec/integration/rank/rank_4.stdout
|
201
|
+
- spec/integration/rank/rank_5.cmd
|
202
|
+
- spec/integration/rank/rank_5.stdout
|
203
|
+
- spec/integration/rename/rename_0.cmd
|
204
|
+
- spec/integration/rename/rename_0.stdout
|
205
|
+
- spec/integration/restrict/restrict_0.cmd
|
206
|
+
- spec/integration/restrict/restrict_0.stdout
|
207
|
+
- spec/integration/restrict/restrict_1.cmd
|
208
|
+
- spec/integration/restrict/restrict_1.stdout
|
209
|
+
- spec/integration/show/show_base.cmd
|
210
|
+
- spec/integration/show/show_base.stdout
|
211
|
+
- spec/integration/show/show_base_sort_1.cmd
|
212
|
+
- spec/integration/show/show_base_sort_1.stdout
|
213
|
+
- spec/integration/show/show_base_sort_2.cmd
|
214
|
+
- spec/integration/show/show_base_sort_2.stdout
|
215
|
+
- spec/integration/show/show_conflictual.cmd
|
216
|
+
- spec/integration/show/show_conflictual.stdout
|
217
|
+
- spec/integration/show/show_ff.cmd
|
218
|
+
- spec/integration/show/show_ff.stdout
|
219
|
+
- spec/integration/show/show_rash.cmd
|
220
|
+
- spec/integration/show/show_rash.stdout
|
221
|
+
- spec/integration/show/show_rash_pretty.cmd
|
222
|
+
- spec/integration/show/show_rash_pretty.stdout
|
223
|
+
- spec/integration/show/show_yaml.cmd
|
224
|
+
- spec/integration/show/show_yaml.stdout
|
225
|
+
- spec/integration/sort/sort_0.cmd
|
226
|
+
- spec/integration/sort/sort_0.stdout
|
227
|
+
- spec/integration/sort/sort_1.cmd
|
228
|
+
- spec/integration/sort/sort_1.stdout
|
229
|
+
- spec/integration/sort/sort_2.cmd
|
230
|
+
- spec/integration/sort/sort_2.stdout
|
231
|
+
- spec/integration/sort/sort_3.cmd
|
232
|
+
- spec/integration/sort/sort_3.stdout
|
233
|
+
- spec/integration/summarize/summarize_0.cmd
|
234
|
+
- spec/integration/summarize/summarize_0.stdout
|
235
|
+
- spec/integration/test_shell.rb
|
236
|
+
- spec/integration/union/union_0.cmd
|
237
|
+
- spec/integration/union/union_0.stdout
|
238
|
+
- spec/integration/unwrap/unwrap_0.cmd
|
239
|
+
- spec/integration/unwrap/unwrap_0.stdout
|
240
|
+
- spec/integration/wrap/wrap_0.cmd
|
241
|
+
- spec/integration/wrap/wrap_0.stdout
|
242
|
+
- spec/spec_helper.rb
|
243
|
+
- spec/test_shell.rb
|
244
|
+
- spec/unit/doc_manager/dynamic.md
|
245
|
+
- spec/unit/doc_manager/example.md
|
246
|
+
- spec/unit/doc_manager/example_1.txt
|
247
|
+
- spec/unit/doc_manager/static.md
|
248
|
+
- spec/unit/doc_manager/test_call.rb
|
249
|
+
- spec/unit/ext/signature/test_argv2args.rb
|
250
|
+
- spec/unit/ext/signature/test_to_shell.rb
|
251
|
+
- spec/unit/from_argv/test_to_attr_list.rb
|
252
|
+
- spec/unit/from_argv/test_to_attr_name.rb
|
253
|
+
- spec/unit/from_argv/test_to_boolean.rb
|
254
|
+
- spec/unit/from_argv/test_to_heading.rb
|
255
|
+
- spec/unit/from_argv/test_to_ordering.rb
|
256
|
+
- spec/unit/from_argv/test_to_predicate.rb
|
257
|
+
- spec/unit/from_argv/test_to_renaming.rb
|
258
|
+
- spec/unit/from_argv/test_to_size.rb
|
259
|
+
- spec/unit/from_argv/test_to_summarization.rb
|
260
|
+
- spec/unit/from_argv/test_to_tuple_computation.rb
|
261
|
+
- spec/unit/from_argv/test_to_tuple_expression.rb
|
262
|
+
- spec/unit/main/test_class_methods.rb
|
263
|
+
- spec/unit/operator/test_autonum.rb
|
264
|
+
- spec/unit/operator/test_clip.rb
|
265
|
+
- spec/unit/operator/test_coerce.rb
|
266
|
+
- spec/unit/operator/test_compact.rb
|
267
|
+
- spec/unit/operator/test_defaults.rb
|
268
|
+
- spec/unit/operator/test_extend.rb
|
269
|
+
- spec/unit/operator/test_generator.rb
|
270
|
+
- spec/unit/operator/test_group.rb
|
271
|
+
- spec/unit/operator/test_infer_heading.rb
|
272
|
+
- spec/unit/operator/test_intersect.rb
|
273
|
+
- spec/unit/operator/test_join.rb
|
274
|
+
- spec/unit/operator/test_matching.rb
|
275
|
+
- spec/unit/operator/test_minus.rb
|
276
|
+
- spec/unit/operator/test_not_matching.rb
|
277
|
+
- spec/unit/operator/test_project.rb
|
278
|
+
- spec/unit/operator/test_quota.rb
|
279
|
+
- spec/unit/operator/test_rank.rb
|
280
|
+
- spec/unit/operator/test_rename.rb
|
281
|
+
- spec/unit/operator/test_restrict.rb
|
282
|
+
- spec/unit/operator/test_sort.rb
|
283
|
+
- spec/unit/operator/test_summarize.rb
|
284
|
+
- spec/unit/operator/test_ungroup.rb
|
285
|
+
- spec/unit/operator/test_union.rb
|
286
|
+
- spec/unit/operator/test_unwrap.rb
|
287
|
+
- spec/unit/operator/test_wrap.rb
|
288
|
+
- tasks/gem.rake
|
289
|
+
- tasks/test.rake
|
290
|
+
homepage: http://github.com/alf-tool/alf-shell
|
291
|
+
licenses: []
|
292
|
+
post_install_message:
|
293
|
+
rdoc_options: []
|
294
|
+
require_paths:
|
295
|
+
- lib
|
296
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
297
|
+
none: false
|
298
|
+
requirements:
|
299
|
+
- - ! '>='
|
300
|
+
- !ruby/object:Gem::Version
|
301
|
+
version: '0'
|
302
|
+
segments:
|
303
|
+
- 0
|
304
|
+
hash: -1701275740849508639
|
305
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
306
|
+
none: false
|
307
|
+
requirements:
|
308
|
+
- - ! '>='
|
309
|
+
- !ruby/object:Gem::Version
|
310
|
+
version: '0'
|
311
|
+
requirements: []
|
312
|
+
rubyforge_project:
|
313
|
+
rubygems_version: 1.8.25
|
314
|
+
signing_key:
|
315
|
+
specification_version: 3
|
316
|
+
summary: Bring Alf's relational algebra to the shell
|
317
|
+
test_files: []
|