Class: Cli

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
bin/nsp

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.destination_rootObject



50
51
52
# File 'bin/nsp', line 50

def self.destination_root 
  cwd.to_s
end

Instance Method Details

#installObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'bin/nsp', line 14

def install
  unless rails_root?
    say("  Error: current directory:#{cwd} is not a rails app root!", :red)
    return
  end
  unless use_bundler?
    say("  Error: now only support Bundler's gem managed mechanism!", :red)
    return
  end
  #say "force: #{options.force?}", :red #TODO
  if !has_installed? || options.force?
    init_files.each {|f| copy_file(f) }
    unless has_installed?
      append_file 'Gemfile' do 
        <<-Doc
gem 'ns_service_pack' #use our service pack
        Doc
      end
    end
  else
    say("  Has installed ns_service_pack in this project!", :yellow)
  end
end

#uninstallObject



39
40
41
42
43
44
45
46
47
48
# File 'bin/nsp', line 39

def uninstall
  unless has_installed?
    if yes?("Are you sure uninstall ns_service_pack from this project?")
      #remove_file('config/code_hashes/') TODO
      say("This is not implemented now, please ask for caory!", :yellow)
    end
  else
    say("  Not install ns_service_pack now!", :yellow)
  end 
end