Class: Appraisal::Appraisal
- Inherits:
-
Object
- Object
- Appraisal::Appraisal
- Defined in:
- lib/appraisal/appraisal.rb
Overview
Represents one appraisal and its dependencies
Instance Attribute Summary collapse
-
#gemfile ⇒ Object
readonly
Returns the value of attribute gemfile.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #gem(name, *requirements) ⇒ Object
- #gemfile_path ⇒ Object
-
#initialize(name, source_gemfile) ⇒ Appraisal
constructor
A new instance of Appraisal.
- #install ⇒ Object
- #write_gemfile ⇒ Object
Constructor Details
#initialize(name, source_gemfile) ⇒ Appraisal
Returns a new instance of Appraisal.
10 11 12 13 |
# File 'lib/appraisal/appraisal.rb', line 10 def initialize(name, source_gemfile) @name = name @gemfile = source_gemfile.dup end |
Instance Attribute Details
#gemfile ⇒ Object (readonly)
Returns the value of attribute gemfile.
8 9 10 |
# File 'lib/appraisal/appraisal.rb', line 8 def gemfile @gemfile end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/appraisal/appraisal.rb', line 8 def name @name end |
Instance Method Details
#gem(name, *requirements) ⇒ Object
15 16 17 |
# File 'lib/appraisal/appraisal.rb', line 15 def gem(name, *requirements) gemfile.gem(name, *requirements) end |
#gemfile_path ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/appraisal/appraisal.rb', line 31 def gemfile_path unless ::File.exist?(gemfile_root) FileUtils.mkdir(gemfile_root) end ::File.join(gemfile_root, "#{name}.gemfile") end |
#install ⇒ Object
27 28 29 |
# File 'lib/appraisal/appraisal.rb', line 27 def install Command.new("bundle install --gemfile=#{gemfile_path}").run end |
#write_gemfile ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/appraisal/appraisal.rb', line 19 def write_gemfile ::File.open(gemfile_path, "w") do |file| file.puts("# This file was generated by Appraisal") file.puts file.write(gemfile.to_s) end end |