cartup 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d47aff758b4d526908cb0f835d1e344633db47d5
4
+ data.tar.gz: fa108419cfac95213c57740038582c9337b1bd6b
5
+ SHA512:
6
+ metadata.gz: 303d6704577608e82b43f001033bcd3ce66ca037feafc40db0890404a0b20d1906627c01cbceafa052c066c993e8a85dbcf6e60fc0baf1124daffd8a4a429d7a
7
+ data.tar.gz: 697d8ce86623bded269af6bbf484968a0f1801609d2b91d3a1cf94d985bd5858b6da3d4cfc569184e4778d7060c0a632491fb34609917e532c03a1c17bb5ea64
data/.gitignore ADDED
@@ -0,0 +1,54 @@
1
+ *.gem
2
+ *.rbc
3
+ *.yaml
4
+ *.framework.zip
5
+ /.config
6
+ /coverage/
7
+ /InstalledFiles
8
+ /pkg/
9
+ /spec/reports/
10
+ /spec/examples.txt
11
+ /test/tmp/
12
+ /test/version_tmp/
13
+ /tmp/
14
+ CarrefourAPI.json
15
+ carrefour-dev-homolog-qa.json
16
+
17
+ # Used by dotenv library to load environment variables.
18
+ # .env
19
+
20
+ ## Specific to RubyMotion:
21
+ .dat*
22
+ .repl_history
23
+ build/
24
+ *.bridgesupport
25
+ build-iPhoneOS/
26
+ build-iPhoneSimulator/
27
+
28
+ ## Specific to RubyMotion (use of CocoaPods):
29
+ #
30
+ # We recommend against adding the Pods directory to your .gitignore. However
31
+ # you should judge for yourself, the pros and cons are mentioned at:
32
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
33
+ #
34
+ # vendor/Pods/
35
+
36
+ ## Documentation cache and generated files:
37
+ /.yardoc/
38
+ /_yardoc/
39
+ /doc/
40
+ /rdoc/
41
+
42
+ ## Environment normalization:
43
+ /.bundle/
44
+ /vendor/bundle
45
+ /lib/bundler/man/
46
+
47
+ # for a library or gem, you might want to ignore these files since the code is
48
+ # intended to run in multiple environments; otherwise, check them in:
49
+ # Gemfile.lock
50
+ # .ruby-version
51
+ # .ruby-gemset
52
+
53
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
54
+ .rvmrc
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ </profile>
6
+ </component>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at mendes-barreto@live.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,38 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "CartBinaryUploader/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cartup"
8
+ spec.version = CartBinaryUploader::VERSION
9
+ spec.authors = ["Douglas Mendes", "Rafael Ferreria"]
10
+ spec.email = ["mendes-barreto@live.com", "rafael.yami@hotmail.com"]
11
+
12
+ spec.summary = %q{This gem will do some thing important}
13
+ spec.description = %q{And after all will input some here to do}
14
+ spec.homepage = "https://github.com/mendesbarreto/cartup.git"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = ["cartup"]
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency 'bundler', '~> 1.16'
34
+ spec.add_development_dependency 'rake', '~> 10.0'
35
+ spec.add_development_dependency 'minitest', '~> 5.0'
36
+ spec.add_development_dependency 'google-cloud-storage', '~> 1.9'
37
+ spec.add_development_dependency 'json', '~> 2.1'
38
+ end
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in cartup.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,81 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cartup (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.5.2)
10
+ public_suffix (>= 2.0.2, < 4.0)
11
+ declarative (0.0.10)
12
+ declarative-option (0.1.0)
13
+ digest-crc (0.4.1)
14
+ faraday (0.14.0)
15
+ multipart-post (>= 1.2, < 3)
16
+ google-api-client (0.17.4)
17
+ addressable (~> 2.5, >= 2.5.1)
18
+ googleauth (>= 0.5, < 0.7.0)
19
+ httpclient (>= 2.8.1, < 3.0)
20
+ mime-types (~> 3.0)
21
+ representable (~> 3.0)
22
+ retriable (>= 2.0, < 4.0)
23
+ google-cloud-core (1.1.0)
24
+ google-cloud-env (~> 1.0)
25
+ google-cloud-env (1.0.1)
26
+ faraday (~> 0.11)
27
+ google-cloud-storage (1.9.0)
28
+ digest-crc (~> 0.4)
29
+ google-api-client (~> 0.17.0)
30
+ google-cloud-core (~> 1.1)
31
+ googleauth (~> 0.6.2)
32
+ googleauth (0.6.2)
33
+ faraday (~> 0.12)
34
+ jwt (>= 1.4, < 3.0)
35
+ logging (~> 2.0)
36
+ memoist (~> 0.12)
37
+ multi_json (~> 1.11)
38
+ os (~> 0.9)
39
+ signet (~> 0.7)
40
+ httpclient (2.8.3)
41
+ json (2.1.0)
42
+ jwt (2.1.0)
43
+ little-plugger (1.1.4)
44
+ logging (2.2.2)
45
+ little-plugger (~> 1.1)
46
+ multi_json (~> 1.10)
47
+ memoist (0.16.0)
48
+ mime-types (3.1)
49
+ mime-types-data (~> 3.2015)
50
+ mime-types-data (3.2016.0521)
51
+ minitest (5.11.3)
52
+ multi_json (1.13.1)
53
+ multipart-post (2.0.0)
54
+ os (0.9.6)
55
+ public_suffix (3.0.1)
56
+ rake (10.5.0)
57
+ representable (3.0.4)
58
+ declarative (< 0.1.0)
59
+ declarative-option (< 0.2.0)
60
+ uber (< 0.2.0)
61
+ retriable (3.1.1)
62
+ signet (0.8.1)
63
+ addressable (~> 2.3)
64
+ faraday (~> 0.9)
65
+ jwt (>= 1.5, < 3.0)
66
+ multi_json (~> 1.10)
67
+ uber (0.1.0)
68
+
69
+ PLATFORMS
70
+ ruby
71
+
72
+ DEPENDENCIES
73
+ bundler (~> 1.16)
74
+ cartup!
75
+ google-cloud-storage (~> 1.9)
76
+ json (~> 2.1)
77
+ minitest (~> 5.0)
78
+ rake (~> 10.0)
79
+
80
+ BUNDLED WITH
81
+ 1.16.1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Douglas Mendes Barreto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Douglas Mendes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # CartBinaryUploader
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/CartBinaryUploader`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'cartup'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install CartBinaryUploader
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/CartBinaryUploader. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the CartBinaryUploader project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/CartBinaryUploader/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cartup"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/cartup ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "cartup"
4
+
5
+ COMMAND_RUN = "run"
6
+
7
+ if ARGV[0] == COMMAND_RUN
8
+ CartBinaryUploader.run
9
+ else
10
+ puts "Please the command was not found try to run " + COMMAND_RUN
11
+ end
@@ -0,0 +1,3 @@
1
+ module CartBinaryUploader
2
+ VERSION = "0.1.0"
3
+ end
data/lib/cart_log.rb ADDED
@@ -0,0 +1,16 @@
1
+ require 'logger'
2
+
3
+ # module cartup
4
+ # class CartLog
5
+ # class << self
6
+ # def self.log
7
+ # if @logger.nil?
8
+ # @logger = Logger.new STDOUT
9
+ # @logger.level = Logger::DEBUG
10
+ # @logger.datetime_format = '%Y-%m-%d %H:%M:%S '
11
+ # end
12
+ # @logger
13
+ # end
14
+ # end
15
+ # end
16
+ # end
data/lib/cartup.rb ADDED
@@ -0,0 +1,46 @@
1
+ require "CartBinaryUploader/version"
2
+ require 'fileutils'
3
+ require 'yaml'
4
+ require 'json'
5
+ require 'ostruct'
6
+ require 'google_cloud_storage'
7
+ require 'git_helper'
8
+
9
+ module CartBinaryUploader
10
+ def self.run
11
+ config = getConfig
12
+
13
+ projectId = config.project.google.project_id
14
+ credentialsFile = config.project.google.credentials_file
15
+ bucketName = config.project.google.bucket
16
+ frameworkName = config.project.framework.name
17
+ frameworkVersion = config.project.framework.version
18
+
19
+ gitHelper = GitHelper.new
20
+
21
+ googleCloudStorage = GoogleCloudStorage.new(projectId,
22
+ credentialsFile,
23
+ bucketName,
24
+ frameworkName,
25
+ frameworkVersion)
26
+ googleCloudStorage.uploadFrameWork
27
+ gitHelper.tagTo frameworkVersion
28
+ gitHelper.push
29
+ end
30
+
31
+ def self.getConfig
32
+ begin
33
+ puts "Creating project config"
34
+ path = FileUtils.pwd + '/cart_uploader.yaml'
35
+ yamlFile = YAML.load_file(path)
36
+ object = JSON.parse(yamlFile.to_json, object_class: OpenStruct)
37
+ puts "project config Created"
38
+ object
39
+ rescue SystemCallError
40
+ puts "Problem to find or pase yaml file"
41
+ exit
42
+ end
43
+
44
+ end
45
+
46
+ end
data/lib/git_helper.rb ADDED
@@ -0,0 +1,27 @@
1
+
2
+ class GitHelper
3
+
4
+ def tagTo version
5
+ puts "Tagging version to: " + version
6
+ begin
7
+ cmd = "git tag -f " + version
8
+ exec( cmd )
9
+ puts "Version tagged"
10
+ rescue
11
+ puts "Problem to generate tag on git"
12
+ end
13
+ end
14
+
15
+ def push
16
+ puts "Pushing tag to Git "
17
+ begin
18
+ cmd = "git push --tags"
19
+ exec( cmd )
20
+ puts "Tag pushed"
21
+ rescue
22
+ puts "Problem to push tag on git"
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,115 @@
1
+ require 'google/cloud/storage'
2
+ require 'fileutils'
3
+ require 'yaml'
4
+ require 'json'
5
+
6
+ module CartBinaryUploader
7
+ class GoogleCloudStorage
8
+
9
+ FRAMEWORK_EXTENSION_NAME = ".framework"
10
+ JSON_EXTENSION_NAME = ".json"
11
+ JSON_EXTENSION_ZIP = ".zip"
12
+
13
+ attr_accessor :projectId
14
+ attr_accessor :credentialsFilePath
15
+ attr_accessor :bucketName
16
+ attr_accessor :frameworkName
17
+ attr_accessor :frameworkVersion
18
+
19
+ attr_accessor :storage
20
+ attr_accessor :bucket
21
+
22
+ def initialize( projectId, credentialsFile, bucketName, frameworkName, frameworkVersion )
23
+ @projectId = projectId
24
+ @credentialsFilePath = credentialsFile
25
+ @bucketName = bucketName
26
+ @frameworkName = frameworkName
27
+ @frameworkVersion = frameworkVersion
28
+ createStorage
29
+ createBucket
30
+ end
31
+
32
+ def createStorage
33
+ puts "Creating google storage with id: " + @projectId + "credenciasPath: " + @credentialsFilePath
34
+ @storage = Google::Cloud::Storage.new(
35
+ project_id: @projectId,
36
+ credentials: @credentialsFilePath
37
+ )
38
+ end
39
+
40
+ def createBucket
41
+ puts "Creating bucket name: " + @bucketName
42
+ @bucket = @storage.bucket @bucketName
43
+ end
44
+
45
+ def uploadFrameWork
46
+ puts "Prepering to upload file to google cloud"
47
+ frameworkNameSource = @frameworkName + FRAMEWORK_EXTENSION_NAME + JSON_EXTENSION_ZIP
48
+ frameworkNameDestination = @frameworkName + FRAMEWORK_EXTENSION_NAME + "." + @frameworkVersion + JSON_EXTENSION_ZIP
49
+ jsonPath = @frameworkName + JSON_EXTENSION_NAME
50
+
51
+ puts "Framework Source: " + frameworkNameSource
52
+ puts "Framework Destination: " + frameworkNameDestination
53
+ puts "JSON Path: " + jsonPath
54
+
55
+ unless !hasFileOnGoogleCloud frameworkNameDestination
56
+ throw :the_version_file_already_exists, "The current version: " + @frameworkVersion + " already exists on google cloud"
57
+ else
58
+ puts "File version "+ @frameworkVersion +" not exists yet, starting generate file on google cloud"
59
+ jsonFile = downloadZConfigJsonFile(jsonPath)
60
+
61
+ if jsonFile.nil?
62
+ throw :could_not_download_json_file, "JSON With name: " + jsonPath
63
+ end
64
+
65
+ frameworkFile = bucket.create_file(frameworkNameSource, frameworkNameDestination)
66
+ sharedUrl = frameworkFile.signed_url(method: 'GET', expires: 3.154e+8)
67
+
68
+ jsonObject = loadJSONObject jsonPath
69
+ jsonObject[@frameworkVersion] = sharedUrl
70
+
71
+ saveJSONObject(jsonPath, jsonObject)
72
+
73
+ uploadJson jsonPath
74
+ end
75
+ end
76
+
77
+ def hasFileOnGoogleCloud file
78
+ puts "Verifying if the version file "+ file +" already exists"
79
+ bucketFile = bucket.file file
80
+ !bucketFile.nil?
81
+ end
82
+
83
+ def downloadZConfigJsonFile fromFile
84
+ #jsonPath = 'CarrefourAPI.json'
85
+ jsonFile = @bucket.file fromFile
86
+ jsonFile.download fromFile
87
+ jsonFile
88
+ end
89
+
90
+ def loadJSONObject jsonPath
91
+ puts "Loading JSON file"
92
+ json = File.read(jsonPath)
93
+ object = JSON.parse(json)
94
+ puts object
95
+ puts "JSON Loaded"
96
+ object
97
+ end
98
+
99
+ def saveJSONObject(jsonPath, jsonObject)
100
+ binaryJson = JSON.pretty_generate(jsonObject)
101
+ puts "Saving JSON Object in: " + jsonPath + "JSON: " + binaryJson
102
+ File.write(jsonPath, binaryJson)
103
+ puts "JSON Saved"
104
+ end
105
+
106
+
107
+ def uploadJson jsonPath
108
+ puts "Starting upload file to google cloud"
109
+ @bucket.create_file(jsonPath, jsonPath)
110
+ puts "Uploaded complete"
111
+ end
112
+
113
+ end
114
+ end
115
+
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cartup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Douglas Mendes
8
+ - Rafael Ferreria
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2018-02-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.16'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.16'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '10.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '10.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: minitest
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '5.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '5.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: google-cloud-storage
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.9'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.9'
70
+ - !ruby/object:Gem::Dependency
71
+ name: json
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '2.1'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '2.1'
84
+ description: And after all will input some here to do
85
+ email:
86
+ - mendes-barreto@live.com
87
+ - rafael.yami@hotmail.com
88
+ executables:
89
+ - cartup
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - ".gitignore"
94
+ - ".idea/inspectionProfiles/Project_Default.xml"
95
+ - ".idea/vcs.xml"
96
+ - CODE_OF_CONDUCT.md
97
+ - CartBinaryUploader.gemspec
98
+ - Gemfile
99
+ - Gemfile.lock
100
+ - LICENSE
101
+ - LICENSE.txt
102
+ - README.md
103
+ - Rakefile
104
+ - bin/console
105
+ - bin/setup
106
+ - exe/cartup
107
+ - lib/CartBinaryUploader/version.rb
108
+ - lib/cart_log.rb
109
+ - lib/cartup.rb
110
+ - lib/git_helper.rb
111
+ - lib/google_cloud_storage.rb
112
+ homepage: https://github.com/mendesbarreto/cartup.git
113
+ licenses:
114
+ - MIT
115
+ metadata:
116
+ allowed_push_host: https://rubygems.org
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 2.6.8
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: This gem will do some thing important
137
+ test_files: []