hotdog 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c464a62cf28997e088dd57a9e0ede3f2983f274
4
- data.tar.gz: 85ad0d5644e20a84eaa99fee56c86ad8ead5de21
3
+ metadata.gz: 0e018bd515522f3f7d9b0406076de76e413775e2
4
+ data.tar.gz: c5500bd55b75ebe3911ed3c4ab7edb224f9385c8
5
5
  SHA512:
6
- metadata.gz: b1ae715a85cc4ad9531cbbb23a965df3c0dede59a5c2fdaf4b09fd3bf24b4e4eb2f98863357924d88feff3729c4f89bf54c484311c9a2c7152ddb59e85db2101
7
- data.tar.gz: d79aa608eecf509fc7838f2ab3682eeea5f7009bea8479f334a7194f875b9b8b05572f16dbbdaa1788f818c3f04ba002e64a12ec931bfc856c631f34ec9f37e3
6
+ metadata.gz: 10840357532b1e1df159a154b39a9791392bc1ddee1bb63267fd9322e4afa17b5e07ac48278d5e3f5246905aa14368227644674f18985b0cbfeec26742efa452
7
+ data.tar.gz: 98d740416958f1b36993faad3804ca0c1a542c15d7c5f4db829e0adce60c1f1295bfa4d04a7a00bd0bb1f88f5248a2c5edce58db1a3157c651fe256a673ecc57
@@ -64,6 +64,10 @@ module Hotdog
64
64
  raise("DATADOG_APPLICATION_KEY is not set")
65
65
  end
66
66
 
67
+ if options[:format] == "ltsv"
68
+ options[:headers] = true
69
+ end
70
+
67
71
  options[:formatter] = get_formatter(options[:format]).new
68
72
 
69
73
  if options[:debug] or options[:verbose]
@@ -282,7 +282,7 @@ module Hotdog
282
282
 
283
283
  class ExpressionNode
284
284
  def evaluate(environment, options={})
285
- raise(NotImplementedError)
285
+ raise(NotImplementedError.new("must be overridden"))
286
286
  end
287
287
 
288
288
  def optimize(options={})
@@ -649,7 +649,7 @@ module Hotdog
649
649
  end
650
650
 
651
651
  def dump(optinos={})
652
- {multinary_op: @op.to_s, expressions: expressions.map { |expression| expression.dump }}
652
+ {multinary_op: @op.to_s, expressions: expressions.map { |expression| expression.dump(options) }}
653
653
  end
654
654
 
655
655
  def intermediates()
@@ -724,7 +724,7 @@ module Hotdog
724
724
  if tables.empty?
725
725
  nil
726
726
  else
727
- case tables.sort
727
+ case tables
728
728
  when [:hosts]
729
729
  "SELECT hosts.id AS host_id FROM hosts;"
730
730
  when [:hosts, :tags]
@@ -738,15 +738,15 @@ module Hotdog
738
738
  end
739
739
 
740
740
  def condition(options={})
741
- raise NotImplementedError
741
+ raise(NotImplementedError.new("must be overridden"))
742
742
  end
743
743
 
744
744
  def condition_tables(options={})
745
- raise NotImplementedError
745
+ raise(NotImplementedError.new("must be overridden"))
746
746
  end
747
747
 
748
748
  def condition_values(options={})
749
- raise NotImplementedError
749
+ raise(NotImplementedError.new("must be overridden"))
750
750
  end
751
751
 
752
752
  def evaluate(environment, options={})
@@ -857,7 +857,12 @@ module Hotdog
857
857
  end
858
858
 
859
859
  def maybe_fallback(options={})
860
- GlobHostNode.new(maybe_glob(attribute), separator)
860
+ fallback = GlobHostNode.new(maybe_glob(attribute), separator)
861
+ if query = fallback.maybe_query(options)
862
+ QueryExpressionNode.new(query, fallback.condition_values(options))
863
+ else
864
+ nil
865
+ end
861
866
  end
862
867
  end
863
868
 
@@ -879,7 +884,12 @@ module Hotdog
879
884
  end
880
885
 
881
886
  def maybe_fallback(options={})
882
- GlobTagNode.new(maybe_glob(identifier), maybe_glob(attribute), separator)
887
+ fallback = GlobTagNode.new(maybe_glob(identifier), maybe_glob(attribute), separator)
888
+ if query = fallback.maybe_query(options)
889
+ QueryExpressionNode.new(query, fallback.condition_values(options))
890
+ else
891
+ nil
892
+ end
883
893
  end
884
894
  end
885
895
 
@@ -901,7 +911,12 @@ module Hotdog
901
911
  end
