Class: Bob::Test::AbstractSCMRepo
- Inherits:
-
Object
- Object
- Bob::Test::AbstractSCMRepo
- Defined in:
- lib/bob/test/scm/abstract.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #add_commit(message, &action) ⇒ Object
- #add_failing_commit ⇒ Object
- #add_successful_commit ⇒ Object
- #commits ⇒ Object
- #head ⇒ Object
-
#initialize(name, base_dir = Bob.directory) ⇒ AbstractSCMRepo
constructor
A new instance of AbstractSCMRepo.
Constructor Details
#initialize(name, base_dir = Bob.directory) ⇒ AbstractSCMRepo
Returns a new instance of AbstractSCMRepo.
5 6 7 8 |
# File 'lib/bob/test/scm/abstract.rb', line 5 def initialize(name, base_dir=Bob.directory) @name = name @path = File.join(base_dir, @name.to_s) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/bob/test/scm/abstract.rb', line 3 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/bob/test/scm/abstract.rb', line 3 def path @path end |
Instance Method Details
#add_commit(message, &action) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/bob/test/scm/abstract.rb', line 10 def add_commit(, &action) Dir.chdir(path) do yield action commit() end end |
#add_failing_commit ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/bob/test/scm/abstract.rb', line 17 def add_failing_commit add_commit "This commit will fail" do system "echo '#{build_script(false)}' > test" system "chmod +x test" add "test" end end |
#add_successful_commit ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/bob/test/scm/abstract.rb', line 25 def add_successful_commit add_commit "This commit will work" do system "echo '#{build_script(true)}' > test" system "chmod +x test" add "test" end end |
#commits ⇒ Object
33 34 35 |
# File 'lib/bob/test/scm/abstract.rb', line 33 def commits raise NotImplementedError end |
#head ⇒ Object
37 38 39 |
# File 'lib/bob/test/scm/abstract.rb', line 37 def head commits.last["identifier"] end |