Sha256: b92c3d2381a41ae9af67e56dc7e0b99b8dd2d2266444bcab3e0dcdd03a71a4da

Contents?: true

Size: 1.01 KB

Versions: 128

Compression:

Stored size: 1.01 KB

Contents

require 'lhj/config'
require 'highline'
require 'lhj/helper/pod_repo_config'

module Lhj
  class Command
    # sync code to pod
    class SyncPodCode < Command
      self.summary = '同步代码到目标目录'

      def initialize(argv)
        @cli = HighLine.new
        super
      end

      def begin_title
        '读取映射文件~/.lhj/pod_config.yml'
      end

      def handle
        sync
      end

      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
    end
  end
end

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
lhj-tools-0.2.83 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.82 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.81 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.80 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.79 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.78 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.77 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.76 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.75 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.74 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.73 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.72 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.71 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.70 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.69 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.68 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.67 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.66 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.65 lib/lhj/command/sync_pod_code.rb
lhj-tools-0.2.64 lib/lhj/command/sync_pod_code.rb