902
912
 
903
913
  def maybe_fallback(options={})
904
- GlobTagNameNode.new(maybe_glob(identifier), separator)
914
+ fallback = GlobTagNameNode.new(maybe_glob(identifier), separator)
915
+ if query = fallback.maybe_query(options)
916
+ QueryExpressionNode.new(query, fallback.condition_values(options))
917
+ else
918
+ nil
919
+ end
905
920
  end
906
921
  end
907
922
 
@@ -923,7 +938,12 @@ module Hotdog
923
938
  end
924
939
 
925
940
  def maybe_fallback(options={})
926
- GlobTagValueNode.new(maybe_glob(attribute), separator)
941
+ fallback = GlobTagValueNode.new(maybe_glob(attribute), separator)
942
+ if query = fallback.maybe_query(options)
943
+ QueryExpressionNode.new(query, fallback.condition_values(options))
944
+ else
945
+ nil
946
+ end
927
947
  end
928
948
  end
929
949
 
@@ -945,7 +965,12 @@ module Hotdog
945
965
  end
946
966
 
947
967
  def maybe_fallback(options={})
948
- GlobNode.new(maybe_glob(identifier), separator)
968
+ fallback = GlobNode.new(maybe_glob(identifier), separator)
969
+ if query = fallback.maybe_query(options)
970
+ QueryExpressionNode.new(query, fallback.condition_values(options))
971
+ else
972
+ nil
973
+ end
949
974
  end
950
975
  end
951
976
 
@@ -978,7 +1003,12 @@ module Hotdog
978
1003
  end
979
1004
 
980
1005
  def maybe_fallback(options={})
981
- GlobHostNode.new(maybe_glob(attribute), separator)
1006
+ fallback = GlobHostNode.new(maybe_glob(attribute), separator)
1007
+ if query = fallback.maybe_query(options)
1008
+ QueryExpressionNode.new(query, fallback.condition_values(options))
1009
+ else
1010
+ nil
1011
+ end
982
1012
  end
983
1013
  end
984
1014
 
@@ -1000,7 +1030,12 @@ module Hotdog
1000
1030
  end
1001
1031
 
1002
1032
  def maybe_fallback(options={})
1003
- GlobTagNode.new(maybe_glob(identifier), maybe_glob(attribute), separator)
1033
+ fallback = GlobTagNode.new(maybe_glob(identifier), maybe_glob(attribute), separator)
1034
+ if query = fallback.maybe_query(options)
1035
+ QueryExpressionNode.new(query, fallback.condition_values(options))
1036
+ else
1037
+ nil
1038
+ end
1004
1039
  end
1005
1040
  end
1006
1041
 
@@ -1022,7 +1057,12 @@ module Hotdog
1022
1057
  end
1023
1058
 
1024
1059
  def maybe_fallback(options={})
1025
- GlobTagNameNode.new(maybe_glob(identifier), separator)
1060
+ fallback = GlobTagNameNode.new(maybe_glob(identifier), separator)
1061
+ if query = fallback.maybe_query(options)
1062
+ QueryExpressionNode.new(query, fallback.condition_values(options))
1063
+ else
1064
+ nil
1065
+ end
1026
1066
  end
1027
1067
  end
1028
1068
 
@@ -1044,7 +1084,12 @@ module Hotdog
1044
1084
  end
1045
1085
 
1046
1086
  def maybe_fallback(options={})
1047
- GlobTagValueNode.new(maybe_glob(attribute), separator)
1087
+ fallback = GlobTagValueNode.new(maybe_glob(attribute), separator)
1088
+ if query = fallback.maybe_query(options)
1089
+ QueryExpressionNode.new(query, fallback.condition_values(options))
1090
+ else
1091
+ nil
1092
+ end
1048
1093
  end
1049
1094
  end
1050
1095
 
@@ -1066,7 +1111,12 @@ module Hotdog
1066
1111
  end
1067
1112
 
1068
1113
  def maybe_fallback(options={})
1069
- GlobNode.new(maybe_glob(identifier), separator)
1114
+ fallback = GlobNode.new(maybe_glob(identifier), separator).maybe_query(options)
1115
+ if query = fallback.maybe_query(options)
1116
+ QueryExpressionNode.new(query, fallback.condition_values(options))
1117
+ else
1118
+ nil
1119
+ end
1070
1120
  end
1071
1121
  end
1072
1122
 
@@ -1,3 +1,3 @@
1
1
  module Hotdog
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
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.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamashita Yuu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-26 00:00:00.000000000 Z
11
+ date: 2015-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler