tdi 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3739bf2722034ee2af5c0aaadd4371845baeedec
4
- data.tar.gz: 1b4a01d5d8cd2cc6acb9f10303cd9de27082f41c
3
+ metadata.gz: 6d0c80dd475a561817fc1f62ba2f576abad3b5ab
4
+ data.tar.gz: febd8a7c033de2392ab1f5b1e82e8e7bde7a7da5
5
5
  SHA512:
6
- metadata.gz: fe0dc75bcb4b0f0ced5c40dcd6565b20b040a3af41c4c30913224e53ff0f800d1a1ab367c31011c41c5e1ba7b6c6ddfef5bce8684516f05229250f7077db5d9b
7
- data.tar.gz: 24954f687a685d5ec2669e9736e5cfb869db27fa6f367c5426d0bc31c625dd2542d77fc989f627ac19134a67090afc65e1296e7f40c26de09949e0403ac04dc0
6
+ metadata.gz: 3e3562d2e19a778229d38e2bc195592a123e2ee99388bd4dabbce660329ff1bacfa766333db8bf04ed9e7ce31e47320860a278d14bdd4094ca6c6852fbf20211
7
+ data.tar.gz: 0a775bcfb7363ebd187bb9604dc2c1a7f241e93098c03e3861dcb582cc94e3592f04cf2800fb6b8fc9de56f632c0f92717963b9a4c5e5cec50eb9784d7643f9c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.1.1
1
+ ruby-2.1.2
data/Gemfile.lock CHANGED
@@ -1,21 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tdi (0.1.0)
4
+ tdi (0.1.1)
5
5
  colorize
6
6
  etc
7
7
  net-ssh
8
+ os
8
9
  slop
9
10
  timeout
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
13
14
  specs:
14
- colorize (0.7.2)
15
+ colorize (0.7.3)
15
16
  etc (0.2.0)
16
- net-ssh (2.8.0)
17
- rake (10.1.0)
18
- slop (3.5.0)
17
+ net-ssh (2.9.1)
18
+ os (0.9.6)
19
+ rake (10.3.2)
20
+ slop (3.6.0)
19
21
  timeout (0.0.0)
20
22
 
21
23
  PLATFORMS
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
1
  require 'bundler/gem_tasks'
2
+
3
+ # Default.
4
+ task :default => :help
5
+
6
+ # Help.
7
+ desc 'Help'
8
+ task :help do
9
+ system('rake -T')
10
+ end
data/bin/tdi CHANGED
@@ -21,6 +21,22 @@
21
21
  # === Copyright
22
22
  #
23
23
  # Copyright (C) 2013-2014 Globo.com
24
+ #
25
+
26
+ # This file is part of TDI.
27
+
28
+ # TDI is free software: you can redistribute it and/or modify
29
+ # it under the terms of the GNU General Public License as published by
30
+ # the Free Software Foundation, either version 3 of the License, or
31
+ # (at your option) any later version.
32
+
33
+ # TDI is distributed in the hope that it will be useful,
34
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
35
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36
+ # GNU General Public License for more details.
37
+
38
+ # You should have received a copy of the GNU General Public License
39
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
24
40
 
25
41
  ##############
26
42
  ## REQUIRES ##
@@ -59,7 +75,7 @@ def main(opts)
59
75
  filename = ARGV[0]
60
76
 
61
77
  # Wrong number of command line arguments.
62
- if filename.nil? and not opts.help?
78
+ if filename.nil? and not (opts.help? or opts.version?)
63
79
  puts opts
64
80
  exit 1
65
81
  end
@@ -70,6 +86,12 @@ def main(opts)
70
86
  # Validation.
71
87
  validate_args(opts)
72
88
 
89
+ # Version.
90
+ if opts.version?
91
+ puts Tdi::VERSION
92
+ exit 0
93
+ end
94
+
73
95
  # Start.
74
96
  if opts[:verbose] > 0
75
97
  puts "Using \"#{filename}\" as test plan input file.".cyan
@@ -121,6 +143,11 @@ def validate_args(opts)
121
143
  end
122
144
  end
123
145
 
146
+ if opts.version? and ARGV.size != 0
147
+ puts "ERR: Version must be the only argument.".light_magenta
148
+ exit 1
149
+ end
150
+
124
151
  if opts[:verbose] > 1
