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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cc5790aa33dcaa9804f40610737d69783f1d89f8d816b8b12c74fd2edbd899c
4
- data.tar.gz: 0c052749bb7d4dd6a49c9bbd6c373ded671c420098f094dac13fd6e784d57427
3
+ metadata.gz: 7a09adad4f736aa9f57f8c93aed0b5358ab64b07c5360307022409a9a8a26abf
4
+ data.tar.gz: 8c085c94a9a4bd2bfcdb4871f46ccdc64d4d1e08fddd903904c3ac5b111b71be
5
5
  SHA512:
6
- metadata.gz: 7e5057bd9837ec5d161f103dc51eed0528ad627d34bdf03e7e5ec18f8ef1e4d926e1ad744774172fc5f1260cd773f2ad7bdd9b37c4152f7a22a7ff37d821e5f6
7
- data.tar.gz: 7dea62c9d57aa7babeb95daa966d98141c29962291562660d78add79d86f1c3103876118293a525365874d796dc8b7d6f0ea3e76dc09e202af00c89dbec74045
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.0)
4
+ traquitana (0.1.3)
5
5
  highline
6
6
  net-scp
7
7
  net-ssh
8
- rubyzip (>= 1.0.0)
8
+ rubyzip (>= 2.0.0)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- highline (1.7.8)
14
- net-scp (1.2.1)
15
- net-ssh (>= 2.6.5)
16
- net-ssh (4.1.0)
17
- rubyzip (1.2.1)
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.14.6
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. Commit your changes (`git commit -am 'Added some feature'`)
99
- 4. Push to the branch (`git push origin my-new-feature`)
100
- 5. Create new Pull Request
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 "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"
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 = {:verbose=>false}
12
+ @options = { verbose: false }
13
13
 
14
14
  opts = OptionParser.new
15
- opts.banner = "Usage: traq [options] <setup>"
15
+ opts.banner = 'Usage: traq [options] <setup>'
16
16
 
17
- opts.on("-v","--version","Show version") do
18
- puts Traquitana::VERSION
19
- exit 0
17
+ opts.on('-v', '--version', 'Show version') do
18
+ puts Traquitana::VERSION
19
+ exit 0
20
20
  end
21
21
 
22
- opts.on("-c","--cleanup","Clean up old files") do
23
- Traquitana::Cleaner.new.run
24
- exit 0
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("-V","--verbose","Verbose mode") do
28
- @options[:verbose] = true
27
+ opts.on('-V', '--verbose', 'Verbose mode') do
28
+ @options[:verbose] = true
29
29
  end
30
30
 
31
- opts.on("-f","--file file","Config file") do |file|
32
- @options[:filename] = file
31
+ opts.on('-f', '--file file', 'Config file') do |file|
32
+ @options[:filename] = file
33
33
  end
34
34
 
35
- opts.on("-t","--target target","Target") do |target|
36
- @options[:target] = target
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
- Traquitana::Config.instance.setup
43
- else
44
- Traquitana::Deployer.new(@options).run
45
- end
42
+ Traquitana::Config.instance.setup
43
+ else
44
+ Traquitana::Deployer.new(@options).run
45
+ end
data/gem-public_cert.pem CHANGED
@@ -1,26 +1,26 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIEVjCCAr6gAwIBAgIBATANBgkqhkiG9w0BAQsFADAqMSgwJgYDVQQDDB9ldXN0
3
- YXF1aW9yYW5nZWwvREM9Z21haWwvREM9Y29tMB4XDTE4MTExNDIwNTMxMVoXDTE5
4
- MTExNDIwNTMxMVowKjEoMCYGA1UEAwwfZXVzdGFxdWlvcmFuZ2VsL0RDPWdtYWls
5
- L0RDPWNvbTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKKJMledxeWV
6
- 5zzrIQ0NEfSOANd/P6MXg8j7nkO0huQDrk856B1/7I7oQkWy90xJJrBimaWuLGN8
7
- gcWQMNCr2RIRvoMirlAdQOrKgRcvUludBfGYOLtxnPVXuuaMuyike9jY50ba2ROP
8
- 04sTU3G18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VtDvbQdU4bcsUnWkOMLImhlLs1VKAhOVxnV0ZGdyNQfLV1SXMAJkgc
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
@@ -5,7 +5,7 @@ module Traquitana
5
5
 
