deplomat 0.2.0 → 0.2.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
  SHA256:
3
- metadata.gz: c91e9845ccf8392c7fff51614f56677df22aa87f00d29a1147fcf510c54ef88a
4
- data.tar.gz: 4a35bfdfa7ae33d72234e4ef46d6b612b0bc5743285d3055662c44efb5ba62e2
3
+ metadata.gz: 43328e335e9506ceea77f8c16bf79ff2d43f8eda9f863ab5949ea430f04a15c4
4
+ data.tar.gz: 3aa4d9092fdac50217c7e388d02cc22ff2ff36cc411fbe0968ed1948f935b04b
5
5
  SHA512:
6
- metadata.gz: 4192a3789c9f630cb1640830ec417d3e05c4331a37c371ab265d6691ec788812a9606bd1a950d2971611a682f43344a88e060c9e27c163daca4cf73cbe033196
7
- data.tar.gz: 0e1044ee65039255401f375057b61cea4d55f121c3d851f789bab155f90e0f70a4cc80e109e70da0f1f46566298305636b5a24ffed2766f1c16bb2b96239745a
6
+ metadata.gz: 1d54530453a2d651269219623230bd728e35818c0aa8c7f8c1b7979de7146adec40b1374537451af6a05de97363c7c49b3688b24fb91ea4ef117cb58f1048c66
7
+ data.tar.gz: 5e7fb76963666596ceff2c07c40c01bea03bc498269b04203844ac1541bdbf86698bdf5287d96f0a932d10c75e1a4301d298f61b2d732f275d28570d851afd6b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/deplomat.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: deplomat 0.2.0 ruby lib
5
+ # stub: deplomat 0.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "deplomat".freeze
9
- s.version = "0.2.0"
9
+ s.version = "0.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -1,5 +1,4 @@
1
1
  module Deplomat
2
2
  class ExecutionError < Exception;end
3
3
  class NoSuchPathError < Exception;end
4
- class RequisitesNumberError < Exception; end
5
4
  end
data/lib/deplomat/node.rb CHANGED
@@ -9,6 +9,7 @@ module Deplomat
9
9
  @log_to = log_to
10
10
  @logfile = logfile
11
11
  @raise_exceptions = raise_exceptions
12
+ @current_path = path
12
13
  self.cd(path) if path
13
14
  end
14
15
 
@@ -128,8 +129,9 @@ module Deplomat
128
129
  def update_requisite_number!(n, counter_file_path: "#{@current_path}/.deployment_requisites_counter")
129
130
  current_number = current_requisite_number(counter_file_path)
130
131
  if n <= current_number
131
- raise Deplomat::RequisitesNumberError, message: "New requisite number (#{n}) is below or equals the current one (#{current_number}). " +
132
- "Something must have gone wrong."
132
+ log "New requisite number (#{n}) is below or equals the current one (#{current_number}). " +
133
+ "Something must have gone wrong.", color: "red"
134
+ exit 1
133
135
  else
134
136
  File.open(counter_file_path, "w") { |f| f.puts n }
135
137
  end
@@ -139,8 +141,9 @@ module Deplomat
139
141
  if file_exists?(fn)
140
142
  return File.readlines(fn).first.to_i
141
143
  else
142
- raise Deplomat::RequisitesNumberError, message: "Requisite counter file `#{@current_path}/.deployment_requisites_counter` doesn't exist. " +
143
- "Please create it manually and symlink it in the deployment script if necessary."
144
+ log "Requisite counter file `#{fn}` doesn't exist. " +
145
+ "Please create it manually and symlink it in the deployment script if necessary.", color: "red"
146
+ exit 1
144
147
  end
145
148
  end
146
149
 
data/spec/node_spec.rb CHANGED
@@ -45,6 +45,7 @@ describe Deplomat::Node do
45
45
  end
46
46
 
47
47
  it "updates requisite counter" do
48
+ @node.log_to = []
48
49
 
49
50
  requisites_counter_fn = "#{Dir.pwd}/spec/.deployment_requisites_counter"
50
51
  @node.cd Dir.pwd + "/spec"
@@ -53,10 +54,10 @@ describe Deplomat::Node do
53
54
  @node.update_requisite_number!(2)
54
55
  expect(File.readlines(requisites_counter_fn).first.to_i).to eq(2)
55
56
 
56
- expect(-> { @node.update_requisite_number!(1) }).to raise_exception(Deplomat::RequisitesNumberError)
57
+ expect(-> { @node.update_requisite_number!(1) }).to raise_exception(SystemExit)
57
58
 
58
59
  File.unlink(requisites_counter_fn)
59
- expect(-> { @node.update_requisite_number!(3) }).to raise_exception(Deplomat::RequisitesNumberError)
60
+ expect(-> { @node.update_requisite_number!(3) }).to raise_exception(SystemExit)
60
61
  end
61
62
 
62
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deplomat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Snitko