cocoapods-lazy 0.2.2 → 0.3.0
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/lib/cocoapods-lazy/dsl.rb +41 -12
- data/lib/cocoapods-lazy/logger.rb +15 -0
- data/lib/cocoapods-lazy/main.rb +14 -18
- data/lib/cocoapods-lazy/remote_storage.rb +10 -14
- data/lib/cocoapods-lazy/repository.rb +6 -8
- data/lib/cocoapods-lazy/version.rb +1 -1
- metadata +3 -4
- data/lib/cocoapods-lazy/credential.rb +0 -21
- data/lib/cocoapods-lazy/log.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65d3ec7903729f223055ef69069f95b9ca310c14
|
4
|
+
data.tar.gz: 1ef030dac21fdc14cddd566344a7aeaf693d3218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d0f16974e0e07e0475e65319bd467cd1aa54945d0b9fbe90cee55968a40ae4ecd5b691bf1456b0174b24c54b79758bcba7cb87da53c449698b7a4ca37f146a3
|
7
|
+
data.tar.gz: 485e3a01b3ebf6523f4bbe89a2d40ebb67810860297f231724bee71f88f90d59bbcdeae88d00a927cf309c8d32b2d7edda9ad186db7fd61cd17881c00371aa0c
|
data/lib/cocoapods-lazy/dsl.rb
CHANGED
@@ -1,16 +1,45 @@
|
|
1
1
|
require 'cocoapods'
|
2
|
-
require 'cocoapods-lazy/
|
2
|
+
require 'cocoapods-lazy/logger'
|
3
3
|
|
4
4
|
module Pod
|
5
5
|
class Podfile
|
6
6
|
module DSL
|
7
|
-
class
|
8
|
-
attr_accessor :login
|
9
|
-
attr_accessor :password
|
7
|
+
class Config
|
10
8
|
attr_accessor :base_url
|
11
9
|
|
12
|
-
def
|
13
|
-
|
10
|
+
def validate
|
11
|
+
raise 'Write base_url for continue' if base_url == nil
|
12
|
+
end
|
13
|
+
|
14
|
+
def login
|
15
|
+
return @login unless @login.nil?
|
16
|
+
Logger.important_i "Write login from #{@base_url}"
|
17
|
+
Logger.important "Write login from #{@base_url}"
|
18
|
+
@login = $stdin.gets
|
19
|
+
return @login
|
20
|
+
end
|
21
|
+
|
22
|
+
def login=(login)
|
23
|
+
@login = Shellwords.escape(login) unless login.blank?
|
24
|
+
end
|
25
|
+
|
26
|
+
def password
|
27
|
+
return @password unless @password.nil?
|
28
|
+
Logger.important_i "Write password from #{@base_url}"
|
29
|
+
Logger.important "Write password from #{@base_url}"
|
30
|
+
@password = Shellwords.escape $stdin.gets.chomp
|
31
|
+
return @password
|
32
|
+
end
|
33
|
+
|
34
|
+
def password=(password)
|
35
|
+
@password = Shellwords.escape(password) unless password.blank?
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_s
|
39
|
+
descriptor = ""
|
40
|
+
descriptor += "login = #{@login}\n" unless @login.nil?
|
41
|
+
descriptor += "password = *****\n" unless @password.nil?
|
42
|
+
descriptor += "base_url = #{@base_url}"
|
14
43
|
end
|
15
44
|
end
|
16
45
|
end
|
@@ -20,13 +49,13 @@ end
|
|
20
49
|
module Pod
|
21
50
|
class Podfile
|
22
51
|
module DSL
|
23
|
-
class_attr_accessor :
|
52
|
+
class_attr_accessor :config
|
24
53
|
|
25
|
-
def
|
26
|
-
|
27
|
-
block.call(
|
28
|
-
|
29
|
-
DSL.
|
54
|
+
def cocoapods_lazy(&block)
|
55
|
+
config = Config.new()
|
56
|
+
block.call(config)
|
57
|
+
config.validate
|
58
|
+
DSL.config = config
|
30
59
|
end
|
31
60
|
end
|
32
61
|
end
|
data/lib/cocoapods-lazy/main.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'cocoapods'
|
2
|
+
require 'cocoapods-core/podfile'
|
2
3
|
require 'cocoapods-lazy/version'
|
3
|
-
require 'cocoapods-lazy/
|
4
|
+
require 'cocoapods-lazy/logger'
|
4
5
|
require 'cocoapods-lazy/repository'
|
5
6
|
require 'cocoapods-lazy/remote_storage'
|
6
7
|
require 'cocoapods-lazy/dsl'
|
7
|
-
require 'cocoapods-core/podfile'
|
8
8
|
|
9
9
|
module Pod
|
10
10
|
module Lazy
|
@@ -15,32 +15,28 @@ module Pod
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
18
|
-
|
19
|
-
|
20
|
-
unless
|
21
|
-
|
22
|
-
|
23
|
-
remote_storage = Pod::Lazy::RemoteStorage.new(
|
18
|
+
Logger.info "Redirection to cocoapods-lazy"
|
19
|
+
lazy_config = load_credential()
|
20
|
+
unless lazy_config.nil?
|
21
|
+
Logger.info "cocoapods-lazy is enabled in Podfile"
|
22
|
+
Logger.info "Lazy config:\n#{lazy_config}"
|
23
|
+
remote_storage = Pod::Lazy::RemoteStorage.new(lazy_config)
|
24
24
|
repository = Pod::Lazy::Repository.new(remote_storage)
|
25
25
|
repository.fetch() if @should_fetch
|
26
|
-
|
26
|
+
Logger.info "Run origin command"
|
27
27
|
super
|
28
28
|
if repository.should_store && @should_store
|
29
|
-
|
29
|
+
Logger.info "Storing..."
|
30
30
|
repository.store()
|
31
31
|
end
|
32
|
-
|
32
|
+
Logger.info "Flow cocoapods-lazy if finished"
|
33
33
|
else
|
34
|
-
|
35
|
-
|
34
|
+
Logger.info "cocoapods-lazy is not enabled in Podfile"
|
35
|
+
Logger.info "Run origin command"
|
36
36
|
super
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def puts(value)
|
41
|
-
Pod::Lazy::Log.puts(value)
|
42
|
-
end
|
43
|
-
|
44
40
|
def options
|
45
41
|
[
|
46
42
|
['--no-fetch', 'Skip fetch action'],
|
@@ -53,7 +49,7 @@ module Pod
|
|
53
49
|
def load_credential
|
54
50
|
path = Pathname.new('Podfile')
|
55
51
|
Podfile.from_file(path)
|
56
|
-
Pod::Podfile::DSL.
|
52
|
+
Pod::Podfile::DSL.config
|
57
53
|
end
|
58
54
|
end
|
59
55
|
end
|
@@ -1,20 +1,16 @@
|
|
1
|
-
require 'cocoapods-lazy/
|
1
|
+
require 'cocoapods-lazy/logger'
|
2
2
|
|
3
3
|
module Pod
|
4
4
|
module Lazy
|
5
5
|
class RemoteStorage
|
6
|
-
|
7
|
-
|
8
|
-
def initialize(credential)
|
9
|
-
@login = credential.login
|
10
|
-
@password = credential.password
|
11
|
-
@base_url = credential.base_url
|
6
|
+
def initialize(config)
|
7
|
+
@config = config
|
12
8
|
end
|
13
9
|
|
14
10
|
def fetch(name:)
|
15
11
|
zip_name = "#{name}.zip"
|
16
|
-
url = @base_url + zip_name
|
17
|
-
|
12
|
+
url = @config.base_url + zip_name
|
13
|
+
`curl --fail #{url} --output #{zip_name}`
|
18
14
|
`unzip #{zip_name}`
|
19
15
|
`rm -rf #{zip_name}`
|
20
16
|
end
|
@@ -22,13 +18,13 @@ module Pod
|
|
22
18
|
def store(name:)
|
23
19
|
zip_name = "#{name}.zip"
|
24
20
|
unless File.exist?(zip_name)
|
25
|
-
|
21
|
+
Logger.info "Make zip: #{zip_name}"
|
26
22
|
`zip -9 -r -y #{zip_name} Pods`
|
27
23
|
end
|
28
|
-
url = @base_url + zip_name
|
29
|
-
|
30
|
-
`curl --fail -
|
31
|
-
|
24
|
+
url = @config.base_url + zip_name
|
25
|
+
Logger.info "Storing to #{url}"
|
26
|
+
`curl --fail -u #{@config.login}:#{@config.password} --upload-file #{zip_name} #{url}`
|
27
|
+
Logger.info "Remove #{zip_name}"
|
32
28
|
`rm -rf #{zip_name}`
|
33
29
|
end
|
34
30
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
require 'cocoapods-core'
|
2
2
|
require 'fileutils'
|
3
|
-
require 'cocoapods-lazy/
|
3
|
+
require 'cocoapods-lazy/logger'
|
4
4
|
|
5
5
|
module Pod
|
6
6
|
module Lazy
|
7
7
|
class Repository
|
8
|
-
include Pod::Lazy::Log
|
9
|
-
|
10
8
|
def initialize(repository)
|
11
9
|
@repository = repository
|
12
10
|
end
|
@@ -14,16 +12,16 @@ module Pod
|
|
14
12
|
def fetch
|
15
13
|
@fetched_checksum = read_podfile_checksum()
|
16
14
|
if @fetched_checksum.nil?
|
17
|
-
|
15
|
+
Logger.info "Podfile.lock not found"
|
18
16
|
@is_generated_pods = true
|
19
17
|
elsif @fetched_checksum != read_manifest_checksum()
|
20
|
-
|
21
|
-
|
18
|
+
Logger.info 'Checksum IS NOT EQUAL'
|
19
|
+
Logger.info 'Drop Pods directory'
|
22
20
|
`rm -rf Pods`
|
23
21
|
@repository.fetch(name: @fetched_checksum)
|
24
22
|
@is_generated_pods = !Dir.exist?('Pods')
|
25
23
|
else
|
26
|
-
|
24
|
+
Logger.info 'Checksum IS EQUAL'
|
27
25
|
@is_generated_pods = false
|
28
26
|
end
|
29
27
|
end
|
@@ -33,7 +31,7 @@ module Pod
|
|
33
31
|
end
|
34
32
|
|
35
33
|
def store
|
36
|
-
|
34
|
+
Logger.info "Reason for store: #{store_reason || 'Not reason for store'}"
|
37
35
|
@repository.store(name: read_podfile_checksum())
|
38
36
|
end
|
39
37
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-lazy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Mylnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -59,9 +59,8 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- lib/cocoapods-lazy/credential.rb
|
63
62
|
- lib/cocoapods-lazy/dsl.rb
|
64
|
-
- lib/cocoapods-lazy/
|
63
|
+
- lib/cocoapods-lazy/logger.rb
|
65
64
|
- lib/cocoapods-lazy/main.rb
|
66
65
|
- lib/cocoapods-lazy/remote_storage.rb
|
67
66
|
- lib/cocoapods-lazy/repository.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'shellwords'
|
2
|
-
|
3
|
-
module Pod
|
4
|
-
module Lazy
|
5
|
-
class Credential
|
6
|
-
attr_reader :login
|
7
|
-
attr_reader :password
|
8
|
-
attr_reader :base_url
|
9
|
-
|
10
|
-
def initialize(login, password, base_url)
|
11
|
-
@login = Shellwords.escape(login)
|
12
|
-
@password = Shellwords.escape(password)
|
13
|
-
@base_url = Shellwords.escape(base_url)
|
14
|
-
end
|
15
|
-
|
16
|
-
def to_s
|
17
|
-
"login = #{@login} \npassword = #{@password} \nbase_url = #{@base_url}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|