cocoapods-src 0.1.0 → 0.2.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/README.md +8 -0
- data/lib/cocoapods_plugin.rb +3 -0
- data/lib/cocoapods_src.rb +1 -1
- data/lib/pod.rb +20 -0
- data/lib/pod/hook/post_install.rb +1 -14
- data/lib/pod/rc.rb +17 -0
- data/lib/pod/src/downloader.rb +49 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 606aa66d7ec25f54fee7a80be667a09629003164
|
4
|
+
data.tar.gz: 81fa9597f7eb9a03d5f5fa8ad39c495ac34b319d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c56c670ea4b72949604c07bb458f6e13e3ba235cc9a0883b67b7be3bb4d75e7c664e6cb627f9052c745c9cdc713a801e85452a1ff12fb00576bda6186224593
|
7
|
+
data.tar.gz: 67379581d5bf2092cdedcfbf081c6d163f7e70e3b5ad533643c76b1496e6f3bc2958c376f4799b1b903f8da44f17611690a1f22dd953087d078d05684bbeeb35
|
data/README.md
CHANGED
@@ -18,6 +18,14 @@ $ pod install
|
|
18
18
|
|
19
19
|
After `pod install`, automatically `git clone POD_SOURCE ~/.cocoapods/src/POD_NAME` will be run.
|
20
20
|
|
21
|
+
### ghq
|
22
|
+
|
23
|
+
You can download sources using `ghq` command ([motemen/ghq](https://github.com/motemen/ghq)) instead of `git clone`. If you like to do it, add `~/.podrc`, `~/.cocoapods/.podrc`, or `./.podrc`, and add a configuration like this.
|
24
|
+
|
25
|
+
```yaml
|
26
|
+
cocoapods-src_use_ghq: true
|
27
|
+
```
|
28
|
+
|
21
29
|
## Contribution
|
22
30
|
|
23
31
|
1. Fork
|
data/lib/cocoapods_plugin.rb
CHANGED
data/lib/cocoapods_src.rb
CHANGED
data/lib/pod.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Pod
|
2
|
+
def self.rc
|
3
|
+
return @rc if not @rc.nil?
|
4
|
+
|
5
|
+
rc_paths.each do |rc_path|
|
6
|
+
if File.exist?(rc_path)
|
7
|
+
@rc = Rc.new(rc_path)
|
8
|
+
break
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
@rc
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def self.rc_paths
|
18
|
+
["#{Dir.home}/.podrc", "#{Dir.home}/.cocoapods/.podrc", "#{Dir.pwd}/.podrc"]
|
19
|
+
end
|
20
|
+
end
|
@@ -1,16 +1,3 @@
|
|
1
|
-
require "cocoapods-downloader"
|
2
|
-
|
3
1
|
Pod::HooksManager.register(:post_install) do |installer_context|
|
4
|
-
|
5
|
-
|
6
|
-
specs = installer_context.umbrella_targets.map(&:specs).flatten.uniq
|
7
|
-
specs.each do |spec|
|
8
|
-
next if spec.source.nil? || spec.source[:git].nil?
|
9
|
-
|
10
|
-
target_path = target_dir.join(spec.name)
|
11
|
-
next if target_path.exist?
|
12
|
-
|
13
|
-
source_url = spec.source[:git]
|
14
|
-
Pod::Downloader.for_target(target_path, git: source_url).download
|
15
|
-
end
|
2
|
+
Pod::Src::Downloader.new(installer_context).download
|
16
3
|
end
|
data/lib/pod/rc.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require "cocoapods-downloader"
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
module Src
|
5
|
+
class Downloader
|
6
|
+
def initialize(context)
|
7
|
+
@context = context
|
8
|
+
end
|
9
|
+
|
10
|
+
def download
|
11
|
+
specs.each do |spec|
|
12
|
+
next if spec.source.nil? || spec.source[:git].nil?
|
13
|
+
|
14
|
+
source_url = spec.source[:git]
|
15
|
+
|
16
|
+
if use_ghq?
|
17
|
+
download_by_ghq(source_url)
|
18
|
+
else
|
19
|
+
target_path = target_dir.join(spec.name)
|
20
|
+
next if target_path.exist?
|
21
|
+
download_by_pod_downloader(target_path, source_url)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def specs
|
29
|
+
@specs ||= @context.umbrella_targets.map(&:specs).flatten.uniq
|
30
|
+
end
|
31
|
+
|
32
|
+
def target_dir
|
33
|
+
Pathname.new("#{Dir.home}/.cocoapods/src")
|
34
|
+
end
|
35
|
+
|
36
|
+
def use_ghq?
|
37
|
+
!Pod.rc.nil? && Pod.rc["cocoapods-src_use_ghq"]
|
38
|
+
end
|
39
|
+
|
40
|
+
def download_by_ghq(source_url)
|
41
|
+
system "ghq", "get", source_url
|
42
|
+
end
|
43
|
+
|
44
|
+
def download_by_pod_downloader(target_path, source_url)
|
45
|
+
Pod::Downloader.for_target(target_path, git: source_url).download
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-src
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naoto Kaneko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,7 +53,10 @@ files:
|
|
53
53
|
- cocoapods_src.gemspec
|
54
54
|
- lib/cocoapods_plugin.rb
|
55
55
|
- lib/cocoapods_src.rb
|
56
|
+
- lib/pod.rb
|
56
57
|
- lib/pod/hook/post_install.rb
|
58
|
+
- lib/pod/rc.rb
|
59
|
+
- lib/pod/src/downloader.rb
|
57
60
|
homepage: https://github.com/naoty/cocoapods-src
|
58
61
|
licenses:
|
59
62
|
- MIT
|