traquitana 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Gemfile.lock +8 -8
- data/README.md +39 -23
- data/bin/traq +26 -26
- data/config/custom.yml +11 -24
- data/config/default.yml +6 -0
- data/config/proc.sh +52 -0
- data/config/traq.yml +1 -0
- data/gem-public_cert.pem +24 -20
- data/lib/bar.rb +1 -1
- data/lib/cleaner.rb +2 -2
- data/lib/config.rb +8 -8
- 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 +3 -0
- data/spec/config/Rakefile +11 -0
- data/spec/config/config/traq.yml +1 -0
- data/spec/config_spec.rb +106 -101
- data/spec/deploy_spec.rb +14 -7
- data/spec/network_spec.rb +55 -52
- data/spec/packager_spec.rb +40 -40
- data/spec/selector_spec.rb +9 -9
- data/traq/config.yml +6 -0
- data/traquitana.gemspec +11 -11
- metadata +35 -35
- metadata.gz.sig +0 -0
- data/lib/migrator.rb +0 -25
- data/spec/migrator_spec.rb +0 -75
metadata.gz.sig
CHANGED
Binary file
|
data/lib/migrator.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
|
3
|
-
module Traquitana
|
4
|
-
class Migrator
|
5
|
-
def run
|
6
|
-
old_file = "./traq/config.yml"
|
7
|
-
new_file = "./config/traq.yml"
|
8
|
-
|
9
|
-
return false if !File.exists?(old_file) || File.exists?(new_file)
|
10
|
-
|
11
|
-
STDOUT.puts "Migrating old config file ..."
|
12
|
-
contents = YAML.load(File.read(old_file))
|
13
|
-
contents = contents.inject({}) {|hash,val| hash[val.first.to_s] = val.last; hash}.reject { |k,v| k == "ignore"}.to_yaml
|
14
|
-
File.open(new_file, "w") { |f| f << contents }
|
15
|
-
|
16
|
-
File.unlink(old_file)
|
17
|
-
first_run = "#{File.dirname(old_file)}/.first_run"
|
18
|
-
File.unlink(first_run) if File.exists?(first_run)
|
19
|
-
|
20
|
-
dir = "#{File.dirname(old_file)}"
|
21
|
-
Dir.unlink(dir) if Dir.exists?(dir)
|
22
|
-
true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/migrator_spec.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require "minitest/autorun"
|
2
|
-
require "#{File.expand_path(File.dirname(__FILE__))}/../lib/traquitana.rb"
|
3
|
-
|
4
|
-
describe Traquitana::Migrator do
|
5
|
-
before do
|
6
|
-
@migrator = Traquitana::Migrator.new
|
7
|
-
|
8
|
-
@old_file = "#{File.expand_path(File.dirname(__FILE__))}/../traq/config.yml"
|
9
|
-
@old_cont = File.read(@old_file)
|
10
|
-
|
11
|
-
@new_file = "#{File.expand_path(File.dirname(__FILE__))}/../config/traq.yml"
|
12
|
-
@new_cont = File.read(@new_file)
|
13
|
-
|
14
|
-
File.unlink(@new_file)
|
15
|
-
end
|
16
|
-
|
17
|
-
after do
|
18
|
-
FileUtils.mkdir(File.dirname(@old_file)) if !Dir.exists?(File.dirname(@old_file))
|
19
|
-
FileUtils.mkdir(File.dirname(@new_file)) if !Dir.exists?(File.dirname(@new_file))
|
20
|
-
|
21
|
-
File.open(@new_file,"w") {|f| f<<@new_cont}
|
22
|
-
File.open(@old_file,"w") {|f| f<<@old_cont}
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a run method" do
|
26
|
-
@migrator.must_respond_to(:run)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should return false when there isn't an old config file" do
|
30
|
-
contents = File.read(@old_file)
|
31
|
-
File.unlink(@old_file)
|
32
|
-
assert !@migrator.run
|
33
|
-
File.open(@old_file,"w") {|f| f<<contents}
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should return false if there is a new config file" do
|
37
|
-
File.open(@new_file,"w") {|f| f<<@new_cont}
|
38
|
-
assert !@migrator.run
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should return true when there is an old config file" do
|
42
|
-
assert @migrator.run
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should have the new file after run" do
|
46
|
-
File.unlink(@new_file) if File.exists?(@new_file)
|
47
|
-
@migrator.run
|
48
|
-
assert File.exists?(@new_file)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should not have the old file after run" do
|
52
|
-
@migrator.run
|
53
|
-
assert !File.exists?(@old_file)
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should not have the old dir after run" do
|
57
|
-
@migrator.run
|
58
|
-
assert !Dir.exists?(File.dirname(@old_file))
|
59
|
-
end
|
60
|
-
|
61
|
-
it "should not have the ignore clause on the new file" do
|
62
|
-
@migrator.run
|
63
|
-
assert !YAML.load(File.read(@new_file)).include?("ignore")
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should have all the keys of the old file on the new one" do
|
67
|
-
old_content = YAML.load(File.read(@old_file)).reject {|k,v| k==:ignore}
|
68
|
-
@migrator.run
|
69
|
-
new_content = YAML.load(File.read(@new_file))
|
70
|
-
old_content.each do |key,val|
|
71
|
-
assert new_content.include?(key.to_s)
|
72
|
-
assert new_content[key.to_s].to_s==old_content[key].to_s
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|