Class: RoCommands::Init

Inherits:
Base show all
Defined in:
lib/ro_commands/init.rb

Instance Method Summary collapse

Methods inherited from Base

describe, inherited, method_added, meths, start, usage

Methods included from Bash

#_bash, #add_time, #bash, #bash_capture, #bash_capture_array, #bash_lines, #bash_per, #bash_system, #bundle_exec, #err, err, #handle_path, #kernel_system, out, #out, #status, status

Instance Method Details

#bundleObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ro_commands/init.rb', line 19

def bundle
  shortcut = Shortcuts.new
  Dir[File.join(::RoCommands.projects, '**')].each do |project|
    if test(?d, project)
      Dir.chdir project
      gemfile = File.join(project, 'Gemfile')
      if File.exist?(gemfile)
        gsub_file(gemfile, %r{source 'https://rubygems.org'}, %q(source 'http://ruby.taobao.org'))
        shortcut.send(:cmd, "cd #{project}")
        shortcut.send(:cmd, "bundle install")
      end
    end
  end
end

#cmds(*args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/ro_commands/init.rb', line 9

def cmds(*args)
  unless File.exist?("Gemfile")
    rott("Gemfile") do |content|
      "#{content}\ngem 'ro_commands'"
    end
  end
end

#zeus(*args) ⇒ Object



36
37
38
# File 'lib/ro_commands/init.rb', line 36

def zeus(*args)
  ::RoCommands::Zeus.new.init
end