125
152
  puts 'Validating arguments... done.'.green
126
153
  puts
@@ -146,6 +173,7 @@ Examples:
146
173
  tdi -v tdi.json
147
174
  tdi -vv tdi.json
148
175
  tdi -vvv tdi.json
176
+ tdi --version
149
177
 
150
178
  Options:
151
179
  EOS
@@ -153,6 +181,7 @@ EOS
153
181
  on :p, :plan, 'Test plan list.', :as => Array, :argument => :optional
154
182
  on :s, :shred, 'Wipe out the test plan, leaving no trace behind.'
155
183
  on :v, :verbose, 'Verbose mode.', :as => :count
184
+ on :version, 'Version.'
156
185
  end
157
186
  rescue
158
187
  puts 'ERR: Invalid option. Try -h or --help for help.'.light_magenta
data/helper/acl.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  require 'socket'
2
21
  require 'timeout'
3
22
  require 'etc'
data/helper/file.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  require 'fileutils'
2
21
  require 'etc'
3
22
 
data/helper/http.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  require 'net/http'
2
21
  require "net/https"
3
22
  require 'timeout'
data/helper/ssh.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  require 'net/ssh'
2
21
  require 'etc'
3
22
 
data/lib/planner.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  require_relative 'rblank'
2
21
  require_relative 'rmerge'
3
22
 
data/lib/rblank.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  module HashRecursiveBlank
2
21
  def rblank
3
22
  r = {}
data/lib/rmerge.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  module HashRecursiveMerge
2
21
  def rmerge(other_hash)
3
22
  r = {}
data/lib/runner.rb CHANGED
@@ -1,3 +1,23 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require 'os'
1
21
  require_relative 'tdi'
2
22
 
3
23
  # Run tests.
@@ -78,7 +98,15 @@ def runner(opts, filename, plan)
78
98
  # Shred.
79
99
  if opts.shred?
80
100
  puts "Shreding and removing test plan file: \"#{filename}\"...".cyan if opts[:verbose] > 2
81
- if system("shred -f -n 38 -u -z #{filename}")
101
+ if OS.linux?
102
+ shred_cmd = "shred -f -n 38 -u -z #{filename}"
103
+ elsif OS.mac?
104
+ shred_cmd = "srm -f -z #{filename}"
105
+ else
106
+ shred_cmd = "rm -f #{filename}"
107
+ end
108
+ puts "Shreding with command \"#{shred_cmd}\"...".cyan if opts[:verbose] > 2
109
+ if system(shred_cmd)
82
110
  puts "Shreding and removing test plan file: \"#{filename}\"... done.".green if opts[:verbose] > 2
83
111
  else
84
112
  puts "ERR: Shreding and removing test plan file: \"#{filename}\".".light_magenta
data/lib/tdi.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  require 'tdi/version'
2
21
 
3
22
  class TDI
data/lib/tdi/version.rb CHANGED
@@ -1,3 +1,22 @@
1
+ #
2
+ # Copyright (C) 2013-2014 Globo.com
3
+ #
4
+
5
+ # This file is part of TDI.
6
+
7
+ # TDI is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # TDI is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with TDI. If not, see <http://www.gnu.org/licenses/>.
19
+
1
20
  module Tdi
2
- VERSION = '0.1.0'
21
+ VERSION = '0.1.1'
3
22
  end
data/tdi.gemspec CHANGED
@@ -23,6 +23,7 @@ validating your deployed infrastructure and external dependencies.)
23
23
  spec.add_development_dependency 'bundler', '~> 1.5'
24
24
  spec.add_development_dependency 'rake'
25
25
 
26
+ spec.add_runtime_dependency 'os'
26
27
  spec.add_runtime_dependency 'etc'
27
28
  spec.add_runtime_dependency 'slop'
28
29
  spec.add_runtime_dependency 'colorize'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rogério Carvalho Schneider
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-09 00:00:00.000000000 Z
13
+ date: 2014-08-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -40,6 +40,20 @@ dependencies:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: os
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
43
57
  - !ruby/object:Gem::Dependency
44
58
  name: etc
45
59
  requirement: !ruby/object:Gem::Requirement