Class: LearnGenerate::IosLab
- Inherits:
-
Object
- Object
- LearnGenerate::IosLab
- Defined in:
- lib/learn_generate/ios_lab.rb,
lib/learn_generate/ios_lab/liftoff_backup.rb
Defined Under Namespace
Classes: LiftoffBackup
Instance Attribute Summary collapse
-
#full_templates_path ⇒ Object
readonly
Returns the value of attribute full_templates_path.
-
#has_templates_dir ⇒ Object
readonly
Returns the value of attribute has_templates_dir.
-
#lab_name ⇒ Object
readonly
Returns the value of attribute lab_name.
-
#liftoff_backup ⇒ Object
readonly
Returns the value of attribute liftoff_backup.
-
#liftoff_dir_exists ⇒ Object
readonly
Returns the value of attribute liftoff_dir_exists.
-
#liftoff_installed ⇒ Object
readonly
Returns the value of attribute liftoff_installed.
-
#liftoffrc_exists ⇒ Object
readonly
Returns the value of attribute liftoffrc_exists.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(lab_name) ⇒ IosLab
constructor
A new instance of IosLab.
Constructor Details
#initialize(lab_name) ⇒ IosLab
Returns a new instance of IosLab.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/learn_generate/ios_lab.rb', line 7 def initialize(lab_name) @lab_name = lab_name @liftoff_installed = !(`brew ls --versions liftoff 2>/dev/null`.strip.empty?) @liftoffrc_exists = File.exists?(File.('~/.liftoffrc')) @liftoff_dir_exists = File.exists?(File.('~/.liftoff')) @liftoff_backup = LearnGenerate::IosLab::LiftoffBackup.new templates_path = File.('~/.learn-generate/templates') templates_git_path = File.('~/.learn-generate/templates/.git') @has_templates_dir = File.exists?(templates_path) && File.directory?(templates_path) && File.exists?(templates_git_path) && File.directory?(templates_git_path) @full_templates_path = templates_path + '/templates' end |
Instance Attribute Details
#full_templates_path ⇒ Object (readonly)
Returns the value of attribute full_templates_path.
3 4 5 |
# File 'lib/learn_generate/ios_lab.rb', line 3 def full_templates_path @full_templates_path end |
#has_templates_dir ⇒ Object (readonly)
Returns the value of attribute has_templates_dir.
3 4 5 |
# File 'lib/learn_generate/ios_lab.rb', line 3 def has_templates_dir @has_templates_dir end |
#lab_name ⇒ Object (readonly)
Returns the value of attribute lab_name.
3 4 5 |
# File 'lib/learn_generate/ios_lab.rb', line 3 def lab_name @lab_name end |
#liftoff_backup ⇒ Object (readonly)
Returns the value of attribute liftoff_backup.
3 4 5 |
# File 'lib/learn_generate/ios_lab.rb', line 3 def liftoff_backup @liftoff_backup end |
#liftoff_dir_exists ⇒ Object (readonly)
Returns the value of attribute liftoff_dir_exists.
3 4 5 |
# File 'lib/learn_generate/ios_lab.rb', line 3 def liftoff_dir_exists @liftoff_dir_exists end |
#liftoff_installed ⇒ Object (readonly)
Returns the value of attribute liftoff_installed.
3 4 5 |
# File 'lib/learn_generate/ios_lab.rb', line 3 def liftoff_installed @liftoff_installed end |
#liftoffrc_exists ⇒ Object (readonly)
Returns the value of attribute liftoffrc_exists.
3 4 5 |
# File 'lib/learn_generate/ios_lab.rb', line 3 def liftoffrc_exists @liftoffrc_exists end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/learn_generate/ios_lab.rb', line 19 def execute exit_if_no_liftoff backup_if_necessary copy_settings_files system("liftoff -n #{lab_name}") restore_if_necessary end |