Class: Dtf::Command::SetupDtf
- Inherits:
-
Object
- Object
- Dtf::Command::SetupDtf
- Defined in:
- lib/dtf.rb
Overview
Copies Thor task(s) into any project which require’s the DTF master gem (this gem) and then calls ‘setup_dtf’ sub-command. e.g bundle exec dtf setup_dtf
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(cmd_name, options) ⇒ SetupDtf
constructor
A new instance of SetupDtf.
Constructor Details
#initialize(cmd_name, options) ⇒ SetupDtf
Returns a new instance of SetupDtf.
21 22 23 24 |
# File 'lib/dtf.rb', line 21 def initialize(cmd_name, ) @cmd_name = cmd_name @cmd_opts = end |
Instance Method Details
#execute ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dtf.rb', line 26 def execute if "#{Gem.loaded_specs['dtf'].gem_dir}" == "#{Dir.pwd}" $stderr.puts "Copying files over themselves is not usually good. Aborting!" abort() elsif ! File.exists?("#{Dir.pwd}/lib/tasks/setup.thor") puts "Installing DTF tasks" FileUtils.cp(Dir.glob("#{File.join("#{Gem.loaded_specs['dtf'].gem_dir}", 'lib/tasks/*')}"), "#{Dir.pwd}/lib/tasks/") else $stderr.puts "Copying files over themselves is not usually good. Aborting!" abort() end end |