Class: Releasecop::Checker
- Inherits:
-
Object
- Object
- Releasecop::Checker
- Defined in:
- lib/releasecop/checker.rb
Instance Attribute Summary collapse
-
#envs ⇒ Object
Returns the value of attribute envs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#working_dir ⇒ Object
Returns the value of attribute working_dir.
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(name, envs, working_dir = Releasecop::CONFIG_DIR) ⇒ Checker
constructor
A new instance of Checker.
- #puts_message(verbose_flag) ⇒ Object
- #unreleased ⇒ Object
Constructor Details
#initialize(name, envs, working_dir = Releasecop::CONFIG_DIR) ⇒ Checker
Returns a new instance of Checker.
5 6 7 8 9 |
# File 'lib/releasecop/checker.rb', line 5 def initialize(name, envs, working_dir = Releasecop::CONFIG_DIR) self.name = name self.envs = envs.map { |e| Releasecop::ManifestItem.new(name, e) } self.working_dir = working_dir end |
Instance Attribute Details
#envs ⇒ Object
Returns the value of attribute envs.
3 4 5 |
# File 'lib/releasecop/checker.rb', line 3 def envs @envs end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/releasecop/checker.rb', line 3 def name @name end |
#working_dir ⇒ Object
Returns the value of attribute working_dir.
3 4 5 |
# File 'lib/releasecop/checker.rb', line 3 def working_dir @working_dir end |
Instance Method Details
#check ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/releasecop/checker.rb', line 11 def check Dir.chdir(working_dir) do `git clone #{envs.first.git} #{'--bare' if envs.all?(&:bare_clone?)} #{name} > /dev/null 2>&1` Dir.chdir(name) do envs.each do |env| `git remote add #{env.name} #{env.git} > /dev/null 2>&1` `git fetch #{env.name} > /dev/null 2>&1` end comparisons = [] envs.each_cons(2) do |ahead, behind| comparisons << Releasecop::Comparison.new(ahead, behind) end comparisons.each &:check @result = Releasecop::Result.new(name, comparisons) end end end |
#puts_message(verbose_flag) ⇒ Object
32 33 34 |
# File 'lib/releasecop/checker.rb', line 32 def (verbose_flag) @result.(verbose_flag) end |
#unreleased ⇒ Object
36 37 38 |
# File 'lib/releasecop/checker.rb', line 36 def unreleased @result.unreleased end |