cocoapods-x 0.0.4

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.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +36 -0
  4. data/lib/cocoapods-x.rb +1 -0
  5. data/lib/cocoapods-x/command.rb +18 -0
  6. data/lib/cocoapods-x/command/edit.rb +81 -0
  7. data/lib/cocoapods-x/command/environment.rb +17 -0
  8. data/lib/cocoapods-x/command/environment/init.rb +29 -0
  9. data/lib/cocoapods-x/command/environment/install.rb +29 -0
  10. data/lib/cocoapods-x/command/environment/update.rb +30 -0
  11. data/lib/cocoapods-x/command/install.rb +35 -0
  12. data/lib/cocoapods-x/command/libary.rb +16 -0
  13. data/lib/cocoapods-x/command/libary/build.rb +14 -0
  14. data/lib/cocoapods-x/command/libary/create.rb +49 -0
  15. data/lib/cocoapods-x/command/repo.rb +91 -0
  16. data/lib/cocoapods-x/command/update.rb +28 -0
  17. data/lib/cocoapods-x/command/xcode.rb +15 -0
  18. data/lib/cocoapods-x/command/xcode/clean.rb +75 -0
  19. data/lib/cocoapods-x/command/xcode/open.rb +26 -0
  20. data/lib/cocoapods-x/extension.rb +4 -0
  21. data/lib/cocoapods-x/extension/configure.rb +84 -0
  22. data/lib/cocoapods-x/extension/environment.rb +31 -0
  23. data/lib/cocoapods-x/extension/installer.rb +145 -0
  24. data/lib/cocoapods-x/extension/installer/builder.rb +36 -0
  25. data/lib/cocoapods-x/extension/installer/dsl.rb +94 -0
  26. data/lib/cocoapods-x/extension/installer/podfile.rb +66 -0
  27. data/lib/cocoapods-x/extension/sandbox.rb +64 -0
  28. data/lib/cocoapods-x/extension/sandbox/project.rb +51 -0
  29. data/lib/cocoapods-x/extension/sandbox/projects.rb +25 -0
  30. data/lib/cocoapods-x/extension/sandbox/protocol.rb +24 -0
  31. data/lib/cocoapods-x/extension/sandbox/repos.rb +81 -0
  32. data/lib/cocoapods-x/extension/sandbox/template.rb +77 -0
  33. data/lib/cocoapods-x/extension/sandbox/workspace.rb +84 -0
  34. data/lib/cocoapods-x/extension/xcode.rb +1 -0
  35. data/lib/cocoapods-x/extension/xcode/open.rb +44 -0
  36. data/lib/cocoapods-x/gem_version.rb +3 -0
  37. data/lib/cocoapods_plugin.rb +2 -0
  38. metadata +109 -0
@@ -0,0 +1,84 @@
1
+ require 'cocoapods-x/extension/sandbox/protocol'
2
+
3
+ module Pod
4
+ module X
5
+ class Sandbox
6
+ class Workspace < Pod::Sandbox
7
+
8
+ include Pod::X::Sandbox::Protocol
9
+
10
+ Repo = Struct::new(:name, :domain, :project, :location_url, :branch)
11
+
12
+ attr_reader :repos, :template, :projects
13
+
14
+ def initialize
15
+ super File.join(File.expand_path('~'), '.cocoapods/x')
16
+ @repos = Pod::X::Sandbox::Repos::new root
17
+ @template = Pod::X::Sandbox::Template::new root
18
+ @projects = Pod::X::Sandbox::Projects::new root
19
+ end
20
+
21
+ def install!
22
+ @repos.install!
23
+ @template.install!
24
+ @projects.install!
25
+
26
+ unless source_file.exist?
27
+ cp! [@template::source_file, source_file]
28
+ end
29
+ end
30
+
31
+ def update!
32
+ @repos.update!
33
+ @template.update!
34
+ @projects.update!
35
+
36
+ rm! ['-rf', source_file]
37
+ cp! [@template::source_file, source_file]
38
+ end
39
+
40
+ def source_file
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
79
+ end
80
+
81
+ end
82
+ end
83
+ 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 '.magenta + "#{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 '.magenta + "Opening #{File.basename(url)}.") do
37
+ open! [url]
38
+ end
39
+ end
40
+
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsX
2
+ VERSION = "0.0.4"
3
+ end
@@ -0,0 +1,2 @@
1
+ require 'cocoapods-x/command'
2
+ require 'cocoapods-x/extension'
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-x
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - panghu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-05-16 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: 扩展pod x命令, 实现快速清理缓存, 快速打开Xcode等操作, 使用souce, pods两个dsl实现快速切换pod 'NAME',
42
+ :path=>'url'开发模式, 对壳工程无入侵.
43
+ email:
44
+ - panghu.lee@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - LICENSE
50
+ - README.md
51
+ - lib/cocoapods-x.rb
52
+ - lib/cocoapods-x/command.rb
53
+ - lib/cocoapods-x/command/edit.rb
54
+ - lib/cocoapods-x/command/environment.rb
55
+ - lib/cocoapods-x/command/environment/init.rb
56
+ - lib/cocoapods-x/command/environment/install.rb
57
+ - lib/cocoapods-x/command/environment/update.rb
58
+ - lib/cocoapods-x/command/install.rb
59
+ - lib/cocoapods-x/command/libary.rb
60
+ - lib/cocoapods-x/command/libary/build.rb
61
+ - lib/cocoapods-x/command/libary/create.rb
62
+ - lib/cocoapods-x/command/repo.rb
63
+ - lib/cocoapods-x/command/update.rb
64
+ - lib/cocoapods-x/command/xcode.rb
65
+ - lib/cocoapods-x/command/xcode/clean.rb
66
+ - lib/cocoapods-x/command/xcode/open.rb
67
+ - lib/cocoapods-x/extension.rb
68
+ - lib/cocoapods-x/extension/configure.rb
69
+ - lib/cocoapods-x/extension/environment.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
74
+ - lib/cocoapods-x/extension/sandbox.rb
75
+ - lib/cocoapods-x/extension/sandbox/project.rb
76
+ - lib/cocoapods-x/extension/sandbox/projects.rb
77
+ - lib/cocoapods-x/extension/sandbox/protocol.rb
78
+ - lib/cocoapods-x/extension/sandbox/repos.rb
79
+ - lib/cocoapods-x/extension/sandbox/template.rb
80
+ - lib/cocoapods-x/extension/sandbox/workspace.rb
81
+ - lib/cocoapods-x/extension/xcode.rb
82
+ - lib/cocoapods-x/extension/xcode/open.rb
83
+ - lib/cocoapods-x/gem_version.rb
84
+ - lib/cocoapods_plugin.rb
85
+ homepage: https://github.com/CocoapodsX/cocoapods-x
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubygems_version: 3.0.8
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: 扩展pod x命令, 实现快速清理缓存, 快速打开Xcode等操作, 使用souce, pods两个dsl实现快速切换pod 'NAME', :path=>'url'开发模式,
108
+ 对壳工程无入侵.
109
+ test_files: []