Sha256: 4005b6858679c7fc9d134063ac7685345706bbe760108a968b3a2ec6eb29413b

Contents?: true

Size: 1.28 KB

Versions: 24

Compression:

Stored size: 1.28 KB

Contents

require 'cocoapods-lhj-bin/helpers/oss_helper'

module Pod
  class Command
    class Bin < Command
      class Local < Bin
        class Upload < Local
          self.summary = '上传中英文对照csv文件'

          def self.options
            [
              %w[--upload-file 上传中英文对照csv文件名]
            ]
          end

          def initialize(argv)
            @pwd_path = argv.shift_argument || Dir.pwd
            @upload_csv_file = argv.option('upload-file', '*.csv')
            super
          end

          def csv_file_name
            file_name = @upload_csv_file
            file_name = "#{@upload_csv_file}.csv" unless /.csv$/ =~ @upload_csv_file
            file_name
          end

          def csv_oss_key(file_name)
            "csv/#{Time.now.to_i}/#{file_name}"
          end

          def run
            csv_files = File.join(@pwd_path, '**', csv_file_name)
            Dir.glob(csv_files).each do |f|
              file_name = File.basename(f)
              oss_key = csv_oss_key file_name
              CBin::OSS::Helper.instance.upload(oss_key, f)
              url = CBin::OSS::Helper.instance.object_url(oss_key)
              UI.puts "云端上传成功.下载Url:#{url}\n".green
            end
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
cocoapods-aomi-bin-0.1.28 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.27 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.26 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.25 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.24 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.23 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.22 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.21 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.20 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.19 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.18 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.17 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.16 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.15 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.14 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.13 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.12 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.11 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.10 lib/cocoapods-lhj-bin/command/bin/local/upload.rb
cocoapods-aomi-bin-0.1.9 lib/cocoapods-lhj-bin/command/bin/local/upload.rb