cocoapods-x 0.0.1 → 0.0.2
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-x/command.rb +3 -1
- data/lib/cocoapods-x/command/edit.rb +41 -30
- data/lib/cocoapods-x/command/environment/init.rb +3 -4
- data/lib/cocoapods-x/command/environment/install.rb +3 -3
- data/lib/cocoapods-x/command/environment/update.rb +3 -3
- data/lib/cocoapods-x/command/install.rb +35 -0
- data/lib/cocoapods-x/command/libary/create.rb +1 -1
- data/lib/cocoapods-x/command/repo.rb +91 -0
- data/lib/cocoapods-x/command/update.rb +28 -0
- data/lib/cocoapods-x/command/xcode/clean.rb +2 -2
- data/lib/cocoapods-x/command/xcode/open.rb +5 -30
- data/lib/cocoapods-x/extension.rb +2 -1
- data/lib/cocoapods-x/extension/configure.rb +10 -5
- data/lib/cocoapods-x/extension/environment.rb +0 -81
- data/lib/cocoapods-x/extension/installer.rb +144 -0
- data/lib/cocoapods-x/extension/installer/builder.rb +36 -0
- data/lib/cocoapods-x/extension/installer/dsl.rb +94 -0
- data/lib/cocoapods-x/extension/installer/podfile.rb +66 -0
- data/lib/cocoapods-x/extension/sandbox/project.rb +1 -1
- data/lib/cocoapods-x/extension/sandbox/repos.rb +48 -24
- data/lib/cocoapods-x/extension/sandbox/template.rb +2 -2
- data/lib/cocoapods-x/extension/sandbox/workspace.rb +41 -2
- data/lib/cocoapods-x/extension/xcode.rb +1 -0
- data/lib/cocoapods-x/extension/xcode/open.rb +44 -0
- data/lib/cocoapods-x/gem_version.rb +1 -1
- metadata +11 -8
- data/lib/cocoapods-x/command/repos.rb +0 -74
- data/lib/cocoapods-x/extension/environment/definition.rb +0 -90
- data/lib/cocoapods-x/extension/environment/dsl.rb +0 -76
- data/lib/cocoapods-x/extension/environment/pod.rb +0 -23
- data/lib/cocoapods-x/extension/environment/podfile.rb +0 -40
- data/lib/cocoapods-x/extension/environment/source.rb +0 -24
@@ -7,6 +7,8 @@ module Pod
|
|
7
7
|
|
8
8
|
include Pod::X::Sandbox::Protocol
|
9
9
|
|
10
|
+
Repo = Struct::new(:name, :domain, :project, :location_url, :branch)
|
11
|
+
|
10
12
|
attr_reader :repos, :template, :projects
|
11
13
|
|
12
14
|
def initialize
|
@@ -36,10 +38,47 @@ module Pod
|
|
36
38
|
end
|
37
39
|
|
38
40
|
def source_file
|
39
|
-
root + '
|
41
|
+
root + 'sources'
|
42
|
+
end
|
43
|
+
|
44
|
+
def all_pods
|
45
|
+
all_pods = Array::new
|
46
|
+
for url in Dir.glob(@repos::root + '*/*') do
|
47
|
+
pod_url = Pathname(url)
|
48
|
+
if pod_url.directory?
|
49
|
+
domain_url = Pathname(pod_url.dirname)
|
50
|
+
branch = git_branch(pod_url)
|
51
|
+
all_pods << Repo::new(pod_url.basename.to_s, domain_url.basename.to_s, nil, pod_url.to_s, branch)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
for url in Dir.glob(@projects::root + '*/repos/*/*') do
|
55
|
+
pod_url = Pathname(url)
|
56
|
+
if pod_url.directory?
|
57
|
+
domain_url = Pathname(pod_url.dirname)
|
58
|
+
project_url = Pathname(Pathname(domain_url.dirname).dirname)
|
59
|
+
branch = git_branch(pod_url)
|
60
|
+
all_pods <<Repo::new(pod_url.basename.to_s, domain_url.basename.to_s, project_url.basename.to_s, pod_url.to_s, branch)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
all_pods
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def git_branch url
|
69
|
+
branch = nil
|
70
|
+
Dir.chdir(url) do
|
71
|
+
begin
|
72
|
+
branch = git! ['rev-parse', '--abbrev-ref', 'HEAD']
|
73
|
+
branch = branch.chomp
|
74
|
+
rescue => exception
|
75
|
+
branch = nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
branch
|
40
79
|
end
|
41
80
|
|
42
81
|
end
|
43
82
|
end
|
44
83
|
end
|
45
|
-
end
|
84
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-x/extension/xcode/open'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Pod
|
2
|
+
module X
|
3
|
+
class Xcode
|
4
|
+
class Open
|
5
|
+
|
6
|
+
extend Executable
|
7
|
+
executable :open
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@urls_w = Dir[File.join(Dir.pwd, "*.xcworkspace")]
|
11
|
+
@urls_p = Dir[File.join(Dir.pwd, "*.xcodeproj")]
|
12
|
+
@urls = @urls_w + @urls_p
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def run!
|
17
|
+
if @urls_w.size == 1
|
18
|
+
openxc!(@urls_w[0])
|
19
|
+
elsif @urls_p.size == 1
|
20
|
+
openxc!(@urls_p[0])
|
21
|
+
elsif @urls.size > 0
|
22
|
+
choices = @urls.map { |l| File.basename(l) }
|
23
|
+
begin
|
24
|
+
index = UI.choose_from_array(choices, 'Which file do you want to open?')
|
25
|
+
openxc!(urls[index])
|
26
|
+
rescue => exception
|
27
|
+
UI.puts '[!] Pod::X '.blue + "#{exception}".red
|
28
|
+
end
|
29
|
+
else
|
30
|
+
openxc!('/Applications/Xcode.app')
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def openxc! url
|
36
|
+
UI.section('Pod::X '.blue + "Opening #{File.basename(url)}.") do
|
37
|
+
open! [url]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-x
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- panghu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,21 +55,22 @@ files:
|
|
55
55
|
- lib/cocoapods-x/command/environment/init.rb
|
56
56
|
- lib/cocoapods-x/command/environment/install.rb
|
57
57
|
- lib/cocoapods-x/command/environment/update.rb
|
58
|
+
- lib/cocoapods-x/command/install.rb
|
58
59
|
- lib/cocoapods-x/command/libary.rb
|
59
60
|
- lib/cocoapods-x/command/libary/build.rb
|
60
61
|
- lib/cocoapods-x/command/libary/create.rb
|
61
|
-
- lib/cocoapods-x/command/
|
62
|
+
- lib/cocoapods-x/command/repo.rb
|
63
|
+
- lib/cocoapods-x/command/update.rb
|
62
64
|
- lib/cocoapods-x/command/xcode.rb
|
63
65
|
- lib/cocoapods-x/command/xcode/clean.rb
|
64
66
|
- lib/cocoapods-x/command/xcode/open.rb
|
65
67
|
- lib/cocoapods-x/extension.rb
|
66
68
|
- lib/cocoapods-x/extension/configure.rb
|
67
69
|
- lib/cocoapods-x/extension/environment.rb
|
68
|
-
- lib/cocoapods-x/extension/
|
69
|
-
- lib/cocoapods-x/extension/
|
70
|
-
- lib/cocoapods-x/extension/
|
71
|
-
- lib/cocoapods-x/extension/
|
72
|
-
- lib/cocoapods-x/extension/environment/source.rb
|
70
|
+
- lib/cocoapods-x/extension/installer.rb
|
71
|
+
- lib/cocoapods-x/extension/installer/builder.rb
|
72
|
+
- lib/cocoapods-x/extension/installer/dsl.rb
|
73
|
+
- lib/cocoapods-x/extension/installer/podfile.rb
|
73
74
|
- lib/cocoapods-x/extension/sandbox.rb
|
74
75
|
- lib/cocoapods-x/extension/sandbox/project.rb
|
75
76
|
- lib/cocoapods-x/extension/sandbox/projects.rb
|
@@ -77,6 +78,8 @@ files:
|
|
77
78
|
- lib/cocoapods-x/extension/sandbox/repos.rb
|
78
79
|
- lib/cocoapods-x/extension/sandbox/template.rb
|
79
80
|
- lib/cocoapods-x/extension/sandbox/workspace.rb
|
81
|
+
- lib/cocoapods-x/extension/xcode.rb
|
82
|
+
- lib/cocoapods-x/extension/xcode/open.rb
|
80
83
|
- lib/cocoapods-x/gem_version.rb
|
81
84
|
- lib/cocoapods_plugin.rb
|
82
85
|
homepage: https://github.com/CocoapodsX/cocoapods-x
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'cocoapods-x/extension/sandbox'
|
2
|
-
require 'cocoapods-x/extension/configure'
|
3
|
-
require 'cocoapods-x/extension/environment'
|
4
|
-
|
5
|
-
module Pod
|
6
|
-
class Command
|
7
|
-
class X < Command
|
8
|
-
class Repos < X
|
9
|
-
|
10
|
-
self.summary = 'Opens repos'
|
11
|
-
self.description = <<-DESC
|
12
|
-
Open a dir of pod named `NAME`.
|
13
|
-
DESC
|
14
|
-
|
15
|
-
self.arguments = [
|
16
|
-
CLAide::Argument.new('NAME', true),
|
17
|
-
]
|
18
|
-
|
19
|
-
def initialize(argv)
|
20
|
-
@name = argv.shift_argument
|
21
|
-
super
|
22
|
-
end
|
23
|
-
|
24
|
-
def run
|
25
|
-
begin
|
26
|
-
if @name.nil? || @name.size <= 0
|
27
|
-
open_project_repos!
|
28
|
-
open_workspace_repos!
|
29
|
-
else
|
30
|
-
open_repo! @name
|
31
|
-
end
|
32
|
-
rescue => exception
|
33
|
-
puts "[!] Pod::X #{exception}".red
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
extend Executable
|
40
|
-
executable :open
|
41
|
-
|
42
|
-
def open_project_repos!
|
43
|
-
begin
|
44
|
-
project = Pod::X::Environment::init!
|
45
|
-
open! [project.root]
|
46
|
-
rescue => exception
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def open_workspace_repos!
|
51
|
-
workspace = Pod::X::Environment::install!
|
52
|
-
open! [workspace.root]
|
53
|
-
end
|
54
|
-
|
55
|
-
def open_repo! name
|
56
|
-
environment = Pod::X::Environment::environment
|
57
|
-
podinfo = environment.podinfo?(name, '')
|
58
|
-
unless podinfo.nil?
|
59
|
-
path = environment.pod_path? podinfo
|
60
|
-
unless path.nil?
|
61
|
-
open! [path]
|
62
|
-
else
|
63
|
-
raise Informative, "No `#{name}' found in the project directory."
|
64
|
-
end
|
65
|
-
else
|
66
|
-
raise Informative, "No `#{name}' found in the project directory."
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
@@ -1,90 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
module X
|
3
|
-
class Source
|
4
|
-
class Definition
|
5
|
-
|
6
|
-
attr_reader :domain
|
7
|
-
attr_reader :parent
|
8
|
-
attr_reader :children
|
9
|
-
attr_reader :map
|
10
|
-
|
11
|
-
def initialize(domain, parent)
|
12
|
-
@domain = domain
|
13
|
-
@parent = parent
|
14
|
-
@children = []
|
15
|
-
@map = Hash::new(nil)
|
16
|
-
if parent.is_a?(Pod::X::Source::Definition)
|
17
|
-
parent.children << self
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def list
|
22
|
-
hash = Hash::new(nil)
|
23
|
-
hash = hash.merge(@map)
|
24
|
-
for source in children do
|
25
|
-
hash = hash.merge(source.map)
|
26
|
-
end
|
27
|
-
hash
|
28
|
-
end
|
29
|
-
|
30
|
-
def store_pod(name = nil, *requirements)
|
31
|
-
options = requirements.last
|
32
|
-
options ||= Hash::new(nil)
|
33
|
-
options = options.is_a?(Hash) ? options : Hash::new(nil)
|
34
|
-
|
35
|
-
group = options[:group] || name
|
36
|
-
git = options[:git] || "#{name}.git"
|
37
|
-
|
38
|
-
if domain.start_with? "git@"
|
39
|
-
store_pod_git(name, group, git)
|
40
|
-
elsif domain.size > 0
|
41
|
-
store_pod_http(name, group, git)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def store_pod_git(name, group, git)
|
46
|
-
source = "#{domain}:#{group}/#{git}"
|
47
|
-
map[name] = source
|
48
|
-
end
|
49
|
-
|
50
|
-
def store_pod_http(name, group, git)
|
51
|
-
source = Pathname(domain)
|
52
|
-
source += group
|
53
|
-
source += git
|
54
|
-
map[name] = source.to_s
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
module Pod
|
63
|
-
module X
|
64
|
-
class Pods
|
65
|
-
class Definition
|
66
|
-
|
67
|
-
attr_reader :map
|
68
|
-
|
69
|
-
def initialize
|
70
|
-
@map = Hash::new(nil)
|
71
|
-
end
|
72
|
-
|
73
|
-
def list
|
74
|
-
@map
|
75
|
-
end
|
76
|
-
|
77
|
-
def store_pod(name = nil, *requirements)
|
78
|
-
options = requirements.last
|
79
|
-
options ||= Hash::new(nil)
|
80
|
-
options = options.is_a?(Hash) ? options : Hash::new(nil)
|
81
|
-
value = options[:share]
|
82
|
-
value = value.nil? ? true : value
|
83
|
-
value = (value.is_a?(TrueClass) || value.is_a?(FalseClass)) ? value : true
|
84
|
-
@map[name] = value
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
|
2
|
-
module Pod
|
3
|
-
module X
|
4
|
-
module DSLBuilder
|
5
|
-
|
6
|
-
def build url
|
7
|
-
contents = File.exist?(url) ? File.open(url, 'r:utf-8', &:read) : nil
|
8
|
-
# Work around for Rubinius incomplete encoding in 1.9 mode
|
9
|
-
if !contents.nil? && contents.respond_to?(:encoding) && contents.encoding.name != 'UTF-8'
|
10
|
-
contents.encode!('UTF-8')
|
11
|
-
end
|
12
|
-
if !contents.nil? && contents.tr!('“”‘’‛', %(""'''))
|
13
|
-
# Changes have been made
|
14
|
-
CoreUI.warn "Smart quotes were detected and ignored in your #{File.basename(url)}. " \
|
15
|
-
'To avoid issues in the future, you should not use ' \
|
16
|
-
'TextEdit for editing it. If you are not using TextEdit, ' \
|
17
|
-
'you should turn off smart quotes in your editor of choice.'
|
18
|
-
end
|
19
|
-
unless contents.nil?
|
20
|
-
begin
|
21
|
-
eval(contents, nil, url.to_s)
|
22
|
-
rescue Exception => e
|
23
|
-
message = "Invalid `#{File.basename(url)}` file: #{e.message}"
|
24
|
-
raise DSLError.new(message, url, e, contents)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
module Pod
|
34
|
-
module X
|
35
|
-
class Pods
|
36
|
-
module DSL
|
37
|
-
|
38
|
-
def pod(name = nil, *requirements)
|
39
|
-
unless name
|
40
|
-
raise StandardError, 'A development requires a name.'
|
41
|
-
end
|
42
|
-
@current_pods_definition.store_pod(name, *requirements)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
module Pod
|
51
|
-
module X
|
52
|
-
class Source
|
53
|
-
module DSL
|
54
|
-
|
55
|
-
def source(domain, options = nil)
|
56
|
-
if options
|
57
|
-
raise Informative, "Unsupported options `#{options}` for domain `#{domain}`."
|
58
|
-
end
|
59
|
-
|
60
|
-
@current_domain_definition = Pod::X::Source::Definition::new(domain, @parent)
|
61
|
-
yield if block_given?
|
62
|
-
ensure
|
63
|
-
@current_domain_definition = nil
|
64
|
-
end
|
65
|
-
|
66
|
-
def pod(name = nil, *requirements)
|
67
|
-
unless name
|
68
|
-
raise StandardError, 'A development requires a name.'
|
69
|
-
end
|
70
|
-
@current_domain_definition.store_pod(name, *requirements)
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'cocoapods-x/extension/environment/dsl'
|
2
|
-
require 'cocoapods-x/extension/environment/definition'
|
3
|
-
|
4
|
-
module Pod
|
5
|
-
module X
|
6
|
-
class Pods
|
7
|
-
|
8
|
-
include Pod::X::Pods::DSL
|
9
|
-
include Pod::X::DSLBuilder
|
10
|
-
|
11
|
-
attr_reader :current_pods_definition
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
@current_pods_definition = Pod::X::Pods::Definition::new
|
15
|
-
end
|
16
|
-
|
17
|
-
def list
|
18
|
-
@current_pods_definition::list
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
|
2
|
-
module Pod
|
3
|
-
class Podfile
|
4
|
-
module DSL
|
5
|
-
|
6
|
-
xold_pod_method = instance_method(:pod)
|
7
|
-
define_method(:pod) do |name, *requirements|
|
8
|
-
environment = Pod::X::Environment::environment
|
9
|
-
if environment.runing?
|
10
|
-
version = requirements.first
|
11
|
-
version ||= ''
|
12
|
-
version = version.is_a?(String) ? version : '';
|
13
|
-
|
14
|
-
options = requirements.last
|
15
|
-
options ||= Hash::new
|
16
|
-
options = options.is_a?(Hash) ? options : Hash::new(nil);
|
17
|
-
|
18
|
-
if options[:path].nil?
|
19
|
-
podinfo = environment.podinfo?(name, version)
|
20
|
-
if !podinfo.nil? && !podinfo.repo_url.nil?
|
21
|
-
path = environment.pod_path? podinfo
|
22
|
-
UI.puts "pod '#{name}', :path => '#{path}'".green
|
23
|
-
xold_pod_method.bind(self).(name, :path => path)
|
24
|
-
elsif !podinfo.nil? && podinfo.repo_url.nil?
|
25
|
-
UI.puts "Pod::X You must specify a repository to clone for `#{name}`.".yellow
|
26
|
-
xold_pod_method.bind(self).(name, *requirements)
|
27
|
-
else
|
28
|
-
xold_pod_method.bind(self).(name, *requirements)
|
29
|
-
end
|
30
|
-
else
|
31
|
-
xold_pod_method.bind(self).(name, *requirements)
|
32
|
-
end
|
33
|
-
else
|
34
|
-
xold_pod_method.bind(self).(name, *requirements)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|