traquitana 0.1.2 → 0.1.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Gemfile.lock +8 -8
- data/README.md +4 -3
- data/bin/traq +26 -26
- data/gem-public_cert.pem +22 -22
- data/lib/bar.rb +1 -1
- data/lib/cleaner.rb +2 -2
- data/lib/config.rb +8 -7
- data/lib/deployer.rb +15 -8
- data/lib/packager.rb +18 -12
- data/lib/selector.rb +1 -1
- data/lib/ssh.rb +1 -1
- data/lib/traquitana.rb +1 -1
- data/lib/traquitana/version.rb +1 -1
- data/spec/bar_spec.rb +48 -41
- data/spec/cleaner_spec.rb +17 -16
- data/spec/config/Gemfile +1 -0
- data/spec/config/Rakefile +11 -0
- data/spec/config_spec.rb +106 -101
- data/spec/deploy_spec.rb +13 -10
- data/spec/network_spec.rb +55 -52
- data/spec/packager_spec.rb +40 -40
- data/spec/selector_spec.rb +9 -9
- data/traquitana.gemspec +11 -11
- metadata +33 -37
- metadata.gz.sig +0 -0
- data/lib/migrator.rb +0 -25
- data/spec/migrator_spec.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a09adad4f736aa9f57f8c93aed0b5358ab64b07c5360307022409a9a8a26abf
|
4
|
+
data.tar.gz: 8c085c94a9a4bd2bfcdb4871f46ccdc64d4d1e08fddd903904c3ac5b111b71be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d78781ee2800bb9f4a0bbc3b71e3d95acec09d3684bddfb0c7f9f89086b66413d1b535a3166bed619beefc4e2110dac8ff7b20b31260e2fe8b5f3434f4eb7f3
|
7
|
+
data.tar.gz: 80fcf9ca6561c01b878aebef8abb754d4ca81ea8af9465017f97ef6e301df948dff7f32de477f30dc062555ee7cfb5cf5419926cf59739a9758a5a08084115d7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
traquitana (0.1.
|
4
|
+
traquitana (0.1.3)
|
5
5
|
highline
|
6
6
|
net-scp
|
7
7
|
net-ssh
|
8
|
-
rubyzip (>=
|
8
|
+
rubyzip (>= 2.0.0)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
highline (
|
14
|
-
net-scp (
|
15
|
-
net-ssh (>= 2.6.5)
|
16
|
-
net-ssh (
|
17
|
-
rubyzip (
|
13
|
+
highline (2.0.3)
|
14
|
+
net-scp (2.0.0)
|
15
|
+
net-ssh (>= 2.6.5, < 6.0.0)
|
16
|
+
net-ssh (5.2.0)
|
17
|
+
rubyzip (2.0.0)
|
18
18
|
|
19
19
|
PLATFORMS
|
20
20
|
ruby
|
@@ -23,4 +23,4 @@ DEPENDENCIES
|
|
23
23
|
traquitana!
|
24
24
|
|
25
25
|
BUNDLED WITH
|
26
|
-
1.
|
26
|
+
1.17.2
|
data/README.md
CHANGED
@@ -95,6 +95,7 @@ There are some command line options:
|
|
95
95
|
|
96
96
|
1. Fork it
|
97
97
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
98
|
-
3.
|
99
|
-
4.
|
100
|
-
5.
|
98
|
+
3. Test it! Run `$ rake test`. You need `minitest` and `minitest-focus`.
|
99
|
+
4. Commit your changes (`git commit -am 'Added some feature'`)
|
100
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
101
|
+
6. Create new Pull Request
|
data/bin/traq
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require File.dirname(File.expand_path(__FILE__))+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'yaml'
|
5
|
+
require 'zip'
|
6
|
+
require 'net/scp'
|
7
|
+
require 'net/ssh'
|
8
|
+
require 'fileutils'
|
9
|
+
require 'optparse'
|
10
|
+
require File.dirname(File.expand_path(__FILE__)) + '/../lib/traquitana.rb'
|
11
11
|
|
12
|
-
@options = {:
|
12
|
+
@options = { verbose: false }
|
13
13
|
|
14
14
|
opts = OptionParser.new
|
15
|
-
opts.banner =
|
15
|
+
opts.banner = 'Usage: traq [options] <setup>'
|
16
16
|
|
17
|
-
opts.on(
|
18
|
-
|
19
|
-
|
17
|
+
opts.on('-v', '--version', 'Show version') do
|
18
|
+
puts Traquitana::VERSION
|
19
|
+
exit 0
|
20
20
|
end
|
21
21
|
|
22
|
-
opts.on(
|
23
|
-
|
24
|
-
|
22
|
+
opts.on('-c', '--cleanup', 'Clean up old files') do
|
23
|
+
Traquitana::Cleaner.new.run
|
24
|
+
exit 0
|
25
25
|
end
|
26
26
|
|
27
|
-
opts.on(
|
28
|
-
|
27
|
+
opts.on('-V', '--verbose', 'Verbose mode') do
|
28
|
+
@options[:verbose] = true
|
29
29
|
end
|
30
30
|
|
31
|
-
opts.on(
|
32
|
-
|
31
|
+
opts.on('-f', '--file file', 'Config file') do |file|
|
32
|
+
@options[:filename] = file
|
33
33
|
end
|
34
34
|
|
35
|
-
opts.on(
|
36
|
-
|
35
|
+
opts.on('-t', '--target target', 'Target') do |target|
|
36
|
+
@options[:target] = target
|
37
37
|
end
|
38
38
|
|
39
39
|
opts.parse!
|
40
40
|
|
41
41
|
if ARGV[0] =~ /setup/
|
42
|
-
|
43
|
-
else
|
44
|
-
|
45
|
-
end
|
42
|
+
Traquitana::Config.instance.setup
|
43
|
+
else
|
44
|
+
Traquitana::Deployer.new(@options).run
|
45
|
+
end
|
data/gem-public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QDAgSwMB0GA1UdDgQWBBRjzyGZfZ3j8BiB
|
15
|
+
+cEsJb0Lg6tz3jAkBgNVHREEHTAbgRlldXN0YXF1aW9yYW5nZWxAZ21haWwuY29t
|
16
16
|
MCQGA1UdEgQdMBuBGWV1c3RhcXVpb3JhbmdlbEBnbWFpbC5jb20wDQYJKoZIhvcN
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
AQELBQADggGBAHuTzyu0cDGVRsONr7PgY9eahH0ZGy/bdrk0FO0RpAOXayjsmmL2
|
18
|
+
Ouoi8VbWRzVtDvbQdU4bcsUnWkOMLImhlLs1VKAhOVxnV0ZGdyNQfLV1SXMAJkgc
|
19
|
+
AI7ClhA1YVBO70NaOyJPjaXs+lc4PltdEF59+YDCIVjAAoQd31F7x+eO2pjr+Mu1
|
20
|
+
yH5aCyn1BwklE7TF8076SZK4MNLeD/KD3whOjL0k1xeQqAqaImf+oxDbhU3tJCEd
|
21
|
+
dfcBNOr98LHzsGEYQRB24Ksnw7dcEqWs/trbJrgA7lX2/8TAch5fSLgVDQwSLPk7
|
22
|
+
E34l4xf0bry+lF2zuD15Mps1ZDxJhKcgDWNg82huuVh1zqzNYqgWB1hYPBehhXGo
|
23
|
+
NdMU5fm01/k08H5psRBGWS/EcpX063ll3qcOGVqbPPH2U3LCYzWww+2PdslwJo/c
|
24
|
+
uek3m7n2XoRODoAGEm3apnmP8WWMEmI0tXdsvDBwoNVXEMkFnxD+RIMQPW22r3ZL
|
25
|
+
waOiThAR0oxaTQ==
|
26
26
|
-----END CERTIFICATE-----
|
data/lib/bar.rb
CHANGED
data/lib/cleaner.rb
CHANGED
@@ -11,9 +11,9 @@ module Traquitana
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def run
|
14
|
-
STDOUT.print
|
14
|
+
STDOUT.print 'Cleaning old files ... '
|
15
15
|
@network.execute(["find #{@config.directory}/traq -type f -iname '*.zip' -o -iname '*.list' | sort | head -n-2 | xargs rm $1"])
|
16
|
-
STDOUT.puts
|
16
|
+
STDOUT.puts 'done.'
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/config.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'singleton'
|
2
2
|
|
3
3
|
module Traquitana
|
4
4
|
class Config
|
@@ -7,7 +7,7 @@ module Traquitana
|
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
@configs = {}
|
10
|
-
@filename =
|
10
|
+
@filename = 'config/traq.yml'
|
11
11
|
@target = nil
|
12
12
|
load
|
13
13
|
end
|
@@ -23,22 +23,22 @@ module Traquitana
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def method_missing(meth)
|
26
|
-
@configs[meth.to_s] ||
|
26
|
+
@configs[meth.to_s] || ''
|
27
27
|
end
|
28
28
|
|
29
29
|
def setup
|
30
|
-
STDOUT.puts
|
30
|
+
STDOUT.puts 'Running setup'
|
31
31
|
|
32
32
|
if File.exists?(self.filename)
|
33
33
|
STDERR.puts "The configuration file #{self.filename} already exists."
|
34
34
|
return false
|
35
35
|
end
|
36
36
|
|
37
|
-
dir = File.dirname(
|
37
|
+
dir = File.dirname(filename)
|
38
38
|
Dir.mkdir(dir) if !File.exist?(dir)
|
39
39
|
|
40
|
-
STDOUT.puts "Writing #{
|
41
|
-
File.open(
|
40
|
+
STDOUT.puts "Writing #{filename}"
|
41
|
+
File.open(filename, "w") do |file|
|
42
42
|
file << File.read(self.default)
|
43
43
|
end
|
44
44
|
|
@@ -48,6 +48,7 @@ module Traquitana
|
|
48
48
|
end
|
49
49
|
|
50
50
|
private
|
51
|
+
|
51
52
|
def check_configs(file)
|
52
53
|
@configs = YAML.load(File.read(file || self.filename)) rescue nil
|
53
54
|
STDERR.puts "Configs not found (tried '#{file}' and '#{self.filename}')" if !@configs
|
data/lib/deployer.rb
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
module Traquitana
|
2
2
|
class Deployer
|
3
|
-
def initialize(options=nil)
|
3
|
+
def initialize(options = nil)
|
4
4
|
@config = Traquitana::Config.instance
|
5
5
|
@verbose = !options.nil? && options[:verbose]
|
6
|
-
@config.filename = options
|
6
|
+
@config.filename = file(options)
|
7
7
|
@config.target = options[:target] if options[:target]
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
11
|
STDOUT.puts "\e[1mRunning Traquitana version #{VERSION}\e[0m\n\n"
|
12
|
-
Traquitana::Migrator.new.run
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
unless File.exist?(@config.filename)
|
14
|
+
warn "\e[31mNo config file (#{@config.filename}) found."
|
15
|
+
warn "Did you run \e[1mtraq setup\e[0;31m ?"
|
16
|
+
warn "Run it and check the configuration before deploying.\e[0m"
|
18
17
|
exit 1
|
19
18
|
end
|
20
19
|
|
@@ -30,7 +29,7 @@ module Traquitana
|
|
30
29
|
all_list_file, all_list_zip = @packager.pack
|
31
30
|
|
32
31
|
if !File.exists?(all_list_file) || !File.exists?(all_list_zip)
|
33
|
-
|
32
|
+
warn "\e[31mCould not create the needed files.\e[0m"
|
34
33
|
exit 2
|
35
34
|
end
|
36
35
|
|
@@ -59,5 +58,13 @@ module Traquitana
|
|
59
58
|
File.unlink(all_list_zip)
|
60
59
|
STDOUT.puts "\e[32mAll done. Have fun.\e[0m\n"
|
61
60
|
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def file(options)
|
65
|
+
return options[:filename] if options[:filename]
|
66
|
+
|
67
|
+
@config.filename
|
68
|
+
end
|
62
69
|
end
|
63
70
|
end
|
data/lib/packager.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'tmpdir'
|
2
|
+
require 'zip'
|
3
3
|
|
4
4
|
module Traquitana
|
5
5
|
class Packager
|
6
6
|
attr_reader :id
|
7
7
|
attr_accessor :verbose
|
8
8
|
|
9
|
-
def initialize(dir =
|
9
|
+
def initialize(dir = '')
|
10
10
|
@dir = dir
|
11
|
-
@id = Time.now.strftime(
|
11
|
+
@id = Time.now.strftime('%Y%m%d%H%M%S%L')
|
12
12
|
@verbose = verbose
|
13
13
|
end
|
14
14
|
|
@@ -21,24 +21,30 @@ module Traquitana
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def pack
|
24
|
-
list_path
|
25
|
-
zip_path
|
26
|
-
list
|
27
|
-
regex
|
24
|
+
list_path = "#{Dir.tmpdir}/#{self.list_file}"
|
25
|
+
zip_path = "#{Dir.tmpdir}/#{self.zip_file}"
|
26
|
+
list = Traquitana::Selector.new(@dir).files
|
27
|
+
regex = @dir.to_s.size < 1 ? '' : Regexp.new("^#{@dir}")
|
28
28
|
|
29
29
|
# write list file
|
30
30
|
STDOUT.puts "Creating the list file: #{list_path}" if @verbose
|
31
|
-
|
31
|
+
|
32
|
+
File.open(list_path, 'w') do |file|
|
33
|
+
file << list.map do |f|
|
34
|
+
f.sub(regex, '')
|
35
|
+
end.join("\n")
|
36
|
+
end
|
32
37
|
|
33
38
|
# write zip file
|
34
39
|
STDOUT.puts "Creating the zip file : #{zip_path}" if @verbose
|
35
|
-
|
40
|
+
|
41
|
+
Zip::File.open(zip_path, 'w') do |zip_file|
|
36
42
|
for file in list
|
37
|
-
strip = file.sub(regex,
|
43
|
+
strip = file.sub(regex, '')
|
38
44
|
zip_file.add(strip, file)
|
39
45
|
end
|
40
46
|
end
|
41
|
-
[
|
47
|
+
[list_path, zip_path]
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
data/lib/selector.rb
CHANGED
data/lib/ssh.rb
CHANGED
data/lib/traquitana.rb
CHANGED
data/lib/traquitana/version.rb
CHANGED
data/spec/bar_spec.rb
CHANGED
@@ -1,45 +1,52 @@
|
|
1
|
-
require
|
1
|
+
require 'minitest/autorun'
|
2
2
|
require "#{File.expand_path(File.dirname(__FILE__))}/../lib/traquitana.rb"
|
3
3
|
|
4
4
|
describe Traquitana::Bar do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
5
|
+
before do
|
6
|
+
@bar = Traquitana::Bar.new
|
7
|
+
@bar.total = 100
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'limits' do
|
11
|
+
it 'should have a total' do
|
12
|
+
expect(@bar).must_respond_to :total
|
13
|
+
end
|
14
|
+
it 'should have a current value' do
|
15
|
+
expect(@bar).must_respond_to :current
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'updates' do
|
20
|
+
it 'should have a name' do
|
21
|
+
expect(@bar).must_respond_to :name
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should have a update method' do
|
25
|
+
expect(@bar).must_respond_to :update
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have a indicator method' do
|
29
|
+
expect(@bar).must_respond_to :indicator
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should return the correct string for 0%' do
|
33
|
+
expect(@bar.indicator(0)).must_equal '____________________'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should return the correct string for 25%' do
|
37
|
+
expect(@bar.indicator(25)).must_equal '#####_______________'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should return the correct string for 50%' do
|
41
|
+
expect(@bar.indicator(50)).must_equal '##########__________'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should return the correct string for 75%' do
|
45
|
+
expect(@bar.indicator(75)).must_equal '###############_____'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should return the correct string for 100%' do
|
49
|
+
expect(@bar.indicator(100)).must_equal '####################'
|
50
|
+
end
|
51
|
+
end
|
45
52
|
end
|