barruun 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b0b9a2fc5b72870179cb35d5c1da70d56253c8ee97df145bf85eac801635b84
4
- data.tar.gz: 7dafcd4ecb497036a3f44d10f334f41f9a5208acb6643268b1abd49e162b412d
3
+ metadata.gz: 9decd7dacebba1fb4656151f53f93ffb9eb40e50d11cf2857d94f8c39a91dcb3
4
+ data.tar.gz: 288089cad737ee2aeab66e9ca916b0b06d8cc2418da2b9fe2a0560016b2a7be2
5
5
  SHA512:
6
- metadata.gz: 7733b651373aed0fc762023acded6e7fcb08dd520ef417798446fcb17ea85a87bcbeea2b5b4661b05382852b9758cdd0dfde42ec3dcbf47a58bc2c3fe7ef71fe
7
- data.tar.gz: dee542b26955853f065da1977e27d6df4aa609e8f8b5d17d5829d1fdba51e0a3e7bdbbcbae15a112756afe8d773ce65cc6a2186483d03a7a25a143b8c1320f8c
6
+ metadata.gz: 80b36585f4e4b397208992ea82ed2ab90ed98147b5a37535f419ddb5b24f06ce619be1533dfae3fffa0fe9da0f76986eca1a6769d3ca0a76dac33374bc75da41
7
+ data.tar.gz: e7b8efa49ae874feb0f6e72f3fbc45dff60923209a072a60dc74724972b65ec79d42e6c1f2bd1a4ade594b2651fa89e2e1185d631a0143e19d799c10f0c590d6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- barruun (0.1.4)
4
+ barruun (0.1.5)
5
5
  active_hash
6
6
  thor (~> 1.1)
7
7
 
data/lib/barruun/cli.rb CHANGED
@@ -2,18 +2,25 @@ require "thor"
2
2
 
3
3
  module Barruun
4
4
  class StorageCommand < Thor
5
- desc "bucket [FILEPATH]", "Create or update bucket"
5
+ desc "bucket [FILEPATH]", "Create bucket"
6
6
  def bucket(file_path)
7
7
  Barruun::Managers::Storage::Bucket.new(file_path).call
8
8
  end
9
9
  end
10
10
 
11
11
  class LoggingCommand < Thor
12
- desc "sink [FILEPATH]", "Create or update sink"
12
+ desc "sink [FILEPATH]", "Create sink"
13
13
  def sink(file_path)
14
14
  Barruun::Managers::Logging::Sink.new(file_path).call
15
15
  end
16
16
  end
17
+
18
+ class BigqueryCommand < Thor
19
+ desc "dataset [FILEPATH]", "Create dataset"
20
+ def sink(file_path)
21
+ Barruun::Managers::Bigquery::Dataset.new(file_path).call
22
+ end
23
+ end
17
24
 
18
25
  class CLI < Thor
19
26
  def self.exit_on_failure?
@@ -22,5 +29,6 @@ module Barruun
22
29
 
23
30
  register(StorageCommand, 'storage', 'storage <command>', 'Manage Cloud Storage')
24
31
  register(LoggingCommand, 'logging', 'logging <command>', 'Manage Cloud Logging')
32
+ register(BigqueryCommand, 'bigquery', 'bigquery <command>', 'Manage BigQuery')
25
33
  end
26
34
  end
@@ -0,0 +1,19 @@
1
+ module Barruun
2
+ module Configurations
3
+ module Bigquery
4
+ class Dataset
5
+ def initialize(hash)
6
+ @hash = hash
7
+ end
8
+
9
+ def name
10
+ @hash["name"]
11
+ end
12
+
13
+ def options
14
+ @hash.reject { |k| ["name"].include?(k) }
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ require_relative "../../configurations/bigquery/dataset"
2
+ require_relative "../utils"
3
+
4
+ module Barruun
5
+ module Managers
6
+ module Bigquery
7
+ class Dataset
8
+ include Barruun::Managers::Utils
9
+
10
+ def create
11
+ `bq #{location_string} mk --dataset #{options_string(@config.options)} #{@config.name}`
12
+ end
13
+
14
+ def exist?
15
+ `bq ls`.include?(@config.name)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -8,7 +8,7 @@ module Barruun
8
8
  include Barruun::Managers::Utils
9
9
 
10
10
  def create
11
- `gcloud logging sinks create #{@config.name} #{@config.destination} #{options_string}`
11
+ `gcloud logging sinks create #{@config.name} #{@config.destination} #{options_string(@config.options)}`
12
12
  end
13
13
 
14
14
  def exist?
@@ -8,7 +8,7 @@ module Barruun
8
8
  include Barruun::Managers::Utils
9
9
 
10
10
  def create
11
- `gcloud alpha storage buckets create #{options_string} #{@config.name}`
11
+ `gcloud alpha storage buckets create #{options_string(@config.options)} #{@config.name}`
12
12
  end
13
13
 
14
14
  def exist?
@@ -24,8 +24,8 @@ module Barruun
24
24
  end
25
25
  end
26
26
 
27
- def options_string
28
- @config.options.map { |k, v| "--#{k}=#{v}" }.compact.join(" ")
27
+ def options_string(options)
28
+ options.map { |k, v| "--#{k}=#{v}" }.compact.join(" ")
29
29
  end
30
30
  end
31
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Barruun
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barruun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - cc-kawakami
@@ -60,8 +60,10 @@ files:
60
60
  - exe/barruun
61
61
  - lib/barruun.rb
62
62
  - lib/barruun/cli.rb
63
+ - lib/barruun/configurations/bigquery/dataset.rb
63
64
  - lib/barruun/configurations/logging/sink.rb
64
65
  - lib/barruun/configurations/storage/bucket.rb
66
+ - lib/barruun/managers/bigquery/dataset.rb
65
67
  - lib/barruun/managers/logging/sink.rb
66
68
  - lib/barruun/managers/storage/bucket.rb
67
69
  - lib/barruun/managers/utils.rb