patriot-gcp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 40974fda52b072f2713f5af1fdeb0d40007b12bc
4
- data.tar.gz: 444fd93b08537f1d1279100bbe73c1b2d773b6aa
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWU1ZjcyZTZkYjJlNmE2ZjVlNjU1MDVlOTNmOWRlOTAxOTQyZDU5Nw==
5
+ data.tar.gz: !binary |-
6
+ Njk2ZDkwZWJmY2IyNjM0ZGNmNzk5YTQ3MWQ3ZWIyOGM4NTMwNWI3OQ==
5
7
  SHA512:
6
- metadata.gz: 8645578eb374795e8bd9aae1398dca46cc257e0652a883b3d31cb604f534c88c70f872471b810c2084b5538593cb517824018cb1c6acfecfba56fe6aadf026c5
7
- data.tar.gz: f16cca37d6e4ce03a9ea8728cded822dec6d4b25d2584885183de77a50dbef6ef7c9c5555135a46fb6479951bddf8540aeb52c5a1b0e2a2f2864ae8957456353
8
+ metadata.gz: !binary |-
9
+ ZGQxM2E5ZDY2MjgwNGVlZTdlNmEzNmI0NTUyOGNlOTIyNWYwNGFmYmVmZDVk
10
+ MzU5ODNkZjhhNWE5OTMxZmNhZmZlZWQwMjljZjM4NjhkZWNmYTYyZWFhNmMw
11
+ MjdmNjliZGY1MmM4ZWIyN2JhZGM4MTdjMmZjZWI0NGQ2YWFlOWI=
12
+ data.tar.gz: !binary |-
13
+ NzRlYzRmYmFjMDU3ODIxNmQzOGRjOGRkMDc0OTVkZWE3ZDg2OWU3YjM5M2M2
14
+ Zjg2OTdlZTdlMTVhOTlmOTdkMzhiNDdkZDMyMmMyNzRkZDMwYjRmMjE0OTA3
15
+ YjYwMDA2ZmE5ZjY5ZjcxOTdhOTYyMDYwNDk5NWRhYTg3YzQyY2Y=
@@ -4,21 +4,34 @@ module PatriotGCP
4
4
  declare_command_name :load_to_bigquery
5
5
  include PatriotGCP::Ext::BigQuery
6
6
 
7
- command_attr :inifile, :dataset, :table, :schema, :options, :input_file, :name_suffix, :polling_interval
7
+ command_attr :inifile, :project_id, :dataset, :table, :schema, :options, :input_file, :name_suffix, :polling_interval
8
+ validate_existence :inifile, :project_id, :dataset, :table
8
9
 
9
10
  class BigQueryException < Exception; end
10
11
  class GoogleCloudPlatformException < Exception; end
11
12
 
12
13
  def job_id
13
- job_id = "#{command_name}_#{@dataset}_#{@table}"
14
- job_id = "#{job_id}_#{@name_suffix}" unless @name_suffix.nil?
15
- return job_id
14
+ "#{command_name}_#{@project_id}_#{@dataset}_#{@table}_#{@name_suffix}"
16
15
  end
17
16
 
17
+ # @see Patriot::Command::Base#configure
18
+ def configure
19
+ @name_suffix ||= _date_
20
+ self
21
+ end
18
22
 
19
23
  def execute
20
24
  @logger.info "start load_to_bigquery"
21
25
 
26
+ ini = IniFile.load(@inifile)
27
+ if ini.nil?
28
+ raise Exception, "inifile not found"
29
+ end
30
+
31
+ service_account = ini["gcp"]["service_account"]
32
+ private_key = ini["gcp"]["private_key"]
33
+ key_pass = ini["gcp"]["key_pass"]
34
+
22
35
  unless File.exist?(@input_file)
23
36
  raise Exception, "The given file doesn't exist."
24
37
  end
@@ -28,20 +41,8 @@ module PatriotGCP
28
41
  return
29
42
  end
30
43
 
31
- ini = IniFile.load(@inifile)
32
- if ini.nil?
33
- raise Exception, "inifile not found"
34
- end
35
-
36
- service_account = ini["gcp"]["service_account"]
37
- private_key = ini["gcp"]["private_key"]
38
- key_pass = ini["gcp"]["key_pass"]
39
- project_id = ini["bigquery"]["project_id"]
40
-
41
44
  if service_account.nil? or private_key.nil?
42
45
  raise GoogleCloudPlatformException, "configuration for GCP is not enough."
43
- elsif project_id.nil?
44
- raise BigQueryException, "configuration for BigQuery is not enough."
45
46
  end
46
47
 
47
48
  @logger.info "start uploading"
@@ -49,7 +50,7 @@ module PatriotGCP
49
50
  private_key,
50
51
  key_pass,
51
52
  service_account,
52
- project_id,
53
+ @project_id,
53
54
  @dataset,
54
55
  @table,
55
56
  @schema,
@@ -1,4 +1,4 @@
1
1
  class VERSION
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  PROJECT_NAME = "patriot-gcp"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patriot-gcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hitoshi Tsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-19 00:00:00.000000000 Z
11
+ date: 2016-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: patriot-workflow-scheduler
@@ -31,14 +31,14 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - lib/patriot_gcp/command/load_to_bigquery.rb
34
+ - init.rb
35
+ - lib/patriot_gcp.rb
35
36
  - lib/patriot_gcp/command.rb
36
- - lib/patriot_gcp/ext/bigquery.rb
37
+ - lib/patriot_gcp/command/load_to_bigquery.rb
37
38
  - lib/patriot_gcp/ext.rb
39
+ - lib/patriot_gcp/ext/bigquery.rb
38
40
  - lib/patriot_gcp/version.rb
39
- - lib/patriot_gcp.rb
40
- - init.rb
41
- homepage: https://github.com/CyberAgent/patriot-workflow-scheduler
41
+ homepage: https://github.com/CyberAgent/patriot-workflow-scheduler/tree/master/plugins/patriot-gcp
42
42
  licenses:
43
43
  - Apache License, Version 2.0
44
44
  metadata: {}
@@ -48,17 +48,17 @@ require_paths:
48
48
  - lib
49
49
  required_ruby_version: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - '>='
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - '>='
56
+ - - ! '>='
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
59
  requirements: []
60
60
  rubyforge_project: patriot-gcp
61
- rubygems_version: 2.0.14
61
+ rubygems_version: 2.4.7
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: GCP plugin for Patriot Workflow Scheduler