Sha256: 4379b58500885b7ff95a0fac79b58725ba455d432bb98bb4c5a87c8ed933266f
Contents?: true
Size: 1.56 KB
Versions: 6
Compression:
Stored size: 1.56 KB
Contents
# frozen_string_literal: true require 'thor' require 'abank/version' require 'abank/bigquery' require 'abank/folhacalculo' module Abank ID = `whoami`.chomp class Error < StandardError; end # CLI para carregar folhas calculo comuns no bigquery class CLI < Thor desc 'load', 'carrega dados da folha calculo no bigquery' option :d, banner: 'DIR', default: "/home/#{ID}/Downloads", desc: 'Onde procurar folhas calculo' option :x, banner: 'EXT', default: '.xlsx', desc: 'Extensao das folhas calculo' option :s, type: :boolean, default: false, desc: 'apaga linhas similares no bigquery' option :e, type: :boolean, default: false, desc: 'apaga linhas existentes no bigquery' # processa xlsx def load # opcoes apagar linhas d = options.select { |_, v| [true, false].include?(v) } Dir.glob("#{options[:d]}/*#{options[:x]}").sort.each do |f| Bigquery.new(f, d).processa end end desc 'mostra', 'mostra dados da folha calculo' option :d, banner: 'DIR', default: "/home/#{ID}/Downloads", desc: 'Onde procurar folhas calculo' option :x, banner: 'EXT', default: '.xlsx', desc: 'Extensao das folhas calculo' # mostra xlsx def mostra Dir.glob("#{options[:d]}/*#{options[:x]}").sort.each do |f| Bigquery.new(f).show end end desc 'classifica', 'classifica arquivo no bigquery' # classifica bigquery def classifica Bigquery.new.sql_update end default_task :mostra end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
abank-0.1.8 | lib/abank.rb |
abank-0.1.7 | lib/abank.rb |
abank-0.1.6 | lib/abank.rb |
abank-0.1.5 | lib/abank.rb |
abank-0.1.4 | lib/abank.rb |
abank-0.1.3 | lib/abank.rb |