cartup 0.1.5 → 0.1.6
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 +4 -4
- data/CartBinaryUploader.gemspec +2 -5
- data/Gemfile.lock +2 -0
- data/README.md +6 -5
- data/exe/cartup +2 -15
- data/lib/CartBinaryUploader/version.rb +1 -1
- data/lib/cart_logger.rb +27 -0
- data/lib/cartup.rb +5 -3
- data/lib/cartup_command_helper.rb +39 -0
- data/lib/git_helper.rb +7 -6
- data/lib/google_cloud_storage.rb +16 -15
- metadata +19 -7
- data/lib/cart_log.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0681a68c6ced794ebdf7b0edcb19da121c51c2ae'
|
4
|
+
data.tar.gz: 96cde9a5da7c6fcdbb46abd2654eab7cba3374d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f18486ac90fa1228b54f7466c9c1823a83dc843ed3f8a340543db4cd906aa1bf05881ba8e90ddb664b96e15bfc47c7b3f04c049a4541392d522b980355a601c
|
7
|
+
data.tar.gz: 49cd0c3d5a7d9844905013e9c3048d32dc13034b4a71d2b08fa4dc084fd498b29489e3aa950613c0f2dd04cda9b48b9eb4ee134608fde22f7256617621b8d867
|
data/CartBinaryUploader.gemspec
CHANGED
@@ -8,13 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = CartBinaryUploader::VERSION
|
9
9
|
spec.authors = ["Douglas Mendes", "Rafael Ferreria"]
|
10
10
|
spec.email = ["mendes-barreto@live.com", "rafael.yami@hotmail.com"]
|
11
|
-
|
12
11
|
spec.summary = %q{ This gem will help you to upload the carthage binaries a privates accounts like google cloud, s3 e etc. }
|
13
12
|
spec.description = <<-EOF
|
14
|
-
Cartup is the easyest way to share prebuilts Carthage frameworks between
|
15
|
-
|
16
|
-
One big thanks for my friend and brother [Rafael Ferreira](https://github.com/RafaelPlantard) that make the initials
|
17
|
-
scripts(Shell and Ruby) and that's give me Ideia to bring it to a ruby class struct and RubyGem to distribute to every body!
|
13
|
+
Cartup is the easyest way to share prebuilts Carthage frameworks between projects.
|
18
14
|
EOF
|
19
15
|
|
20
16
|
spec.homepage = "https://github.com/mendesbarreto/cartup.git"
|
@@ -41,4 +37,5 @@ Gem::Specification.new do |spec|
|
|
41
37
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
42
38
|
spec.add_development_dependency 'google-cloud-storage', '~> 1.9'
|
43
39
|
spec.add_development_dependency 'json', '~> 2.1'
|
40
|
+
spec.add_development_dependency 'colorize', '~> 0.8.1'
|
44
41
|
end
|
data/Gemfile.lock
CHANGED
@@ -8,6 +8,7 @@ GEM
|
|
8
8
|
specs:
|
9
9
|
addressable (2.5.2)
|
10
10
|
public_suffix (>= 2.0.2, < 4.0)
|
11
|
+
colorize (0.8.1)
|
11
12
|
declarative (0.0.10)
|
12
13
|
declarative-option (0.1.0)
|
13
14
|
digest-crc (0.4.1)
|
@@ -72,6 +73,7 @@ PLATFORMS
|
|
72
73
|
DEPENDENCIES
|
73
74
|
bundler (~> 1.16)
|
74
75
|
cartup!
|
76
|
+
colorize (~> 0.8.1)
|
75
77
|
google-cloud-storage (~> 1.9)
|
76
78
|
json (~> 2.1)
|
77
79
|
minitest (~> 5.0)
|
data/README.md
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# Cartup
|
2
2
|
|
3
3
|
|
4
|
-
**Cartup** is the easyest way to share prebuilts [Carthage](https://github.com/Carthage/Carthage) frameworks between
|
4
|
+
**Cartup** is the easyest way to share prebuilts [Carthage](https://github.com/Carthage/Carthage) frameworks between projects.
|
5
5
|
|
6
|
-
The main propose of this gem is uploading the [Carthage](https://github.com/Carthage/Carthage) prebuilts to a cloud
|
7
|
-
storage like
|
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
8
|
the [link about how to do it](https://github.com/Carthage/Carthage#archive-prebuilt-frameworks-into-one-zip-file)
|
9
9
|
|
10
|
-
|
10
|
+
|
11
|
+
Currently, the main reason is because only github projects could upload a prebuilts frameworks and distrubuite
|
11
12
|
them using a great github tool called ["RELEASES"](https://help.github.com/articles/creating-releases/) automatically.
|
12
|
-
To people like me who
|
13
|
+
To people like me who works using Bitbucket (not because of my choice) the all process should be done manually. So you should
|
13
14
|
upload the prebuilts frameworks on some sort of cloud storage and manage the version using a JSON file and upload
|
14
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,
|
15
16
|
this is for you!!!
|
data/exe/cartup
CHANGED
@@ -8,18 +8,5 @@ COMMAND_HELP = "help"
|
|
8
8
|
|
9
9
|
command = ARGV[0]
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
- init Create an empty cart_uploader.yaml
|
14
|
-
- run uploading the Carthage prebuilts to a cloud storage
|
15
|
-
- help show help instructions and list available subcommands
|
16
|
-
EOF
|
17
|
-
|
18
|
-
if command == COMMAND_RUN
|
19
|
-
CartBinaryUploader.run
|
20
|
-
elsif command == COMMAND_INIT
|
21
|
-
CartBinaryUploader.init
|
22
|
-
else
|
23
|
-
puts helpDescription
|
24
|
-
end
|
25
|
-
|
11
|
+
commandHelper = CartBinaryUploader::CartupCommandHelper.new
|
12
|
+
commandHelper.handle command
|
data/lib/cart_logger.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'colorize'
|
3
|
+
require 'colorized_string'
|
4
|
+
|
5
|
+
module CartBinaryUploader
|
6
|
+
class CartLogger
|
7
|
+
class << self
|
8
|
+
def log
|
9
|
+
if @logger.nil?
|
10
|
+
@logger = Logger.new STDOUT
|
11
|
+
@logger.level = Logger::DEBUG
|
12
|
+
@logger.datetime_format = '%Y-%m-%d %H:%M:%S '
|
13
|
+
end
|
14
|
+
@logger
|
15
|
+
end
|
16
|
+
|
17
|
+
def logInfo string
|
18
|
+
CartLogger.log.info string
|
19
|
+
end
|
20
|
+
|
21
|
+
def logError string
|
22
|
+
CartLogger.log.error string.to_s.colorize(:color => :white, :background => :red)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/cartup.rb
CHANGED
@@ -5,6 +5,8 @@ require 'json'
|
|
5
5
|
require 'ostruct'
|
6
6
|
require 'google_cloud_storage'
|
7
7
|
require 'git_helper'
|
8
|
+
require 'cartup_command_helper'
|
9
|
+
require 'cart_logger'
|
8
10
|
|
9
11
|
module CartBinaryUploader
|
10
12
|
def self.run
|
@@ -45,14 +47,14 @@ module CartBinaryUploader
|
|
45
47
|
|
46
48
|
def self.getConfig
|
47
49
|
begin
|
48
|
-
|
50
|
+
CartLogger.logInfo "Creating project config"
|
49
51
|
path = FileUtils.pwd + '/cart_uploader.yaml'
|
50
52
|
yamlFile = YAML.load_file(path)
|
51
53
|
object = JSON.parse(yamlFile.to_json, object_class: OpenStruct)
|
52
|
-
|
54
|
+
CartLogger.logInfo "project config Created"
|
53
55
|
object
|
54
56
|
rescue SystemCallError
|
55
|
-
|
57
|
+
CartLogger.logError "Problem to find or pase yaml file"
|
56
58
|
exit
|
57
59
|
end
|
58
60
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "cartup"
|
2
|
+
|
3
|
+
module CartBinaryUploader
|
4
|
+
class CartupCommandHelper
|
5
|
+
COMMAND_RUN = "run"
|
6
|
+
COMMAND_INIT = "init"
|
7
|
+
COMMAND_HELP = "help"
|
8
|
+
|
9
|
+
attr_reader :helpDescription
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@helpDescription = <<-EOF
|
13
|
+
These are common Cartup commands used in some situations:
|
14
|
+
- init Create an empty cart_uploader.yaml
|
15
|
+
- run uploading the Carthage prebuilts to a cloud storage
|
16
|
+
- help show help instructions and list available subcommands
|
17
|
+
EOF
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def handle(command)
|
22
|
+
case command
|
23
|
+
when COMMAND_RUN
|
24
|
+
CartBinaryUploader.run
|
25
|
+
when COMMAND_INIT
|
26
|
+
CartBinaryUploader.init
|
27
|
+
when COMMAND_HELP
|
28
|
+
printHelper
|
29
|
+
else
|
30
|
+
printHelper
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def printHelper
|
35
|
+
puts @helpDescription
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
data/lib/git_helper.rb
CHANGED
@@ -1,25 +1,26 @@
|
|
1
|
+
require 'cart_logger'
|
1
2
|
|
2
3
|
class GitHelper
|
3
4
|
|
4
5
|
def tagTo version
|
5
|
-
|
6
|
+
CartLogger.logInfo "Tagging version to: " + version
|
6
7
|
begin
|
7
8
|
cmd = "git tag -f " + version
|
8
9
|
exec( cmd )
|
9
|
-
|
10
|
+
CartLogger.logInfo "Version tagged"
|
10
11
|
rescue
|
11
|
-
|
12
|
+
CartLogger.logError "Problem to generate tag on git"
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
16
|
def push
|
16
|
-
|
17
|
+
CartLogger.logInfo "Pushing tag to Git "
|
17
18
|
begin
|
18
19
|
cmd = "git push --tags"
|
19
20
|
exec( cmd )
|
20
|
-
|
21
|
+
CartLogger.logInfo "Tag pushed"
|
21
22
|
rescue
|
22
|
-
|
23
|
+
CartLogger.logError "Problem to push tag on git"
|
23
24
|
end
|
24
25
|
|
25
26
|
end
|
data/lib/google_cloud_storage.rb
CHANGED
@@ -2,6 +2,7 @@ require 'google/cloud/storage'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'yaml'
|
4
4
|
require 'json'
|
5
|
+
require 'cart_logger'
|
5
6
|
|
6
7
|
module CartBinaryUploader
|
7
8
|
class GoogleCloudStorage
|
@@ -30,7 +31,7 @@ module CartBinaryUploader
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def createStorage
|
33
|
-
|
34
|
+
CartLogger.logInfo "Creating google storage with id: " + @projectId + "credenciasPath: " + @credentialsFilePath
|
34
35
|
@storage = Google::Cloud::Storage.new(
|
35
36
|
project_id: @projectId,
|
36
37
|
credentials: @credentialsFilePath
|
@@ -38,24 +39,24 @@ module CartBinaryUploader
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def createBucket
|
41
|
-
|
42
|
+
CartLogger.logInfo "Creating bucket name: " + @bucketName
|
42
43
|
@bucket = @storage.bucket @bucketName
|
43
44
|
end
|
44
45
|
|
45
46
|
def uploadFrameWork
|
46
|
-
|
47
|
+
CartLogger.logInfo "Prepering to upload file to google cloud"
|
47
48
|
frameworkNameSource = @frameworkName + FRAMEWORK_EXTENSION_NAME + JSON_EXTENSION_ZIP
|
48
49
|
frameworkNameDestination = @frameworkName + FRAMEWORK_EXTENSION_NAME + "." + @frameworkVersion + JSON_EXTENSION_ZIP
|
49
50
|
jsonPath = @frameworkName + JSON_EXTENSION_NAME
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
CartLogger.logInfo "Framework Source: " + frameworkNameSource
|
53
|
+
CartLogger.logInfo "Framework Destination: " + frameworkNameDestination
|
54
|
+
CartLogger.logInfo "JSON Path: " + jsonPath
|
54
55
|
|
55
56
|
unless !hasFileOnGoogleCloud frameworkNameDestination
|
56
57
|
throw :the_version_file_already_exists, "The current version: " + @frameworkVersion + " already exists on google cloud"
|
57
58
|
else
|
58
|
-
|
59
|
+
CartLogger.logInfo "File version "+ @frameworkVersion +" not exists yet, starting generate file on google cloud"
|
59
60
|
jsonFile = downloadZConfigJsonFile(jsonPath)
|
60
61
|
|
61
62
|
if jsonFile.nil?
|
@@ -75,7 +76,7 @@ module CartBinaryUploader
|
|
75
76
|
end
|
76
77
|
|
77
78
|
def hasFileOnGoogleCloud file
|
78
|
-
|
79
|
+
CartLogger.logInfo "Verifying if the version file "+ file +" already exists"
|
79
80
|
bucketFile = bucket.file file
|
80
81
|
!bucketFile.nil?
|
81
82
|
end
|
@@ -88,26 +89,26 @@ module CartBinaryUploader
|
|
88
89
|
end
|
89
90
|
|
90
91
|
def loadJSONObject jsonPath
|
91
|
-
|
92
|
+
CartLogger.logInfo "Loading JSON file"
|
92
93
|
json = File.read(jsonPath)
|
93
94
|
object = JSON.parse(json)
|
94
|
-
|
95
|
-
|
95
|
+
CartLogger.logInfo object
|
96
|
+
CartLogger.logInfo "JSON Loaded"
|
96
97
|
object
|
97
98
|
end
|
98
99
|
|
99
100
|
def saveJSONObject(jsonPath, jsonObject)
|
100
101
|
binaryJson = JSON.pretty_generate(jsonObject)
|
101
|
-
|
102
|
+
CartLogger.logInfo "Saving JSON Object in: " + jsonPath + "JSON: " + binaryJson
|
102
103
|
File.write(jsonPath, binaryJson)
|
103
|
-
|
104
|
+
CartLogger.logInfo "JSON Saved"
|
104
105
|
end
|
105
106
|
|
106
107
|
|
107
108
|
def uploadJson jsonPath
|
108
|
-
|
109
|
+
CartLogger.logInfo "Starting upload file to google cloud"
|
109
110
|
@bucket.create_file(jsonPath, jsonPath)
|
110
|
-
|
111
|
+
CartLogger.logInfo "Uploaded complete"
|
111
112
|
end
|
112
113
|
|
113
114
|
end
|
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.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Mendes
|
@@ -81,11 +81,22 @@ dependencies:
|
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '2.1'
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: colorize
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.8.1
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.8.1
|
98
|
+
description: " Cartup is the easyest way to share prebuilts Carthage frameworks
|
99
|
+
between projects.\n"
|
89
100
|
email:
|
90
101
|
- mendes-barreto@live.com
|
91
102
|
- rafael.yami@hotmail.com
|
@@ -107,8 +118,9 @@ files:
|
|
107
118
|
- bin/setup
|
108
119
|
- exe/cartup
|
109
120
|
- lib/CartBinaryUploader/version.rb
|
110
|
-
- lib/
|
121
|
+
- lib/cart_logger.rb
|
111
122
|
- lib/cartup.rb
|
123
|
+
- lib/cartup_command_helper.rb
|
112
124
|
- lib/git_helper.rb
|
113
125
|
- lib/google_cloud_storage.rb
|
114
126
|
- lib/template.yaml
|
data/lib/cart_log.rb
DELETED
@@ -1,16 +0,0 @@
|
|
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
|