Sha256: 4bcc22e284db9f53fc44248e091df84138079ccd59e160bb2dc121e79bb41d1d

Contents?: true

Size: 835 Bytes

Versions: 7

Compression:

Stored size: 835 Bytes

Contents

require "colorize"
require "qiita_org/post.rb"
require "qiita_org/upload.rb"

class GetMultipleFiles
  def initialize(files, os, type)
    @files = files
    @option = nil
    @os = os
    @type = type
    unless @files[-1].match(/(.+).org/)
      @option = @files[-1]
      @files = @files[0..-2]
    end
  end

  def run()
    puts "#{@type} files: #{@files}".green
    @files.each do |file|
      mode = @option || QiitaBase.new().pick_up_option(file)
      puts "qiita #{@type} #{file} #{mode}".green
      if @type == "post"
        qiita = QiitaPost.new(file, mode, @os)
        begin
          qiita.select_option(mode)
        rescue RuntimeError => e
          puts $!
        else
          qiita.run
        end
      elsif @type == "upload"
        QiitaFileUpLoad.new(file, mode, @os).upload()
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
qiita_org-0.1.41 lib/qiita_org/get_multiple_files.rb
qiita_org-0.1.40 lib/qiita_org/get_multiple_files.rb
qiita_org-0.1.39 lib/qiita_org/get_multiple_files.rb
qiita_org-0.1.38 lib/qiita_org/get_multiple_files.rb
qiita_org-0.1.37 lib/qiita_org/get_multiple_files.rb
qiita_org-0.1.35 lib/qiita_org/get_multiple_files.rb
qiita_org-0.1.34 lib/qiita_org/get_multiple_files.rb