cocoapods-develop 0.0.1

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: 9814b570a45440ba76acac5e8904042b89f59512
4
+ data.tar.gz: 4726269982f71a0db22bfa4ff352ba1421181968
5
+ SHA512:
6
+ metadata.gz: b9854e8066caf402c05fa46843f2ad574251aaf380d0925ebf324450ad2e6e7007881fcf7b55fc71823e8d5300de217b0dfcd5c196c9aad3e6eb126ac66b1ac5
7
+ data.tar.gz: f22c321670e0318b5e3de9a664893df40206c819e6b5b4b053f3df1efc109bbfc20f86a5b7dc0a22a68661abd70bab797f188aa7ed1a61755c44cbea9c6674a6
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .DS_Store
3
+ pkg
4
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'cocoapods', '>= 1.0.0'
7
+ gem 'bacon'
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Jed Lewison
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,33 @@
1
+ # cocoapods-develop
2
+
3
+ cocoapods-develop makes it easy to develop pods without switching workspaces.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ $ gem install cocoapods-develop
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Add cocoapods-develop to your Podfile:
14
+
15
+ ```plugin 'cocoapods-rome'
16
+ ```
17
+
18
+ When you want to start development work on one of your project's pod dependencies, add this:
19
+
20
+ ```pod_develop AwesomePod, '/path/to/project'
21
+ ```
22
+
23
+ All subsequent references to `AwesomePod` in the Podfile will then be interpreted as development pods.
24
+
25
+ In addition, the Xcode project for AwesomePod will be added to your workspace. Because the project will be added to your workspace, the default CocoaPods behavior of sharing the development pod scheme will be overriden.
26
+
27
+ ## Things to remember
28
+
29
+ If you have the development pod's project open in another workspace, Xcode will complain -- it can't open multiple versions of the same project simultaneously.
30
+
31
+ Any changes to existing files will be reflected immediately when you build.
32
+
33
+ If you add or delete files to the development pod, you must re-run `pod install` for those changes to be reflected.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+
2
+ def specs(dir)
3
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
4
+ end
5
+
6
+ def build
7
+ sh('gem build cocoapods-develop.gemspec')
8
+ sh('gem install cocoapods-develop-0.0.1.gem')
9
+ end
10
+
11
+ desc 'Builds the gem'
12
+ task :build do
13
+ build
14
+ end
15
+
16
+ desc 'Runs all the specs'
17
+ task :specs do
18
+ sh "bundle exec bacon #{specs('**')}"
19
+ end
20
+
21
+ task :default => :specs
22
+
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods-develop/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-develop'
8
+ spec.version = CocoaPodsDevelop::VERSION
9
+ spec.authors = ['Jed Lewison']
10
+ spec.email = ['jed@magicappfactory.com']
11
+ spec.summary = %q{A CocoaPods plugin for easily working with development pods.}
12
+ spec.homepage = 'https://github.com/jedlewison/cocoapods-develop'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.3'
21
+ spec.add_development_dependency 'rake', '~> 0'
22
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-develop/gem_version'
@@ -0,0 +1,3 @@
1
+ module CocoaPodsDevelop
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,100 @@
1
+ require 'cocoapods-core'
2
+ require 'pathname'
3
+
4
+ module Pod
5
+ class Podfile
6
+
7
+ module DSL
8
+
9
+ # Default root path. #TODO: Get from config.
10
+ def default_pod_develop_path
11
+ unless instance_variable_defined? :@default_pod_develop_path
12
+ @default_pod_develop_path = "../../shared/"
13
+ end
14
+ return @default_pod_develop_path
15
+ end
16
+ # Hash of paths to projects for development pods.
17
+ def pod_develop_paths
18
+ unless instance_variable_defined? :@pod_develop_paths
19
+ @pod_develop_paths = Hash.new()
20
+ end
21
+ return @pod_develop_paths
22
+ end
23
+
24
+ # Add or change path to development pod projects.
25
+ def pod_develop(name, path = nil)
26
+ if path.nil?
27
+ path = default_pod_develop_path + name
28
+ end
29
+ pod_develop_paths[name] = path
30
+ end
31
+
32
+ alias_method :original_pod_impl, :pod
33
+ def pod(name = nil, *requirements, &block)
34
+ path = pod_develop_paths[name]
35
+ if path.nil?
36
+ original_pod_impl(name, *requirements, &block)
37
+ else
38
+ original_pod_impl name, :path => path
39
+ end
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+
46
+ module Pod
47
+ class Installer
48
+ # don't share development pod schemes (we will be importing the whole project)
49
+ define_method(:share_development_pod_schemes) do
50
+ #nothing
51
+ end
52
+ end
53
+ end
54
+
55
+ module CocoaPodsDevelop
56
+
57
+ Pod::HooksManager.register('cocoapods-develop', :post_install) do |installer, _|
58
+
59
+ # Find all the workspaces in the root directory for the Podfile
60
+
61
+ projroot = Pathname(installer.sandbox_root).dirname.to_s
62
+ workspaces = Dir.glob(projroot + "/*.xcworkspace")
63
+
64
+ unless workspaces.count != 1
65
+
66
+ workspace_path = Pathname.new(workspaces[0])
67
+
68
+ development_pods_projects = installer.sandbox.development_pods.flat_map do |k, v|
69
+ root_proj_path = Pathname.new(v + "/" + k + ".xcodeproj")
70
+ nested_proj_path = Pathname.new(v + "/" + k + "/" + k + ".xcodeproj")
71
+ if Dir.exists?(root_proj_path)
72
+ root_proj_path
73
+ else Dir.exists?(nested_proj_path)
74
+ nested_proj_path
75
+ end
76
+ end
77
+
78
+ user_project_paths = installer.umbrella_targets.map { |at| at.user_project_path }.uniq
79
+ all_projects_for_installer = (user_project_paths + [installer.sandbox.project_path] + development_pods_projects).uniq
80
+
81
+ allowed_file_references = all_projects_for_installer
82
+ .map { |proj| proj.relative_path_from(Pathname.getwd)}
83
+ .map { |proj| Xcodeproj::Workspace::FileReference.new(proj) }
84
+
85
+ if workspace_path.exist?
86
+ workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
87
+ unless workspace.file_references == allowed_file_references
88
+ workspace = Xcodeproj::Workspace.new(*allowed_file_references)
89
+ workspace.save_as(workspace_path)
90
+ end
91
+ else
92
+ workspace = Xcodeproj::Workspace.new(*allowed_file_references)
93
+ workspace.save_as(workspace_path)
94
+ end
95
+
96
+ else
97
+ # error message
98
+ end
99
+ end
100
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-develop/post_install.rb'
@@ -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,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-develop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jed Lewison
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-01 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:
42
+ email:
43
+ - jed@magicappfactory.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-develop.gemspec
54
+ - lib/cocoapods-develop.rb
55
+ - lib/cocoapods-develop/gem_version.rb
56
+ - lib/cocoapods-develop/post_install.rb
57
+ - lib/cocoapods_plugin.rb
58
+ - spec/spec_helper.rb
59
+ homepage: https://github.com/jedlewison/cocoapods-develop
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.5.1
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: A CocoaPods plugin for easily working with development pods.
83
+ test_files:
84
+ - spec/spec_helper.rb