Class: Lhj::Command::SyncPodCode
- Inherits:
-
Lhj::Command
- Object
- CLAide::Command
- Lhj::Command
- Lhj::Command::SyncPodCode
- Defined in:
- lib/lhj/command/sync_pod_code.rb
Overview
sync code to pod
Instance Method Summary collapse
- #begin_title ⇒ Object
- #handle ⇒ Object
-
#initialize(argv) ⇒ SyncPodCode
constructor
A new instance of SyncPodCode.
- #sync ⇒ Object
Methods inherited from Lhj::Command
Constructor Details
#initialize(argv) ⇒ SyncPodCode
Returns a new instance of SyncPodCode.
11 12 13 14 |
# File 'lib/lhj/command/sync_pod_code.rb', line 11 def initialize(argv) @cli = HighLine.new super end |
Instance Method Details
#begin_title ⇒ Object
16 17 18 |
# File 'lib/lhj/command/sync_pod_code.rb', line 16 def begin_title '读取映射文件~/.lhj/pod_config.yml' end |
#handle ⇒ Object
20 21 22 |
# File 'lib/lhj/command/sync_pod_code.rb', line 20 def handle sync end |
#sync ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/lhj/command/sync_pod_code.rb', line 24 def sync config_file = File.join(Lhj::Config.instance.home_dir, 'pod_config.yml') arr = YAML.load_file(config_file) arr.each_index { |i| puts "#{i}.#{arr[i]['pod']}".yellow } idx = @cli.ask('请选择哪一个库同步: '.green).strip.to_i src = arr[idx]['main_path'] dest = arr[idx]['pod_path'] FileUtils.cp_r(src, dest, remove_destination: true) puts '1.从主工程复制代码到pod库成功'.green Dir.chdir(dest) do Actions.sh('git add .') puts '2.git add成功'.green end end |