hotdog 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ describe "tag regexp expression" do
10
10
  }
11
11
 
12
12
  it "interprets tag regexp with host" do
13
- expr = Hotdog::Commands::Search::RegexpHostNode.new("foo", ":")
13
+ expr = Hotdog::Expression::RegexpHostNode.new("foo", ":")
14
14
  q = [
15
15
  "SELECT hosts.id AS host_id FROM hosts",
16
16
  "WHERE hosts.name REGEXP ?;",
@@ -19,11 +19,11 @@ describe "tag regexp expression" do
19
19
  [[1], [2], [3]]
20
20
  }
21
21
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
22
- expect(expr.dump).to eq({identifier_regexp: "host", separator: ":", attribute_regexp: "foo"})
22
+ expect(expr.dump).to eq({tag_name_regexp: "host", separator: ":", tag_value_regexp: "foo"})
23
23
  end
24
24
 
25
- it "interprets tag regexp with identifier and attribute" do
26
- expr = Hotdog::Commands::Search::RegexpTagNode.new("foo", "bar", ":")
25
+ it "interprets tag regexp with tag_name and tag_value" do
26
+ expr = Hotdog::Expression::RegexpTagNode.new("foo", "bar", ":")
27
27
  q = [
28
28
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
29
29
  "INNER JOIN tags ON hosts_tags.tag_id = tags.id",
@@ -33,11 +33,11 @@ describe "tag regexp expression" do
33
33
  [[1], [2], [3]]
34
34
  }
35
35
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
36
- expect(expr.dump).to eq({identifier_regexp: "foo", separator: ":", attribute_regexp: "bar"})
36
+ expect(expr.dump).to eq({tag_name_regexp: "foo", separator: ":", tag_value_regexp: "bar"})
37
37
  end
38
38
 
39
- it "interprets tag regexp with identifier with separator" do
40
- expr = Hotdog::Commands::Search::RegexpTagNameNode.new("foo", ":")
39
+ it "interprets tag regexp with tag_name with separator" do
40
+ expr = Hotdog::Expression::RegexpTagNameNode.new("foo", ":")
41
41
  q = [
42
42
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
43
43
  "INNER JOIN tags ON hosts_tags.tag_id = tags.id",
@@ -47,11 +47,11 @@ describe "tag regexp expression" do
47
47
  [[1], [2], [3]]
48
48
  }
49
49
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
50
- expect(expr.dump).to eq({identifier_regexp: "foo", separator: ":"})
50
+ expect(expr.dump).to eq({tag_name_regexp: "foo", separator: ":"})
51
51
  end
52
52
 
53
- it "interprets tag regexp with identifier without separator" do
54
- expr = Hotdog::Commands::Search::RegexpNode.new("foo", nil)
53
+ it "interprets tag regexp with tag_name without separator" do
54
+ expr = Hotdog::Expression::RegexpNode.new("foo", nil)
55
55
  q = [
56
56
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
57
57
  "INNER JOIN hosts ON hosts_tags.host_id = hosts.id",
@@ -62,11 +62,11 @@ describe "tag regexp expression" do
62
62
  [[1], [2], [3]]
63
63
  }
64
64
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
65
- expect(expr.dump).to eq({identifier_regexp: "foo"})
65
+ expect(expr.dump).to eq({tag_name_regexp: "foo"})
66
66
  end
67
67
 
68
- it "interprets tag regexp with attribute with separator" do
69
- expr = Hotdog::Commands::Search::RegexpTagValueNode.new("foo", ":")
68
+ it "interprets tag regexp with tag_value with separator" do
69
+ expr = Hotdog::Expression::RegexpTagValueNode.new("foo", ":")
70
70
  q = [
71
71
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
72
72
  "INNER JOIN hosts ON hosts_tags.host_id = hosts.id",
@@ -77,11 +77,11 @@ describe "tag regexp expression" do
77
77
  [[1], [2], [3]]
78
78
  }
79
79
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
80
- expect(expr.dump).to eq({separator: ":", attribute_regexp: "foo"})
80
+ expect(expr.dump).to eq({separator: ":", tag_value_regexp: "foo"})
81
81
  end
82
82
 
83
- it "interprets tag regexp with attribute without separator" do
84
- expr = Hotdog::Commands::Search::RegexpTagValueNode.new("foo", nil)
83
+ it "interprets tag regexp with tag_value without separator" do
84
+ expr = Hotdog::Expression::RegexpTagValueNode.new("foo", nil)
85
85
  q = [
86
86
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
87
87
  "INNER JOIN hosts ON hosts_tags.host_id = hosts.id",
@@ -92,11 +92,11 @@ describe "tag regexp expression" do
92
92
  [[1], [2], [3]]
93
93
  }
94
94
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
95
- expect(expr.dump).to eq({attribute_regexp: "foo"})
95
+ expect(expr.dump).to eq({tag_value_regexp: "foo"})
96
96
  end
97
97
 
98
98
  it "empty tag regexp" do
99
- expr = Hotdog::Commands::Search::RegexpExpressionNode.new(nil, nil, nil)
99
+ expr = Hotdog::Expression::RegexpExpressionNode.new(nil, nil, nil)
100
100
  expect {
101
101
  expr.evaluate(cmd)
102
102
  }.to raise_error(NotImplementedError)
@@ -10,7 +10,7 @@ describe "tag expression" do
10
10
  }
11
11
 
12
12
  it "interprets tag with host" do
