cartup 0.1.7.1 → 1.0.0

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
  SHA1:
3
- metadata.gz: cf97736e1e2ec336438ccf1d72a783814f17e5f7
4
- data.tar.gz: 9abbec7ebac6a0e92a2fcf68532a9904b45c1ac7
3
+ metadata.gz: 4b529da15184419a5a526234a6fc53217ed14555
4
+ data.tar.gz: 6bf24022197f7ca8bf0fc3103ed6c9eef194329a
5
5
  SHA512:
6
- metadata.gz: cf763ead52ba72c9f017cf28679b752b628fb4933cdb9d280ea1ccc174eec985b64e2d967b943d8e08b59a0a310c4bf1e52728a71f7531e4030701e8b4f9311b
7
- data.tar.gz: 4aa29649794acbb58b9fe6ca523bf0acd653787ec82c76b72d477e5ca47e18b7e9a049a5086add65bb8875f5538c49584b6d5a5bfd5c09d465a18c6038b84c27
6
+ metadata.gz: d14623ba35b5b2b389bef2e477e3b62276be420534b6948980b0dc65813ad3dfa7e3d3df7fa08fe314b77803c4df25e19a07eaeb6b62d28b8701677053e1b92a
7
+ data.tar.gz: 91db41918a0847b6aed2f71da4ee53aba8736d72ff8529971a452afd2b40c3ee2ad7eb920b14263621f3533825a1ef138048f480bda65d0be36737862ec4b573
@@ -32,10 +32,12 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = ['cartup']
33
33
  spec.require_paths = ['lib']
34
34
 
35
+ spec.add_development_dependency 'aws-sdk-s3', '~> 1.8', '>= 1.8.2'
35
36
  spec.add_development_dependency 'bundler', '~> 1.16'
36
- spec.add_development_dependency 'rake', '~> 10.0'
37
- spec.add_development_dependency 'minitest', '~> 5.0'
37
+ spec.add_development_dependency 'colorize', '~> 0.8.1'
38
38
  spec.add_development_dependency 'google-cloud-storage', '~> 1.9'
39
39
  spec.add_development_dependency 'json', '~> 2.1'
