Class: PGit::Installer
- Inherits:
-
Object
- Object
- PGit::Installer
- Defined in:
- lib/pgit/installer.rb
Instance Method Summary collapse
- #ask_continue ⇒ Object
-
#initialize(glob_opts, opts, args) ⇒ Installer
constructor
A new instance of Installer.
- #write_example_pgit_rc_file ⇒ Object
Constructor Details
#initialize(glob_opts, opts, args) ⇒ Installer
Returns a new instance of Installer.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/pgit/installer.rb', line 3 def initialize(glob_opts, opts, args) file_path = "~/.pgit.rc.yml" @expanded_path = File.(file_path) if File.exists? @expanded_path raise "Error: #{file_path} already exists" else ask_continue end end |
Instance Method Details
#ask_continue ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/pgit/installer.rb', line 14 def ask_continue puts "*** Installing example pgit configuration file under ~/.pgit.rc.yml. Continue? [Y/n]" if STDIN.gets.chomp.match(/y/i) puts "Saving example pgit config in ~/.pgit.rc.yml..." write_example_pgit_rc_file else puts "Aborting installation..." end end |
#write_example_pgit_rc_file ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/pgit/installer.rb', line 24 def write_example_pgit_rc_file File.open(@expanded_path, 'w') do |f| YAML.dump(PGit::Configuration., f) end puts "Saved! Please edit ~/.pgit.rc.yml and add the proper Pivotal Tracker API tokens, id, and file paths for each project" end |