cocoapods-deploy 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c23d54030ecebab13e1ec38cae80f4add6a64eaa
4
+ data.tar.gz: 920f22ca0fa597562b0b9176c24e606c90104779
5
+ SHA512:
6
+ metadata.gz: 549fb34d522b5aea5c539c99bc0026787d646f2cff3fed9b37feca547eb7bc5b1e621ce46e7636ae26900d8a0fdd36c972967e5eeaf6a0451eea1ee4f7254d12
7
+ data.tar.gz: 100a19f4da5b7d3873bb85d2247939cbd17e35fbe7f093885cc88f01daaa06602926b7f2054d0758879a2c5f45bd1603feb91077e7b479fa329024f319b974ae
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-deployment.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'cocoapods'
8
+
9
+ gem 'mocha'
10
+ gem 'bacon'
11
+ gem 'mocha-on-bacon'
12
+ gem 'prettybacon'
13
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 James Campbell <james@supmenow.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # cocoapods-deploy
2
+
3
+ CocoaPods Deploy is a plugin which tries to mimic the behaviour of bundlers `--deployment` mode.
4
+
5
+ The goal is to download and install the specific dependency versions from the `Podfile.lock` without having to pull down the full CocoaPods specs repo.
6
+
7
+
8
+ ## Installation
9
+
10
+ $ gem install cocoapods-deploy
11
+
12
+ ## Usage
13
+
14
+ $ pod deploy
15
+
16
+ This will look at the dependencies in your `Podfile.lock` and will install them up to 85% faster than `pod install`. If you don't have a `Podfile.lock` then you will still need to run `pod install` and `pod update` first.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :specs do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task :default => :specs
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # stub: cocoapods-deploy 0.0.1 ruby lib
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "cocoapods-deploy"
6
+ s.version = "0.0.1"
7
+
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib"]
10
+ s.authors = ["James Campbell"]
11
+ s.date = "2016-03-07"
12
+ s.description = "Implement's bundler's --deployment functionality in CocoaPods."
13
+ s.email = ["james@supmenow.com"]
14
+ s.files = [".gitignore", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "cocoapods-deploy.gemspec", "lib/cocoapods-deploy/command.rb", "lib/cocoapods-deploy/command/deploy.rb", "lib/cocoapods-deploy/dependency.rb", "lib/cocoapods-deploy/deploy_analyzer.rb", "lib/cocoapods-deploy/deploy_installer.rb", "lib/cocoapods-deploy/gem_version.rb", "lib/cocoapods-deploy.rb", "lib/cocoapods_plugin.rb", "spec/spec_helper.rb"]
15
+ s.homepage = "https://github.com/jcampbell05/cocoapods-deploy"
16
+ s.licenses = ["MIT"]
17
+ s.rubygems_version = "2.4.8"
18
+ s.summary = "Implement's bundler's --deployment functionality in CocoaPods."
19
+ s.test_files = ["spec/command/deploy_spec.rb", "spec/spec_helper.rb"]
20
+
21
+ if s.respond_to? :specification_version then
22
+ s.specification_version = 4
23
+
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ s.add_development_dependency(%q<bundler>, ["~> 1.3"])
26
+ s.add_development_dependency(%q<rake>, [">= 0"])
27
+ else
28
+ s.add_dependency(%q<bundler>, ["~> 1.3"])
29
+ s.add_dependency(%q<rake>, [">= 0"])
30
+ end
31
+ else
32
+ s.add_dependency(%q<bundler>, ["~> 1.3"])
33
+ s.add_dependency(%q<rake>, [">= 0"])
34
+ end
35
+ end
@@ -0,0 +1,164 @@
1
+ def podspec_url(pod, version)
2
+ "https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/#{pod}/#{version}/#{pod}.podspec.json"
3
+ end
4
+
5
+ module Pod
6
+ class Command
7
+
8
+ #Hack to help transform target dependencies
9
+ class DeployTransformer
10
+
11
+ def self.lockfile=(lockfile)
12
+ @@lockfile = lockfile
13
+ end
14
+
15
+ #TODO: Remove Workaround resolver trying to pull down invalid pods
16
+ def self.in_lockfile(dep)
17
+ puts dep
18
+ @@lockfile.pod_names.include? dep.root_name
19
+ end
20
+
21
+ #TODO: Remove lockfile modifications
22
+ def self.transform_dependency_to_sandbox_podspec(dep)
23
+ unless dep.external_source
24
+ version = @@lockfile.version(dep)
25
+ checkout = { :podspec => podspec_url(dep.root_name, version) }
26
+ dep.external_source = checkout
27
+ dep.specific_version = nil
28
+ dep.requirement = Requirement.create(checkout)
29
+ end
30
+
31
+ dep
32
+ end
33
+ end
34
+
35
+ class Deploy < Command
36
+
37
+ include Project
38
+
39
+ self.summary = 'Install project dependencies to Podfile.lock versions without pulling down full podspec repo.'
40
+
41
+ self.description = <<-DESC
42
+ Install project dependencies to Podfile.lock versions without pulling down full podspec repo.
43
+ DESC
44
+
45
+ #TODO: Remove Hack to transform podfile dependencies to podspec ones - we should find
46
+ #a way of removing some of these
47
+ def apply_dependency_patches
48
+
49
+ DeployTransformer.lockfile = config.lockfile
50
+
51
+ Specification.class_eval do
52
+
53
+ alias_method :original_all_dependencies, :all_dependencies
54
+
55
+ def all_dependencies(platform = nil)
56
+ deps = original_all_dependencies(platform = nil).select do |dep|
57
+ DeployTransformer.in_lockfile(dep)
58
+ end
59
+
60
+ deps.map do |dep|
61
+
62
+ unless dep.external_source
63
+ DeployTransformer.transform_dependency_to_sandbox_podspec(dep)
64
+ else
65
+ dep
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ Resolver.class_eval do
72
+
73
+ alias_method :original_locked_dependencies, :locked_dependencies
74
+
75
+ def dependencies
76
+ original_locked_dependencies.map do |dep|
77
+
78
+ unless dep.external_source
79
+ DeployTransformer.transform_dependency_to_sandbox_podspec(dep)
80
+ else
81
+ dep
82
+ end
83
+ end
84
+ end
85
+ end
86
+
87
+ Podfile::TargetDefinition.class_eval do
88
+
89
+ alias_method :original_dependencies, :dependencies
90
+
91
+ def dependencies
92
+ original_dependencies.map do |dep|
93
+
94
+ unless dep.external_source
95
+ DeployTransformer.transform_dependency_to_sandbox_podspec(dep)
96
+ else
97
+ dep
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+
104
+ def transform_dependency_and_version_to_remote_podspec(dep, version)
105
+ unless dep.external_source
106
+ checkout = { :podspec => podspec_url(dep.root_name, version) }
107
+ dep.external_source = checkout
108
+ dep.specific_version = nil
109
+ dep.requirement = Requirement.create(checkout)
110
+ end
111
+
112
+ dep
113
+ end
114
+
115
+ def dependency_for_pod_and_version(pod, version)
116
+ dep = config.lockfile.dependencies.detect { |d| d.root_name == pod }
117
+
118
+ unless dep
119
+ dep = Dependency.new(pod, version)
120
+ end
121
+
122
+ dep
123
+ end
124
+
125
+ def download_dependency(dep)
126
+ source = ExternalSources.from_dependency(dep, config.podfile.defined_in_file)
127
+ source.fetch(config.sandbox)
128
+ end
129
+
130
+ def transform_pod_and_version(pod, version)
131
+ dep = dependency_for_pod_and_version(pod, version)
132
+ transform_dependency_and_version_to_remote_podspec(dep, version)
133
+ download_dependency(dep)
134
+ end
135
+
136
+ def run
137
+ verify_podfile_exists!
138
+ verify_lockfile_exists!
139
+
140
+ UI.puts("- Deploying Pods")
141
+
142
+ config.lockfile.pod_names.each do |pod|
143
+ version = config.lockfile.version(pod)
144
+ UI.puts("- Deploying #{pod} #{version}")
145
+ transform_pod_and_version(pod, version)
146
+ end
147
+
148
+ run_install_with_update(false)
149
+ end
150
+
151
+ def run_install_with_update(update)
152
+ #Force this to be true so it is always skipped
153
+ config.skip_repo_update = true
154
+
155
+ #TODO: Work out way of transforming dependencies without patch
156
+ apply_dependency_patches
157
+
158
+ installer = DeployInstaller.new(config.sandbox, config.podfile, config.lockfile)
159
+ installer.update = update
160
+ installer.install!
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-deploy/command/deploy'
@@ -0,0 +1,11 @@
1
+ module Pod
2
+ class Dependency
3
+ def requirement=(requirement)
4
+ @requirement = requirement
5
+ end
6
+
7
+ def external_source=(external_source)
8
+ @external_source = external_source
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Pod
2
+ class DeployAnalyzer < Installer::Analyzer
3
+ def sources
4
+ []
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ module Pod
2
+ class DeployInstaller < Installer
3
+ def create_analyzer
4
+ DeployAnalyzer.new(sandbox, podfile, lockfile).tap do |analyzer|
5
+ analyzer.allow_pre_downloads = false
6
+ end
7
+ end
8
+
9
+ def write_lockfiles
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsDeploy
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-deployment/gem_version'
@@ -0,0 +1,4 @@
1
+ require 'cocoapods-deploy/dependency'
2
+ require 'cocoapods-deploy/deploy_analyzer'
3
+ require 'cocoapods-deploy/deploy_installer'
4
+ require 'cocoapods-deploy/command'
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Deploy do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ deploy }).should.be.instance_of Command::Deploy
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,50 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $:.unshift((ROOT + 'lib').to_s)
4
+ $:.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'bacon'
8
+ require 'mocha-on-bacon'
9
+ require 'pretty_bacon'
10
+ require 'pathname'
11
+ require 'cocoapods'
12
+
13
+ Mocha::Configuration.prevent(:stubbing_non_existent_method)
14
+
15
+ require 'cocoapods_plugin'
16
+
17
+ #-----------------------------------------------------------------------------#
18
+
19
+ module Pod
20
+
21
+ # Disable the wrapping so the output is deterministic in the tests.
22
+ #
23
+ UI.disable_wrap = true
24
+
25
+ # Redirects the messages to an internal store.
26
+ #
27
+ module UI
28
+ @output = ''
29
+ @warnings = ''
30
+
31
+ class << self
32
+ attr_accessor :output
33
+ attr_accessor :warnings
34
+
35
+ def puts(message = '')
36
+ @output << "#{message}\n"
37
+ end
38
+
39
+ def warn(message = '', actions = [])
40
+ @warnings << "#{message}\n"
41
+ end
42
+
43
+ def print(message)
44
+ @output << message
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ #-----------------------------------------------------------------------------#
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-deploy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - James Campbell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Implement's bundler's --deployment functionality in CocoaPods.
42
+ email:
43
+ - james@supmenow.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - cocoapods-deploy.gemspec
54
+ - lib/cocoapods-deploy.rb
55
+ - lib/cocoapods-deploy/command.rb
56
+ - lib/cocoapods-deploy/command/deploy.rb
57
+ - lib/cocoapods-deploy/dependency.rb
58
+ - lib/cocoapods-deploy/deploy_analyzer.rb
59
+ - lib/cocoapods-deploy/deploy_installer.rb
60
+ - lib/cocoapods-deploy/gem_version.rb
61
+ - lib/cocoapods_plugin.rb
62
+ - spec/command/deploy_spec.rb
63
+ - spec/spec_helper.rb
64
+ homepage: https://github.com/jcampbell05/cocoapods-deploy
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.4.8
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Implement's bundler's --deployment functionality in CocoaPods.
88
+ test_files:
89
+ - spec/command/deploy_spec.rb
90
+ - spec/spec_helper.rb