pod-dependency-resolve 0.1.0

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
+ SHA256:
3
+ metadata.gz: 554cd8f3522a9632eb9faa343d84742c6d077f6b5cfbf079eb147a62a73353ef
4
+ data.tar.gz: 661d26a8094c7f09cb9b2777846f7ccc755d2959c8d6655e563e29b2cb922651
5
+ SHA512:
6
+ metadata.gz: bb0d6d1401380cba34c9f3c4d36dce810892f659c8efe431005315f8b02562c43b738f46883a498de2d8d4781b028a5890b4622e6d8238b79fc86392e8f949c0
7
+ data.tar.gz: 3d8766084496396abf2db5b179a95aa0633f4e569c510e2093b630ae056d4d8f0da038ef15a7f75b3a95ef6fd49e458cd80da4a720453ee4db2dca7412dfdf18
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ </profile>
6
+ </component>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.7.0" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/pod-target.iml" filepath="$PROJECT_DIR$/.idea/pod-target.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,48 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="CFPropertyList (v3.0.3, RVM: ruby-2.7.0) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="atomos (v0.1.3, RVM: ruby-2.7.0) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.2, RVM: ruby-2.7.0) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="claide (v1.0.3, RVM: ruby-2.7.0) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="colored2 (v3.1.2, RVM: ruby-2.7.0) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.7.0) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="equatable (v0.5.0, RVM: ruby-2.7.0) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="nanaimo (v0.3.0, RVM: ruby-2.7.0) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="necromancer (v0.3.0, RVM: ruby-2.7.0) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="pastel (v0.6.1, RVM: ruby-2.7.0) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, RVM: ruby-2.7.0) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-2.7.0) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-2.7.0) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-2.7.0) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-2.7.0) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, RVM: ruby-2.7.0) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="thor (v1.1.0, RVM: ruby-2.7.0) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="tty (v0.5.0, RVM: ruby-2.7.0) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="tty-color (v0.3.0, RVM: ruby-2.7.0) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="tty-command (v0.1.0, RVM: ruby-2.7.0) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="tty-cursor (v0.3.0, RVM: ruby-2.7.0) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="tty-pager (v0.4.0, RVM: ruby-2.7.0) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="tty-platform (v0.1.0, RVM: ruby-2.7.0) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="tty-progressbar (v0.9.0, RVM: ruby-2.7.0) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="tty-prompt (v0.6.0, RVM: ruby-2.7.0) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="tty-screen (v0.5.1, RVM: ruby-2.7.0) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="tty-spinner (v0.2.0, RVM: ruby-2.7.0) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="tty-table (v0.5.0, RVM: ruby-2.7.0) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="tty-which (v0.1.0, RVM: ruby-2.7.0) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="unicode_utils (v1.4.0, RVM: ruby-2.7.0) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="verse (v0.4.0, RVM: ruby-2.7.0) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="wisper (v1.6.1, RVM: ruby-2.7.0) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="xcodeproj (v1.19.0, RVM: ruby-2.7.0) [gem]" level="application" />
47
+ </component>
48
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install: gem install bundler -v 2.1.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at thaibao.do@seatalk.biz. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in pod-target.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
8
+ gem 'tty'
data/Gemfile.lock ADDED
@@ -0,0 +1,99 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pod-dependency-resolve (0.1.0)
5
+ thor
6
+ xcodeproj (~> 1.7)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ CFPropertyList (3.0.3)
12
+ atomos (0.1.3)
13
+ claide (1.0.3)
14
+ colored2 (3.1.2)
15
+ diff-lcs (1.4.4)
16
+ equatable (0.5.0)
17
+ nanaimo (0.3.0)
18
+ necromancer (0.3.0)
19
+ pastel (0.6.1)
20
+ equatable (~> 0.5.0)
21
+ tty-color (~> 0.3.0)
22
+ rake (12.3.3)
23
+ rspec (3.10.0)
24
+ rspec-core (~> 3.10.0)
25
+ rspec-expectations (~> 3.10.0)
26
+ rspec-mocks (~> 3.10.0)
27
+ rspec-core (3.10.1)
28
+ rspec-support (~> 3.10.0)
29
+ rspec-expectations (3.10.1)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.10.0)
32
+ rspec-mocks (3.10.2)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.10.0)
35
+ rspec-support (3.10.2)
36
+ thor (1.1.0)
37
+ tty (0.5.0)
38
+ equatable (~> 0.5.0)
39
+ pastel (~> 0.6.0)
40
+ tty-color (~> 0.3.0)
41
+ tty-command (~> 0.1.0)
42
+ tty-cursor (~> 0.3.0)
43
+ tty-pager (~> 0.4.0)
44
+ tty-platform (~> 0.1.0)
45
+ tty-progressbar (~> 0.9.0)
46
+ tty-prompt (~> 0.6.0)
47
+ tty-screen (~> 0.5.0)
48
+ tty-spinner (~> 0.2.0)
49
+ tty-table (~> 0.5.0)
50
+ tty-which (~> 0.1.0)
51
+ tty-color (0.3.0)
52
+ tty-command (0.1.0)
53
+ pastel (~> 0.6.0)
54
+ tty-cursor (0.3.0)
55
+ tty-pager (0.4.0)
56
+ tty-screen (~> 0.5.0)
57
+ tty-which (~> 0.1.0)
58
+ verse (~> 0.4.0)
59
+ tty-platform (0.1.0)
60
+ tty-progressbar (0.9.0)
61
+ tty-screen (~> 0.5.0)
62
+ tty-prompt (0.6.0)
63
+ necromancer (~> 0.3.0)
64
+ pastel (~> 0.6.0)
65
+ tty-cursor (~> 0.3.0)
66
+ tty-platform (~> 0.1.0)
67
+ wisper (~> 1.6.1)
68
+ tty-screen (0.5.1)
69
+ tty-spinner (0.2.0)
70
+ tty-table (0.5.0)
71
+ equatable (~> 0.5.0)
72
+ necromancer (~> 0.3.0)
73
+ pastel (~> 0.6.0)
74
+ tty-screen (~> 0.5.0)
75
+ unicode_utils (~> 1.4.0)
76
+ verse (~> 0.4.0)
77
+ tty-which (0.1.0)
78
+ unicode_utils (1.4.0)
79
+ verse (0.4.0)
80
+ unicode_utils (~> 1.4.0)
81
+ wisper (1.6.1)
82
+ xcodeproj (1.19.0)
83
+ CFPropertyList (>= 2.3.3, < 4.0)
84
+ atomos (~> 0.1.3)
85
+ claide (>= 1.0.2, < 2.0)
86
+ colored2 (~> 3.1)
87
+ nanaimo (~> 0.3.0)
88
+
89
+ PLATFORMS
90
+ ruby
91
+
92
+ DEPENDENCIES
93
+ pod-dependency-resolve!
94
+ rake (~> 12.0)
95
+ rspec (~> 3.0)
96
+ tty
97
+
98
+ BUNDLED WITH
99
+ 2.1.2
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Bao Do
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Pod::Target
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pod/target`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'pod-target'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install pod-target
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pod-target. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/pod-target/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+
38
+ ## Code of Conduct
39
+
40
+ Everyone interacting in the Pod::Target project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/pod-target/blob/master/CODE_OF_CONDUCT.md).
41
+
42
+ ## Copyright
43
+
44
+ Copyright (c) 2021 Bao Do. See [MIT License](LICENSE.txt) for further details.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pod/target"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/pod-target ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ lib_path = File.expand_path('../lib', __dir__)
5
+ $:.unshift(lib_path) if !$:.include?(lib_path)
6
+ require 'pod/target/cli'
7
+
8
+ Signal.trap('INT') do
9
+ warn("\n#{caller.join("\n")}: interrupted")
10
+ exit(1)
11
+ end
12
+
13
+ begin
14
+ Pod::Target::CLI.start
15
+ rescue Pod::Target::CLI::Error => err
16
+ puts "ERROR: #{err.message}"
17
+ exit 1
18
+ end
data/lib/pod/target.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "pod/target/version"
2
+
3
+ module Pod
4
+ module Target
5
+ class Error < StandardError; end
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ module Pod
6
+ module Target
7
+ # Handle the application command line parsing
8
+ # and the dispatch to various command objects
9
+ #
10
+ # @api public
11
+ class CLI < Thor
12
+ # Error raised by this runner
13
+ Error = Class.new(StandardError)
14
+
15
+ desc 'version', 'pod-target version'
16
+ def version
17
+ require_relative 'version'
18
+ puts "v#{Pod::Target::VERSION}"
19
+ end
20
+ map %w(--version -v) => :version
21
+
22
+ desc 'resolve-dependency', "Resolve dependencies of pod's targets"
23
+ method_option :help, aliases: '-h', type: :boolean,
24
+ desc: 'Display usage information'
25
+ method_option :workspace, type: :string,
26
+ desc: "Set workspace path, if not set will use current directory"
27
+ method_option :output, type: :string,
28
+ desc: "Set output path of csv file, if not set will use current directory"
29
+ def resolve_dependency(*)
30
+ if options[:help]
31
+ invoke :help, ['resolve-dependency']
32
+ else
33
+ require_relative 'commands/resolve/dependency'
34
+ Pod::Target::Commands::Dependency.new(options).execute
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,123 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+
5
+ module Pod
6
+ module Target
7
+ class Command
8
+ extend Forwardable
9
+
10
+ def_delegators :command, :run
11
+
12
+ # Execute this command
13
+ #
14
+ # @api public
15
+ def execute(*)
16
+ raise(
17
+ NotImplementedError,
18
+ "#{self.class}##{__method__} must be implemented"
19
+ )
20
+ end
21
+
22
+ # The external commands runner
23
+ #
24
+ # @see http://www.rubydoc.info/gems/tty-command
25
+ #
26
+ # @api public
27
+ def command(**options)
28
+ require 'tty-command'
29
+ TTY::Command.new(options)
30
+ end
31
+
32
+ # The cursor movement
33
+ #
34
+ # @see http://www.rubydoc.info/gems/tty-cursor
35
+ #
36
+ # @api public
37
+ def cursor
38
+ require 'tty-cursor'
39
+ TTY::Cursor
40
+ end
41
+
42
+ # Open a file or text in the user's preferred editor
43
+ #
44
+ # @see http://www.rubydoc.info/gems/tty-editor
45
+ #
46
+ # @api public
47
+ def editor
48
+ require 'tty-editor'
49
+ TTY::Editor
50
+ end
51
+
52
+ # File manipulation utility methods
53
+ #
54
+ # @see http://www.rubydoc.info/gems/tty-file
55
+ #
56
+ # @api public
57
+ def generator
58
+ require 'tty-file'
59
+ TTY::File
60
+ end
61
+
62
+ # Terminal output paging
63
+ #
64
+ # @see http://www.rubydoc.info/gems/tty-pager
65
+ #
66
+ # @api public
67
+ def pager(**options)
68
+ require 'tty-pager'
69
+ TTY::Pager.new(options)
70
+ end
71
+
72
+ # Terminal platform and OS properties
73
+ #
74
+ # @see http://www.rubydoc.info/gems/tty-pager
75
+ #
76
+ # @api public
77
+ def platform
78
+ require 'tty-platform'
79
+ TTY::Platform.new
80
+ end
81
+
82
+ # The interactive prompt
83
+ #
84
+ # @see http://www.rubydoc.info/gems/tty-prompt
85
+ #
86
+ # @api public
87
+ def prompt(**options)
88
+ require 'tty-prompt'
89
+ TTY::Prompt.new(options)
90
+ end
91
+
92
+ # Get terminal screen properties
93
+ #
94
+ # @see http://www.rubydoc.info/gems/tty-screen
95
+ #
96
+ # @api public
97
+ def screen
98
+ require 'tty-screen'
99
+ TTY::Screen
100
+ end
101
+
102
+ # The unix which utility
103
+ #
104
+ # @see http://www.rubydoc.info/gems/tty-which
105
+ #
106
+ # @api public
107
+ def which(*args)
108
+ require 'tty-which'
109
+ TTY::Which.which(*args)
110
+ end
111
+
112
+ # Check if executable exists
113
+ #
114
+ # @see http://www.rubydoc.info/gems/tty-which
115
+ #
116
+ # @api public
117
+ def exec_exist?(*args)
118
+ require 'tty-which'
119
+ TTY::Which.exist?(*args)
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1 @@
1
+ #
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../command'
4
+
5
+ module Pod
6
+ module Target
7
+ module Commands
8
+ class Dependency < Pod::Target::Command
9
+ require_relative './xcworkspace'
10
+ require_relative './parser'
11
+ require_relative './graph'
12
+ def initialize(options)
13
+ @options = options
14
+ end
15
+
16
+ def execute
17
+ @xcworkspace = @options[:workspace]
18
+ @xcworkspace ||= XCWorkspace.find_workspace
19
+ @output = @options[:output]
20
+ @output ||= '.'
21
+ puts "Finding targets' dependencies and resolving them..."
22
+ parse
23
+ end
24
+
25
+ def parse
26
+ parser = Parser.new(@xcworkspace)
27
+ targets = parser.all_targets
28
+ graph = Pod::Target::Commands::Graph.new
29
+ graph.add_target_info(targets)
30
+ directory = File.join(File.dirname(@output + "/remove_dependency.csv"),"/remove_dependency.csv")
31
+ File.open(directory, "w") { |f| f.write "" }
32
+ nodes = graph.nodes
33
+ nodes.each do |_, value|
34
+ level_map = {}
35
+ graph.bfs(value, level_map, 0)
36
+ removes = []
37
+ value.neighbors.each do |neighbor|
38
+ if level_map[neighbor.name] > 1
39
+ removes << neighbor.name
40
+
41
+ end
42
+ end
43
+ if removes.size > 0
44
+ File.open(directory, "a") { |f| f.write value.name }
45
+ removes.each { |name|
46
+ File.open(directory, "a") { |f|
47
+ f.write "," + name
48
+ }
49
+ }
50
+ File.open(directory, "a") { |f|
51
+ f.write "\n"
52
+ }
53
+ end
54
+ end
55
+ puts "File is write at: " + directory
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,70 @@
1
+ require 'xcodeproj'
2
+
3
+ module Pod
4
+ module Target
5
+ module Commands
6
+ class Graph
7
+ class Node
8
+ attr_accessor :name
9
+ attr_accessor :neighbors
10
+
11
+ def initialize(name)
12
+ self.name = name
13
+ self.neighbors = []
14
+ end
15
+
16
+ def add_neighbor(node)
17
+ neighbors << node
18
+ end
19
+ end
20
+
21
+ attr_accessor :nodes
22
+ def initialize
23
+ @nodes = {}
24
+ end
25
+
26
+ def add_target_info(targets)
27
+ targets.each do |target|
28
+ dependency_names = find_dependencies(target)
29
+ node = node_for_target_display_name(target.display_name)
30
+ dependency_names.each do |dependency_name|
31
+ dependency_node = node_for_target_display_name(dependency_name)
32
+ add_neighbor(node, dependency_node)
33
+ end
34
+ end
35
+ end
36
+
37
+ def find_dependencies(target)
38
+ dependencies = target.dependencies
39
+ dependencies.map { |dependency| dependency.name }.compact
40
+ end
41
+
42
+ def node_for_target_display_name(display_name)
43
+ node = nodes[display_name]
44
+ if node.nil?
45
+ node = Node.new(display_name)
46
+ nodes[display_name] = node
47
+ end
48
+ node
49
+ end
50
+
51
+ def add_neighbor(source, destination)
52
+ source.add_neighbor(destination)
53
+ end
54
+
55
+ def bfs(node, level_map, depth)
56
+ return if depth == 3
57
+ name = node.name
58
+ if level_map.key?(name)
59
+ level_map[name] = [level_map[name], depth].max
60
+ else
61
+ level_map[name] = depth
62
+ end
63
+ node.neighbors.each do |neighbor|
64
+ bfs(neighbor, level_map, depth+1)
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,27 @@
1
+ require 'xcodeproj'
2
+
3
+ module Pod
4
+ module Target
5
+ module Commands
6
+ class Parser
7
+ attr_reader :workspace, :workspace_dir, :regex
8
+ def initialize(workspace_path)
9
+ @workspace_dir = File.dirname(workspace_path)
10
+ @workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
11
+ end
12
+
13
+ def all_targets
14
+ @projects ||= projects
15
+ projects.flat_map(&:targets)
16
+ end
17
+
18
+ def projects
19
+ all_project_paths = @workspace.file_references.map(&:path)
20
+ all_project_paths.map do |project_path|
21
+ Xcodeproj::Project.open(File.expand_path(project_path, @workspace_dir))
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,14 @@
1
+ require 'xcodeproj'
2
+
3
+ module Pod
4
+ module Target
5
+ module Commands
6
+ class XCWorkspace
7
+ def self.find_workspace
8
+ `find . -name '*.xcworkspace' -maxdepth 1`.split("\n").first
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1 @@
1
+ #
@@ -0,0 +1,5 @@
1
+ module Pod
2
+ module Target
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ require_relative 'lib/pod/target/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "pod-dependency-resolve"
5
+ spec.license = "MIT"
6
+ spec.version = Pod::Target::VERSION
7
+ spec.authors = ["Bao Do"]
8
+ spec.email = ["baodo789@gmail.com"]
9
+
10
+ spec.summary = %q{"Retrive targets' dependencies and optimize them"}
11
+ spec.description = %q{"Find targets' dependencies with ease in xcode workspace and propose a way to reduce dependencies"}
12
+ spec.homepage = "https://github.com/bendoppler/podspec-dependency-resolve.git"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency 'xcodeproj', '~> 1.7'
25
+ spec.add_dependency "thor"
26
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pod-dependency-resolve
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bao Do
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-05-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: xcodeproj
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: '"Find targets'' dependencies with ease in xcode workspace and propose
42
+ a way to reduce dependencies"'
43
+ email:
44
+ - baodo789@gmail.com
45
+ executables:
46
+ - pod-target
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - ".idea/.gitignore"
52
+ - ".idea/inspectionProfiles/Project_Default.xml"
53
+ - ".idea/misc.xml"
54
+ - ".idea/modules.xml"
55
+ - ".idea/pod-target.iml"
56
+ - ".idea/vcs.xml"
57
+ - ".rspec"
58
+ - ".travis.yml"
59
+ - CODE_OF_CONDUCT.md
60
+ - Gemfile
61
+ - Gemfile.lock
62
+ - LICENSE.txt
63
+ - README.md
64
+ - Rakefile
65
+ - bin/console
66
+ - bin/setup
67
+ - exe/pod-target
68
+ - lib/pod/target.rb
69
+ - lib/pod/target/cli.rb
70
+ - lib/pod/target/command.rb
71
+ - lib/pod/target/commands/.gitkeep
72
+ - lib/pod/target/commands/resolve/dependency.rb
73
+ - lib/pod/target/commands/resolve/graph.rb
74
+ - lib/pod/target/commands/resolve/parser.rb
75
+ - lib/pod/target/commands/resolve/xcworkspace.rb
76
+ - lib/pod/target/templates/.gitkeep
77
+ - lib/pod/target/templates/resolve/dependency/.gitkeep
78
+ - lib/pod/target/version.rb
79
+ - pod-target.gemspec
80
+ homepage: https://github.com/bendoppler/podspec-dependency-resolve.git
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 2.3.0
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubygems_version: 3.1.2
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: '"Retrive targets'' dependencies and optimize them"'
103
+ test_files: []