Sha256: a2cc19cb81e293e5aebf852ff4a8ac4d80b482af0c848d8982df1b081f71e5e3

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require "CartBinaryUploader/version"
require 'fileutils'
require 'yaml'
require 'json'
require 'ostruct'
require 'google_cloud_storage'
require 'git_helper'

module CartBinaryUploader
  def self.run
    config = getConfig

    projectId = config.project.google.project_id
    credentialsFile = config.project.google.credentials_file
    bucketName = config.project.google.bucket
    frameworkName = config.project.framework.name
    frameworkVersion = config.project.framework.version

    gitHelper = GitHelper.new

    googleCloudStorage = GoogleCloudStorage.new(projectId,
                                                credentialsFile,
                                                bucketName,
                                                frameworkName,
                                                frameworkVersion)
    googleCloudStorage.uploadFrameWork
    gitHelper.tagTo frameworkVersion
    gitHelper.push
  end

  def self.getConfig
    begin
      puts "Creating project config"
      path = FileUtils.pwd + '/cart_uploader.yaml'
      yamlFile = YAML.load_file(path)
      object = JSON.parse(yamlFile.to_json, object_class: OpenStruct)
      puts "project config Created"
      object
    rescue SystemCallError
      puts "Problem to find or pase yaml file"
      exit
    end

  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
cartup-0.1.1 lib/cartup.rb
cartup-0.1.0 lib/cartup.rb
CartBinaryUploader-0.1.0 lib/CartBinaryUploader.rb