6
6
  def initialize
7
7
  reset
8
- end
8
+ end
9
9
 
10
10
  def reset
11
11
  @name = nil
data/lib/cleaner.rb CHANGED
@@ -11,9 +11,9 @@ module Traquitana
11
11
  end
12
12
 
13
13
  def run
14
- STDOUT.print "Cleaning old files ... "
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 "done."
16
+ STDOUT.puts 'done.'
17
17
  end
18
18
  end
19
19
  end
data/lib/config.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "singleton"
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 = "config/traq.yml"
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 "Running setup"
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(self.filename)
37
+ dir = File.dirname(filename)
38
38
  Dir.mkdir(dir) if !File.exist?(dir)
39
39
 
40
- STDOUT.puts "Writing #{self.filename}"
41
- File.open(self.filename, "w") do |file|
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[:filename] if options[:filename]
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
- if !File.exist?(@config.filename)
15
- STDERR.puts "\e[31mNo config file (#{@config.filename}) found."
16
- STDERR.puts "Did you run \e[1mtraq setup\e[0;31m ?"
17
- STDERR.puts "Run it and check the configuration before deploying.\e[0m"
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
- STDERR.puts "\e[31mCould not create the needed files.\e[0m"
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 "tmpdir"
2
- require "zip"
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("%Y%m%d%H%M%S%L")
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 = "#{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}")
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
- File.open(list_path, "w") {|file| file << list.map { |f| f.sub(regex,"") }.join("\n") }
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
- Zip::File.open(zip_path, "w") do |zip_file|
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
- [ list_path, zip_path ]
47
+ [list_path, zip_path]
42
48
  end
43
49
  end
44
50
  end
data/lib/selector.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Traquitana
2
2
  class Selector
3
- def initialize(dir = "")
3
+ def initialize(dir = '')
4
4
  @dir = dir
5
5
  end
6
6
 
data/lib/ssh.rb CHANGED
@@ -33,7 +33,7 @@ module Traquitana
33
33
  channel.send_data("#{pwd}\n")
34
34
  sleep 0.1
35
35
  else
36
- puts msg if msg.size > 1
36
+ STDOUT.puts msg if msg.size > 1
37
37
  end
38
38
  chd.wait
39
39
  end
data/lib/traquitana.rb CHANGED
@@ -1,3 +1,3 @@
1
- %w(traquitana/version config selector deployer packager ssh bar migrator cleaner).each do |file|
1
+ %w(traquitana/version config selector deployer packager ssh bar cleaner).each do |file|
2
2
  require File.dirname(__FILE__)+"/"+file
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Traquitana
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/spec/bar_spec.rb CHANGED
@@ -1,45 +1,52 @@
1
- require "minitest/autorun"
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
- 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
- @bar.must_respond_to :total
13
- end
14
- it "should have a current value" do
15
- @bar.must_respond_to :current
16
- end
17
- end
18
-
19
- describe "updates" do
20
- it "should have a name" do
21
- @bar.must_respond_to :name
22
- end
23
- it "should have a update method" do
24
- @bar.must_respond_to :update
25
- end
26
- it "should have a indicator method" do
27
- @bar.must_respond_to :indicator
28
- end
29
- it "should return the correct string for 0%" do
30
- @bar.indicator(0).must_equal "____________________"
31
- end
32
- it "should return the correct string for 25%" do
33
- @bar.indicator(25).must_equal "#####_______________"
34
- end
35
- it "should return the correct string for 50%" do
36
- @bar.indicator(50).must_equal "##########__________"
37
- end
38
- it "should return the correct string for 75%" do
39
- @bar.indicator(75).must_equal "###############_____"
40
- end
41
- it "should return the correct string for 100%" do
42
- @bar.indicator(100).must_equal "####################"
43
- end
44
- end
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