cocoapods-mars 0.0.12

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.
@@ -0,0 +1,88 @@
1
+ module Pod
2
+ class ProjectRenamer
3
+ attr_reader :oldname
4
+ attr_reader :newname
5
+
6
+ attr_writer :processedPaths
7
+
8
+ def initialize(oldname, newname)
9
+ @oldname = oldname
10
+ @newname = newname
11
+ @processedPaths = []
12
+ end
13
+
14
+ def execute
15
+ path = Dir.pwd
16
+ puts "#{path}"
17
+ if validatePath(path)
18
+ enumeratePath(path)
19
+ else
20
+ help! "Xcode project or workspace with name: #{@oldname} is not found in current path."
21
+ end
22
+ end
23
+
24
+ private def validatePath(path)
25
+ projectPath = path + "/#{oldname}.xcodeproj"
26
+ workspace = path + "/#{oldname}.xcworkspace"
27
+ isValid = File.exist?(projectPath) || File.exist?(workspace)
28
+ return isValid
29
+ end
30
+
31
+ private def enumeratePath(path)
32
+ Dir.each_child(path) do |child|
33
+ childPath = path + "/#{child}"
34
+ if !@processedPaths.include?(childPath) && !shouldSkip(childPath)
35
+ processPath(childPath)
36
+ end
37
+ end
38
+ end
39
+
40
+ private def processPath(path)
41
+ # puts "Processing: #{path}"
42
+ if File.directory?(path)
43
+ enumeratePath(path)
44
+ elsif File.exist?(path)
45
+ updateContentsOfFile(path)
46
+ end
47
+
48
+ renameItem(path)
49
+ @processedPaths.push(path)
50
+ end
51
+
52
+ private def shouldSkip(element)
53
+ if element.include?(".DS_Store") ||
54
+ element.include?("Carthage") ||
55
+ element.include?("Pods") ||
56
+ element.include?("fastlane") ||
57
+ element.include?("build")
58
+ return true
59
+ end
60
+
61
+ extension = File.extname(element)
62
+ if extension.include?("appiconset") ||
63
+ extension.include?("json") ||
64
+ extension.include?("png") ||
65
+ extension.include?("xcuserstate")
66
+ return true
67
+ end
68
+ return false
69
+ end
70
+
71
+ private def updateContentsOfFile(path)
72
+ text = File.read(path)
73
+ text = text.gsub(oldname, newname)
74
+ File.open(path, "w") { |file| file.puts text }
75
+ end
76
+
77
+ private def renameItem(path)
78
+ oldItemName = File.basename(path)
79
+ if oldItemName.include?(oldname)
80
+ newItemName = oldItemName.gsub(oldname, newname)
81
+ directoryPath = File.dirname(path)
82
+ newPath = directoryPath + "/#{newItemName}"
83
+ File.rename(path, newPath)
84
+ # puts "--- Renamed: #{oldItemName} -> #{newItemName}"
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,38 @@
1
+ module Pod
2
+ class DemoTailor
3
+ attr_reader :components_details
4
+
5
+ attr_writer :processedPaths
6
+
7
+ def initialize(components_details)
8
+ @components_details = components_details
9
+ end
10
+
11
+ def execute
12
+ system("mkdir .vemars") unless Dir.exists? ".vemars"
13
+ system("mkdir .vemars/RedDemos")
14
+ system("mkdir .vemars/RedDemos/Base")
15
+ system("mkdir .vemars/RedDemos/Debug")
16
+ Dir.glob(Dir.pwd + "/DevPods/App/Base/Tasks/**").each do |name|
17
+ next unless Dir.exists? name
18
+ pod_name = name.split('/').last
19
+ next if pod_name == "OneKit"
20
+ next if @components_details.find {|com|
21
+ com.name == pod_name
22
+ }
23
+ system("mv #{name} #{Dir.pwd + "/.vemars/RedDemos/Base/#{pod_name}"}")
24
+ end
25
+ Dir.glob(Dir.pwd + "/DevPods/App/Debug/**").each do |name|
26
+ next unless Dir.exists? name
27
+ pod_name = name.split('/').last
28
+ next if pod_name == 'Cell' || pod_name == 'Public'
29
+
30
+ next if @components_details.find {|com|
31
+ com.name == pod_name
32
+ }
33
+ system("mv #{name} #{Dir.pwd + "/.vemars/RedDemos/Debug/#{pod_name}"}")
34
+ end
35
+ system("rm -rf .vemars/RedDemos")
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,13 @@
1
+ require 'cocoapods-vemars/gem_version'
2
+
3
+ $vemars_lib_dir ||= File.dirname(__FILE__).to_s
4
+
5
+ def vemars_require(paths = nil)
6
+ if paths.is_a?(Array)
7
+ paths.each { |path|
8
+ require File.expand_path(path.to_s, $vemars_lib_dir)
9
+ }
10
+ elsif paths.is_a?(String)
11
+ require File.expand_path(paths.to_s, $vemars_lib_dir)
12
+ end
13
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-vemars/command'
data/plugins.rb ADDED
@@ -0,0 +1 @@
1
+ require 'cocoapods-vemars'
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Vemars do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ mars }).should.be.instance_of Command::Vemars
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -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,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-mars
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.12
5
+ platform: ruby
6
+ authors:
7
+ - huangbomao@bytedance.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-30 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: 2.2.15
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.2.15
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: A short description of cocoapods-mars.
42
+ email:
43
+ - huangbomao@bytedance.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - cocoapods-vemars.gemspec
55
+ - lib/cocoapods-vemars.rb
56
+ - lib/cocoapods-vemars/command.rb
57
+ - lib/cocoapods-vemars/command/basicInfo.rb
58
+ - lib/cocoapods-vemars/command/component.rb
59
+ - lib/cocoapods-vemars/command/project.rb
60
+ - lib/cocoapods-vemars/command/vemars.rb
61
+ - lib/cocoapods-vemars/command/vemars/baselines.rb
62
+ - lib/cocoapods-vemars/command/vemars/components.rb
63
+ - lib/cocoapods-vemars/command/vemars/create.rb
64
+ - lib/cocoapods-vemars/command/vemars/patch.rb
65
+ - lib/cocoapods-vemars/gem_version.rb
66
+ - lib/cocoapods-vemars/hook/podfile.rb
67
+ - lib/cocoapods-vemars/hook/podfile_template.rb
68
+ - lib/cocoapods-vemars/services/baselines_api.rb
69
+ - lib/cocoapods-vemars/services/components_api.rb
70
+ - lib/cocoapods-vemars/services/patcher.rb
71
+ - lib/cocoapods-vemars/services/renamer.rb
72
+ - lib/cocoapods-vemars/services/tailor.rb
73
+ - lib/cocoapods_plugin.rb
74
+ - plugins.rb
75
+ - spec/command/vemars_spec.rb
76
+ - spec/spec_helper.rb
77
+ homepage: https://github.com/volcengine/ve_Template_iOS
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.0.9
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: A longer description of cocoapods-mars.
100
+ test_files:
101
+ - spec/command/vemars_spec.rb
102
+ - spec/spec_helper.rb