13
- expr = Hotdog::Commands::Search::StringHostNode.new("foo", ":")
13
+ expr = Hotdog::Expression::StringHostNode.new("foo", ":")
14
14
  q = [
15
15
  "SELECT hosts.id AS host_id FROM hosts",
16
16
  "WHERE hosts.name = ?;",
@@ -19,11 +19,11 @@ describe "tag expression" do
19
19
  [[1], [2], [3]]
20
20
  }
21
21
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
22
- expect(expr.dump).to eq({identifier: "host", separator: ":", attribute: "foo"})
22
+ expect(expr.dump).to eq({tag_name: "host", separator: ":", tag_value: "foo"})
23
23
  end
24
24
 
25
- it "interprets tag with identifier and attribute" do
26
- expr = Hotdog::Commands::Search::StringTagNode.new("foo", "bar", ":")
25
+ it "interprets tag with tag_name and tag_value" do
26
+ expr = Hotdog::Expression::StringTagNode.new("foo", "bar", ":")
27
27
  q = [
28
28
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
29
29
  "INNER JOIN tags ON hosts_tags.tag_id = tags.id",
@@ -33,11 +33,11 @@ describe "tag expression" do
33
33
  [[1], [2], [3]]
34
34
  }
35
35
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
36
- expect(expr.dump).to eq({identifier: "foo", separator: ":", attribute: "bar"})
36
+ expect(expr.dump).to eq({tag_name: "foo", separator: ":", tag_value: "bar"})
37
37
  end
38
38
 
39
- it "interprets tag with identifier with separator" do
40
- expr = Hotdog::Commands::Search::StringTagNameNode.new("foo", ":")
39
+ it "interprets tag with tag_name with separator" do
40
+ expr = Hotdog::Expression::StringTagNameNode.new("foo", ":")
41
41
  q = [
42
42
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
43
43
  "INNER JOIN tags ON hosts_tags.tag_id = tags.id",
@@ -47,11 +47,11 @@ describe "tag expression" do
47
47
  [[1], [2], [3]]
48
48
  }
49
49
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
50
- expect(expr.dump).to eq({identifier: "foo", separator: ":"})
50
+ expect(expr.dump).to eq({tag_name: "foo", separator: ":"})
51
51
  end
52
52
 
53
- it "interprets tag with identifier without separator" do
54
- expr = Hotdog::Commands::Search::StringNode.new("foo", nil)
53
+ it "interprets tag with tag_name without separator" do
54
+ expr = Hotdog::Expression::StringNode.new("foo", nil)
55
55
  q = [
56
56
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
57
57
  "INNER JOIN hosts ON hosts_tags.host_id = hosts.id",
@@ -62,11 +62,11 @@ describe "tag expression" do
62
62
  [[1], [2], [3]]
63
63
  }
64
64
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
65
- expect(expr.dump).to eq({identifier: "foo"})
65
+ expect(expr.dump).to eq({tag_name: "foo"})
66
66
  end
67
67
 
68
- it "interprets tag with attribute with separator" do
69
- expr = Hotdog::Commands::Search::StringTagValueNode.new("foo", ":")
68
+ it "interprets tag with tag_value with separator" do
69
+ expr = Hotdog::Expression::StringTagValueNode.new("foo", ":")
70
70
  q = [
71
71
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
72
72
  "INNER JOIN hosts ON hosts_tags.host_id = hosts.id",
@@ -77,11 +77,11 @@ describe "tag expression" do
77
77
  [[1], [2], [3]]
78
78
  }
79
79
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
80
- expect(expr.dump).to eq({separator: ":", attribute: "foo"})
80
+ expect(expr.dump).to eq({separator: ":", tag_value: "foo"})
81
81
  end
82
82
 
83
- it "interprets tag with attribute without separator" do
84
- expr = Hotdog::Commands::Search::StringTagValueNode.new("foo", nil)
83
+ it "interprets tag with tag_value without separator" do
84
+ expr = Hotdog::Expression::StringTagValueNode.new("foo", nil)
85
85
  q = [
86
86
  "SELECT DISTINCT hosts_tags.host_id FROM hosts_tags",
87
87
  "INNER JOIN hosts ON hosts_tags.host_id = hosts.id",
@@ -92,11 +92,11 @@ describe "tag expression" do
92
92
  [[1], [2], [3]]
93
93
  }
94
94
  expect(expr.evaluate(cmd)).to eq([1, 2, 3])
95
- expect(expr.dump).to eq({attribute: "foo"})
95
+ expect(expr.dump).to eq({tag_value: "foo"})
96
96
  end
97
97
 
98
98
  it "empty tag" do
99
- expr = Hotdog::Commands::Search::StringExpressionNode.new(nil, nil, nil)
99
+ expr = Hotdog::Expression::StringExpressionNode.new(nil, nil, nil)
100
100
  expect {
101
101
  expr.evaluate(cmd)
102
102
  }.to raise_error(NotImplementedError)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotdog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamashita Yuu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-07 00:00:00.000000000 Z
11
+ date: 2016-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -182,6 +182,9 @@ files:
182
182
  - lib/hotdog/commands/tags.rb
183
183
  - lib/hotdog/commands/up.rb
184
184
  - lib/hotdog/commands/version.rb
185
+ - lib/hotdog/expression.rb
186
+ - lib/hotdog/expression/semantics.rb
187
+ - lib/hotdog/expression/syntax.rb
185
188
  - lib/hotdog/formatters.rb
186
189
  - lib/hotdog/formatters/csv.rb
187
190
  - lib/hotdog/formatters/json.rb