40
- spec.add_development_dependency 'colorize', '~> 0.8.1'
40
+ spec.add_development_dependency 'minitest', '~> 5.0'
41
+ spec.add_development_dependency 'rake', '~> 10.0'
42
+
41
43
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cartup (0.1.7.1)
4
+ cartup (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -9,6 +9,19 @@ GEM
9
9
  addressable (2.5.2)
10
10
  public_suffix (>= 2.0.2, < 4.0)
11
11
  ast (2.4.0)
12
+ aws-partitions (1.70.0)
13
+ aws-sdk-core (3.17.0)
14
+ aws-partitions (~> 1.0)
15
+ aws-sigv4 (~> 1.0)
16
+ jmespath (~> 1.0)
17
+ aws-sdk-kms (1.5.0)
18
+ aws-sdk-core (~> 3)
19
+ aws-sigv4 (~> 1.0)
20
+ aws-sdk-s3 (1.8.2)
21
+ aws-sdk-core (~> 3)
22
+ aws-sdk-kms (~> 1)
23
+ aws-sigv4 (~> 1.0)
24
+ aws-sigv4 (1.0.2)
12
25
  colorize (0.8.1)
13
26
  declarative (0.0.10)
14
27
  declarative-option (0.1.0)
@@ -40,6 +53,7 @@ GEM
40
53
  os (~> 0.9)
41
54
  signet (~> 0.7)
42
55
  httpclient (2.8.3)
56
+ jmespath (1.3.1)
43
57
  json (2.1.0)
44
58
  jwt (2.1.0)
45
59
  little-plugger (1.1.4)
@@ -86,6 +100,7 @@ PLATFORMS
86
100
  ruby
87
101
 
88
102
  DEPENDENCIES
103
+ aws-sdk-s3 (~> 1.8, >= 1.8.2)
89
104
  bundler (~> 1.16)
90
105
  cartup!
91
106
  colorize (~> 0.8.1)
data/README.md CHANGED
@@ -1,28 +1,35 @@
1
1
  ![](logo/cartup_logo.png)
2
- # Cartup
2
+ # Cartup
3
3
 
4
- **Cartup** is the easyest way to share prebuilts [Carthage](https://github.com/Carthage/Carthage) frameworks between projects.
4
+ **Cartup** is the easiest way to share prebuilt [Carthage](https://github.com/Carthage/Carthage)
5
+ frameworks between projects.
5
6
 
6
- The main propose of this gem is uploading the [Carthage](https://github.com/Carthage/Carthage) prebuilts frameworks to a cloud
7
- storage like google drive, onedrive, dropbox or google cloud. To know more how to make prebuilts with Carthage please follow
8
- the [link about how to do it](https://github.com/Carthage/Carthage#archive-prebuilt-frameworks-into-one-zip-file)
7
+ The main propose of this gem is uploading the [Carthage](https://github.com/Carthage/Carthage)
8
+ prebuilt frameworks to a cloud storage like google drive, onedrive, dropbox or google cloud.
9
+ To know more how to make pre-builds with Carthage please follow the
10
+ [link about how to do it](https://github.com/Carthage/Carthage#archive-prebuilt-frameworks-into-one-zip-file).
9
11
 
10
12
 
11
- Currently, the main reason is because only github projects could upload a prebuilts frameworks and distrubuite
12
- them using a great github tool called ["RELEASES"](https://help.github.com/articles/creating-releases/) automatically.
13
- To people like me who works using Bitbucket (not because of my choice) the all process should be done manually. So you should
14
- upload the prebuilts frameworks on some sort of cloud storage and manage the version using a JSON file and upload
15
- manually and because that the gem was born! To the people like me who are a bit lazy and do not like to do manual job,
16
- this is for you!!!
13
+ Currently, the main reason why Cartup exists is because only github projects could
14
+ upload and distribute prebuilt frameworks automatically, by using the great github
15
+ tool called ["RELEASES"](https://help.github.com/articles/creating-releases/).
16
+ But when you work using Bitbucket like I do (not by choice), the whole process must
17
+ be done manually: you must upload the prebuilt framework on some sort of cloud
18
+ storage, manage its version using a JSON file and upload it manually.
17
19
 
18
- **So, in a head line: Our gem wants to make the process of distribution of prebuild carthage binaries easier through the
19
- most populars storage clouds.**
20
+ And because of that, the gem was born! To people like me, who are a bit lazy and
21
+ do not like doing manual job, this is for them!
20
22
 
21
- *One big thanks for my friend and brother [Rafael Ferreira](https://github.com/RafaelPlantard) that made the initial
22
- script and that's give me idea to bring it to a ruby plugin and distribute to every body by RubyGem!*
23
+ **So, in a headline: Our gem wants to make the distribution process of
24
+ prebuild carthage binaries easier through the most popular storage clouds.**
25
+
26
+ *One big thanks to my friend and brother [Rafael Ferreira](https://github.com/RafaelPlantard)
27
+ who made the initial script. That's what gave me the idea to bring it to a ruby
28
+ plugin and distribute it to everybody with RubyGem!*
23
29
 
24
30
  ## Supported Storage Clouds
25
31
  * [Firebase Cloud Storage](https://firebase.google.com/docs/storage/?gclid=Cj0KCQiAzfrTBRC_ARIsAJ5ps0uB9qOHR9kDhzlqReNfQlhrRJH7gWwHRCbl-XQRIJEvt9jN6ROPdxQaAohIEALw_wcB)
32
+ * [S3 Amazon](https://aws.amazon.com/s3/?sc_channel=PS&sc_campaign=acquisition_BR&sc_publisher=google&sc_medium=english_s3_b&sc_content=s3_e&sc_detail=s3%20amazon&sc_category=s3&sc_segment=89108864308&sc_matchtype=e&sc_country=BR&s_kwcid=AL!4422!3!89108864308!e!!g!!s3%20amazon&ef_id=WrKALgAABG2ITkaZ:20180321155422:s)
26
33
 
27
34
  ## Installation
28
35
 
@@ -44,8 +51,9 @@ Or install it yourself as:
44
51
 
45
52
  ### Setup with yaml
46
53
 
47
- The first thing is setup the yaml file in or project.
48
- Create a file name called ```cart_uploader.yaml``` inside of this file insert:
54
+ The first thing is to setup the yaml file in your project.
55
+ Create a file named ```cart_uploader.yaml```.
56
+ Inside of this file, insert:
49
57
 
50
58
  ```yaml
51
59
  project:
@@ -56,19 +64,24 @@ project:
56
64
  project_id: "<Insert here Google project ID>"
57
65
  credentials_file: "<Insert here The path to credential file that you download from firebase>"
58
66
  bucket: "<Insert here the name of destination bucket on google cloud>"
67
+ s3:
68
+ region: "<Insert Region Name where you bucket is located"
69
+ bucket_name: "<The nam of you bucket>"
70
+ bucket_access_key: '<Your access key>'
71
+ bucket_secret_key: '<Your secret key>'
59
72
  ```
60
73
  ### Upload a binary
61
74
 
62
- After you have created the ````yaml```` file and setup it, you are ready to send the prebuilt frame
63
- some cloud storage.
75
+ After you have created the ````yaml```` file and set it up, you are ready to send
76
+ the prebuilt framework to some cloud storage.
64
77
 
65
- **Before you could run the upload command make you already make the follow steps:**
66
- * Generated the build with carthage like ```carthage build --no-skip-current```
78
+ **Before you run the upload command, make sure you have already passed through the following steps:**
79
+ * Generated the build with carthage with ```carthage build --no-skip-current```
67
80
  * Archived the framework with carthage with the command ```carthage archive <YourFrameworkName>```
68
81
 
69
- *If you hae any doubts about how to generate prebuilts framework [click here to see more information](https://github.com/Carthage/Carthage#archive-prebuilt-frameworks-into-one-zip-file))*
82
+ *If you have any doubts about how to generate prebuilt frameworks, [click here to see more information](https://github.com/Carthage/Carthage#archive-prebuilt-frameworks-into-one-zip-file))*
70
83
 
71
- Now everything is alright jus run the follow command:
84
+ Now everything is alright, just run the following command:
72
85
 
73
86
  if you are running with bundler:
74
87
  ```
@@ -82,13 +95,20 @@ cartup run
82
95
 
83
96
  ## Development
84
97
 
85
- 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.
98
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
99
+ `rake test` to run the tests. You can also run `bin/console` for an interactive
100
+ prompt that will allow you to experiment.
86
101
 
87
- 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).
102
+ To install this gem into your local machine, run `bundle exec rake install`. To
103
+ release a new version, update the version number in `version.rb`, and then run
104
+ `bundle exec rake release`. This will create a git tag for the version, push git
105
+ commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
88
106
 
89
107
  ## Contributing
90
108
 
91
- Bug reports and pull requests are welcome on GitHub at https://github.com/mendesbarreto/cartup/. 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.
109
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mendesbarreto/cartup/.
110
+ This project is intended to be a safe, welcoming space for collaboration, and contributors
111
+ are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
92
112
 
93
113
  ## License
94
114
 
@@ -96,4 +116,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
96
116
 
97
117
  ## Code of Conduct
98
118
 
99
- Everyone interacting in the Cartup project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mendesbarreto/cartup/blob/master/CODE_OF_CONDUCT.md).
119
+ Everyone interacting in the Cartup project’s codebases, issue trackers, chat rooms
120
+ and mailing lists are expected to follow the [code of conduct](https://github.com/mendesbarreto/cartup/blob/master/CODE_OF_CONDUCT.md).
data/bin/setup CHANGED
@@ -3,6 +3,8 @@ set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
- bundle install
6
+ rbenv install
7
+
8
+ gem install bundler
7
9
 
8
- # Do any other automated setup that you need to do here
10
+ bundle install
@@ -1,3 +1,3 @@
1
1
  module CartBinaryUploader
2
- VERSION = '0.1.7.1'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
@@ -18,6 +18,10 @@ module CartBinaryUploader
18
18
  CartLogger.log.info string
19
19
  end
20
20
 
21
+ def log_warn string
22
+ CartLogger.log.warn string
23
+ end
24
+
21
25
  def log_error string
22
26
  CartLogger.log.error string.to_s.colorize(:color => :white, :background => :red)
23
27
  end
@@ -3,40 +3,66 @@ require 'fileutils'
3
3
  require 'yaml'
4
4
  require 'json'
5
5
  require 'ostruct'
6
- require 'google_cloud_storage'
7
- require 'git_helper'
6
+ require 'storage/google_cloud_storage'
7
+ require 'storage/storage_type'
8
+ require 'git_tools/git_helper'
8
9
  require 'cartup_command_helper'
9
10
  require 'cart_logger'
11
+ require 'storage/s3_cloud_storage'
10
12
 
11
13
  module CartBinaryUploader
12
14
  def self.run
13
15
  config = get_config
14
16
 
15
- project_id = config.project.google.project_id
16
- credentials_file = config.project.google.credentials_file
17
- bucket_name = config.project.google.bucket
18
- framework_name = config.project.framework.name
19
17
  framework_version = config.project.framework.version
20
18
 
21
19
  git_helper = GitHelper.new
22
20
 
23
- google_cloud_storage = GoogleCloudStorage.new(project_id,
24
- credentials_file,
25
- bucket_name,
26
- framework_name,
27
- framework_version)
28
- google_cloud_storage.upload_framework
21
+ cloud_storage = setup config
22
+ cloud_storage.upload_framework
29
23
  git_helper.tag_to framework_version
30
24
  git_helper.push
31
25
  end
32
26
 
27
+ def self.setup config
28
+ if !config.project.google?
29
+ CartLogger.log_info 'Starting with google cloud'
30
+ setup_google_cloud config
31
+ else
32
+ CartLogger.log_info 'Starting with s3 cloud'
33
+ setup_s3_cloud config
34
+ end
35
+ end
36
+
37
+ def self.setup_google_cloud(config)
38
+ GoogleCloudStorage.new(config.project.google.project_id,
39
+ config.project.google.credentials_file,
40
+ config.project.google.bucket,
41
+ config.project.framework.name,
42
+ config.project.framework.version)
43
+ end
44
+
45
+ def self.setup_s3_cloud(config)
46
+ S3CloudStorage.new(config.project.s3.bucket_name,
47
+ config.project.s3.bucket_access_key,
48
+ config.project.s3.bucket_secret_key,
49
+ config.project.s3.region,
50
+ config.project.framework.name,
51
+ config.project.framework.version)
52
+ end
53
+
33
54
  def self.init
34
55
  CartBinaryUploader.copy_template_yaml
35
56
  end
36
57
 
37
58
  def self.copy_template_yaml
38
- from_source_file = './lib/template.yaml'
39
- to_destination_file = './cart_uploader.yaml'
59
+ from_source_file = './lib/template.yaml'.freeze
60
+ to_destination_file = './cart_uploader.yaml'.freeze
61
+
62
+ if File.file?(to_destination_file)
63
+ throw :cart_up_already_initialized
64
+ end
65
+
40
66
  CartBinaryUploader.copy_with_path from_source_file, to_destination_file
41
67
  end
42
68
 
@@ -17,7 +17,6 @@ module CartBinaryUploader
17
17
  EOF
18
18
  end
19
19
 
20
-
21
20
  def handle(command)
22
21
  case command
23
22
  when COMMAND_RUN
@@ -0,0 +1,56 @@
1
+ require 'google/cloud/storage'
2
+ require 'fileutils'
3
+ require 'yaml'
4
+ require 'json'
5
+ require 'cart_logger'
6
+ require_relative 'storage_type'
7
+
8
+ module CartBinaryUploader
9
+ class GoogleCloudStorage < Storage
10
+ attr_accessor :credentials_file_path
11
+ attr_accessor :project_id
12
+
13
+ def initialize(project_id,
14
+ credentials_file,
15
+ bucket_name,
16
+ framework_name,
17
+ framework_version)
18
+ @credentials_file_path = credentials_file
19
+ @project_id = project_id
20
+ super(bucket_name, framework_name, framework_version)
21
+ end
22
+
23
+ def create_storage
24
+ @storage = Google::Cloud::Storage.new(project_id: @project_id,
25
+ credentials: @credentials_file_path)
26
+ end
27
+
28
+ def create_bucket
29
+ @bucket = @storage.bucket @bucket_name
30
+ end
31
+
32
+ def create_file(file_path)
33
+ @bucket_object = @bucket.create_file(file_path, file_path)
34
+ @bucket_object.signed_url(method: 'GET', expires: 3.154e+8)
35
+ end
36
+
37
+ def file_on_storage_cloud(file)
38
+ bucket_file = bucket.file file
39
+ !bucket_file.nil?
40
+ end
41
+
42
+ def download_config_json_file(from_file)
43
+ json_file = @bucket.file from_file
44
+ json_file.download from_file
45
+ json_file
46
+ end
47
+
48
+ def upload_json(json_path)
49
+ CartLogger.log_info 'Starting upload file to google cloud'
50
+ @bucket.create_file(json_path, json_path)
51
+ CartLogger.log_info 'Uploaded complete'
52
+ end
53
+
54
+ end
55
+ end
56
+
@@ -0,0 +1,74 @@
1
+ require 'aws-sdk-s3'
2
+ require 'fileutils'
3
+ require 'json'
4
+ require 'yaml'
5
+ require 'json'
6
+ require 'cart_logger'
7
+ require_relative 'storage_type'
8
+
9
+ module CartBinaryUploader
10
+ class S3CloudStorage < Storage
11
+
12
+ attr_accessor :region_name
13
+ attr_accessor :bucket_secret_key
14
+ attr_accessor :bucket_access_key
15
+
16
+ def initialize(bucket_name,
17
+ bucket_secrete_key,
18
+ bucket_acess_key,
19
+ region_name,
20
+ framework_name,
21
+ framework_version)
22
+ @region_name = region_name
23
+ @bucket_secret_key = bucket_secrete_key
24
+ @bucket_access_key = bucket_acess_key
25
+ setup_s3_global
26
+ super(bucket_name, framework_name, framework_version)
27
+ end
28
+
29
+ def setup_s3_global
30
+ Aws.config = {
31
+ :access_key_id => @bucket_access_key,
32
+ :secret_access_key => @bucket_secret_key,
33
+ :region => @region_name,
34
+ }
35
+ end
36
+
37
+ def create_storage
38
+ @storage = Aws::S3::Resource.new(credentials: Aws::Credentials.new(@bucket_secret_key, @bucket_access_key),
39
+ region: @region_name)
40
+ end
41
+
42
+ def create_bucket
43
+ @bucket = @storage.bucket(@bucket_name)
44
+ end
45
+
46
+ def create_file(file_path)
47
+ puts "Creating #{file_path} on s3"
48
+ @bucket_object = @bucket.object(file_path)
49
+ @bucket_object.upload_file("./#{file_path}", acl:'public-read')
50
+ puts "Object #{file_path} created with url #{@bucket_object.public_url}"
51
+ @bucket_object.public_url
52
+ end
53
+
54
+
55
+ def file_on_storage_cloud(file)
56
+ @bucket.objects.each do |object|
57
+ if object.key == file
58
+ return true
59
+ end
60
+ end
61
+ false
62
+ end
63
+
64
+ def download_config_json_file(from_file)
65
+ @bucket.object(from_file)
66
+ end
67
+
68
+ def upload_json(json_path)
69
+ CartLogger.log_info 'Starting upload json file to s3 cloud'
70
+ create_file(json_path)
71
+ CartLogger.log_info 'Uploaded complete'
72
+ end
73
+ end
74
+ end
@@ -1,52 +1,44 @@
1
- require 'google/cloud/storage'
2
1
  require 'fileutils'
3
2
  require 'yaml'
4
3
  require 'json'
5
4
  require 'cart_logger'
6
5
 
7
6
  module CartBinaryUploader
8
- class GoogleCloudStorage
9
-
7
+ class Storage
10
8
  FRAMEWORK_EXTENSION_NAME = '.framework'.freeze
11
9
  JSON_EXTENSION_NAME = '.json'.freeze
12
10
  JSON_EXTENSION_ZIP = '.zip'.freeze
13
11
 
14
- attr_accessor :project_id
15
- attr_accessor :credentials_file_path
16
12
  attr_accessor :bucket_name
17
13
  attr_accessor :framework_name
18
14
  attr_accessor :framework_version
19
-
20
- attr_accessor :storage
21
15
  attr_accessor :bucket
16
+ attr_accessor :json_file
17
+ attr_accessor :bucket_object
22
18
 
23
- def initialize(project_id,
24
- credentials_file,
25
- bucket_name,
19
+ def initialize(bucket_name,
26
20
  framework_name,
27
- framework_version )
28
- @project_id = project_id
29
- @credentials_file_path = credentials_file
21
+ framework_version)
30
22
  @bucket_name = bucket_name
31
23
  @framework_name = framework_name
32
24
  @framework_version = framework_version
25
+
26
+ CartLogger.log_info "Creating storage"
33
27
  create_storage
28
+ CartLogger.log_info "Creating bucket name: #{@bucket_name}"
34
29
  create_bucket
35
30
  end
36
31
 
37
32
  def create_storage
38
- CartLogger.log_info "Creating storage with id: #{@project_id} path: #{@credentials_file_path}"
39
- @storage = Google::Cloud::Storage.new(project_id: @project_id,
40
- credentials: @credentials_file_path)
33
+ throw :not_implemented, "The current method not implemented"
41
34
  end
42
35
 
43
36
  def create_bucket
44
- CartLogger.log_info "Creating bucket name: #{@bucket_name}"
45
- @bucket = @storage.bucket @bucket_name
37
+ throw :not_implemented, "The current method not implemented"
46
38
  end
47
39
 
48
40
  def upload_framework
49
- CartLogger.log_info "Prepering to upload file to google cloud"
41
+ CartLogger.log_info "Prepering to upload file to cloud"
50
42
  framework_name_source = @framework_name + FRAMEWORK_EXTENSION_NAME + JSON_EXTENSION_ZIP
51
43
  framework_name_destination = @framework_name + FRAMEWORK_EXTENSION_NAME + "." + @framework_version + JSON_EXTENSION_ZIP
52
44
  json_path = @framework_name + JSON_EXTENSION_NAME
@@ -55,38 +47,63 @@ module CartBinaryUploader
55
47
  CartLogger.log_info "Framework Destination: #{framework_name_destination}"
56
48
  CartLogger.log_info "JSON Path: #{json_path}"
57
49
 
58
- unless !has_file_on_google_cloud framework_name_destination
59
- throw :the_version_file_already_exists, "The current version: #{@framework_version} already exists on google cloud"
60
- else
61
- CartLogger.log_info "File version #{@framework_version} not exists yet, starting generate file on google cloud"
62
- json_file = download_config_json_file(json_path)
63
-
64
- if json_file.nil?
65
- throw :could_not_download_json_file, "JSON With name: #{json_path}"
50
+ CartLogger.log_info "Verifying if the version file #{framework_name_destination} already exists"
51
+ unless file_on_storage_cloud framework_name_destination
52
+ CartLogger.log_info "File version #{@framework_version} not exists yet, starting generate file on cloud"
53
+
54
+ if file_on_storage_cloud(json_path)
55
+ @json_file = download_config_json_file(json_path)
56
+ if @json_file.nil?
57
+ throw :could_not_download_json_file, "JSON With name: #{json_path}"
58
+ end
59
+ else
60
+ CartLogger.log_warn "Creating empty json because it not exsits yet on cloud"
61
+ create_empty_json_file(json_path)
66
62
  end
67
63
 
68
- framework_file = bucket.create_file(framework_name_source, framework_name_destination)
69
- shared_url = framework_file.signed_url(method: 'GET', expires: 3.154e+8)
64
+ copy_local_file(framework_name_source, framework_name_destination)
65
+
66
+ shared_url = create_file(framework_name_destination)
70
67
 
71
68
  json_object = load_json_object json_path
72
69
  json_object[@framework_version] = shared_url
73
70
 
74
71
  save_json_object(json_path, json_object)
75
72
 
73
+ CartLogger.log_info 'Starting upload file to storage cloud'
76
74
  upload_json json_path
75
+ CartLogger.log_info 'Uploaded complete'
76
+ else
77
+ throw :the_version_file_already_exists, "The current version: #{@framework_version} already exists on cloud"
77
78
  end
78
79
  end
79
80
 
80
- def has_file_on_google_cloud file
81
- CartLogger.log_info "Verifying if the version file #{file} already exists"
82
- bucket_file = bucket.file file
83
- !bucket_file.nil?
81
+ def create_file(file_path)
82
+ throw :not_implemented, "The current method not implemented"
83
+ end
84
+
85
+ def create_public_url(file_path)
86
+ throw :not_implemented, "The current method not implemented"
87
+ end
88
+
89
+ def create_local_file(file_name)
90
+ throw :not_implemented, "The current method not implemented"
91
+ end
92
+
93
+ def file_on_storage_cloud(file)
94
+ throw :not_implemented, "The current method not implemented"
84
95
  end
85
96
 
86
97
  def download_config_json_file(from_file)
87
- json_file = @bucket.file from_file
88
- json_file.download from_file
89
- json_file
98
+ throw :not_implemented, "The current method not implemented"
99
+ end
100
+
101
+ def upload_json jsonPath
102
+ throw :not_implemented, "The current method not implemented"
103
+ end
104
+
105
+ def copy_local_file(framework_name_source, framework_name_destination)
106
+ FileUtils.copy_file(framework_name_source, framework_name_destination)
90
107
  end
91
108
 
92
109
  def load_json_object(json_path)
@@ -105,13 +122,9 @@ module CartBinaryUploader
105
122
  CartLogger.log_info 'JSON Saved'
106
123
  end
107
124
 
108
-
109
- def upload_json jsonPath
110
- CartLogger.log_info 'Starting upload file to google cloud'
111
- @bucket.create_file(jsonPath, jsonPath)
112
- CartLogger.log_info 'Uploaded complete'
125
+ def create_empty_json_file(file_name)
126
+ json_object = JSON.parse('{}')
127
+ save_json_object(file_name, json_object)
113
128
  end
114
-
115
129
  end
116
130
  end
117
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas Mendes
@@ -9,50 +9,56 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-03-19 00:00:00.000000000 Z
12
+ date: 2018-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: bundler
15
+ name: aws-sdk-s3
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.16'
20
+ version: '1.8'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.2
21
24
  type: :development
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
28
  - - "~>"
26
29
  - !ruby/object:Gem::Version
27
- version: '1.16'
30
+ version: '1.8'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.2
28
34
  - !ruby/object:Gem::Dependency
29
- name: rake
35
+ name: bundler
30
36
  requirement: !ruby/object:Gem::Requirement
31
37
  requirements:
32
38
  - - "~>"
33
39
  - !ruby/object:Gem::Version
34
- version: '10.0'
40
+ version: '1.16'
35
41
  type: :development
36
42
  prerelease: false
37
43
  version_requirements: !ruby/object:Gem::Requirement
38
44
  requirements:
39
45
  - - "~>"
40
46
  - !ruby/object:Gem::Version
41
- version: '10.0'
47
+ version: '1.16'
42
48
  - !ruby/object:Gem::Dependency
43
- name: minitest
49
+ name: colorize
44
50
  requirement: !ruby/object:Gem::Requirement
45
51
  requirements:
46
52
  - - "~>"
47
53
  - !ruby/object:Gem::Version
48
- version: '5.0'
54
+ version: 0.8.1
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
52
58
  requirements:
53
59
  - - "~>"
54
60
  - !ruby/object:Gem::Version
55
- version: '5.0'
61
+ version: 0.8.1
56
62
  - !ruby/object:Gem::Dependency
57
63
  name: google-cloud-storage
58
64
  requirement: !ruby/object:Gem::Requirement
@@ -82,19 +88,33 @@ dependencies:
82
88
  - !ruby/object:Gem::Version
83
89
  version: '2.1'
84
90
  - !ruby/object:Gem::Dependency
85
- name: colorize
91
+ name: minitest
86
92
  requirement: !ruby/object:Gem::Requirement
87
93
  requirements:
88
94
  - - "~>"
89
95
  - !ruby/object:Gem::Version
90
- version: 0.8.1
96
+ version: '5.0'
91
97
  type: :development
92
98
  prerelease: false
93
99
  version_requirements: !ruby/object:Gem::Requirement
94
100
  requirements:
95
101
  - - "~>"
96
102
  - !ruby/object:Gem::Version
97
- version: 0.8.1
103
+ version: '5.0'
104
+ - !ruby/object:Gem::Dependency
105
+ name: rake
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.0'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '10.0'
98
118
  description: " Cartup is the easyest way to share prebuilt Carthage frameworks
99
119
  between projects.\n"
100
120
  email:
@@ -123,8 +143,10 @@ files:
123
143
  - lib/cart_logger.rb
124
144
  - lib/cartup.rb
125
145
  - lib/cartup_command_helper.rb
126
- - lib/git_helper.rb
127
- - lib/google_cloud_storage.rb
146
+ - lib/git_tools/git_helper.rb
147
+ - lib/storage/google_cloud_storage.rb
148
+ - lib/storage/s3_cloud_storage.rb
149
+ - lib/storage/storage_type.rb
128
150
  - lib/template.yaml
129
151
  - logo/cartup_logo.png
130
152
  homepage: https://github.com/mendesbarreto/cartup.git