cocoapods-packagerthk 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,58 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Packagethk do
5
+ after do
6
+ Dir.glob("Pods").each { |dir| Pathname.new(dir).rmtree }
7
+ end
8
+
9
+ it "uses additional spec repos passed on the command line" do
10
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
11
+ nil::NilClass.any_instance.stubs(:install!)
12
+ Installer.expects(:new).with {
13
+ |sandbox, podfile| podfile.sources == ['foo', 'bar']
14
+ }
15
+
16
+ command = Command.parse(%w{ package spec/fixtures/KFData.podspec --spec-sources=foo,bar})
17
+ command.send(:install_pod, :osx, nil)
18
+
19
+ end
20
+
21
+ it "uses only the master repo if no spec repos were passed" do
22
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
23
+ nil::NilClass.any_instance.stubs(:install!)
24
+ Installer.expects(:new).with {
25
+ |sandbox, podfile| podfile.sources == ['https://github.com/CocoaPods/Specs.git']
26
+ }
27
+
28
+ command = Command.parse(%w{ package spec/fixtures/KFData.podspec })
29
+ command.send(:install_pod, :osx, nil)
30
+ end
31
+
32
+ it "creates separate static and dynamic target if dynamic is passed" do
33
+ source_dir = Dir.pwd
34
+
35
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
36
+
37
+ command = Command.parse(%w{ package spec/fixtures/NikeKit.podspec -dynamic})
38
+ t, w = command.send(:create_working_directory)
39
+
40
+ command.config.installation_root = Pathname.new(w)
41
+ command.config.sandbox_root = 'Pods'
42
+
43
+ static_sandbox = command.send(:build_static_sandbox, true)
44
+ static_installer = command.send(:install_pod, :ios, static_sandbox)
45
+
46
+ dynamic_sandbox = command.send(:build_dynamic_sandbox, static_sandbox, static_installer)
47
+ command.send(:install_dynamic_pod, dynamic_sandbox, static_sandbox, static_installer, Platform.ios)
48
+
49
+ static_sandbox_dir = Dir.new(Dir.pwd << "/Pods/Static")
50
+ dynamic_sandbox_dir = Dir.new(Dir.pwd << "/Pods/Dynamic")
51
+
52
+ static_sandbox_dir.to_s.should.not.be.empty
53
+ dynamic_sandbox_dir.to_s.should.not.be.empty
54
+
55
+ Dir.chdir(source_dir)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,62 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Builder do
5
+ describe 'In general' do
6
+ before do
7
+ @spec = Specification.from_file('spec/fixtures/Builder.podspec')
8
+ @static_sandbox_dir = temporary_directory + 'Pods'
9
+ @installer = stub('Installer', :pod_targets => [])
10
+ @builder = Builder.new(Platform.new(:ios), @installer, nil, @static_sandbox_dir, nil, nil, @spec, nil, nil, nil, nil, nil, nil)
11
+ end
12
+
13
+ it 'copies the license file if it exists' do
14
+ path = @static_sandbox_dir + 'Builder/LICENSE.md'
15
+ path.dirname.mkpath
16
+ File.open(path, 'w') { |f| f.puts 'Permission is granted...' }
17
+ @spec.stubs(:license).returns({ :file => 'LICENSE.md'})
18
+ FileUtils.expects(:cp).with(path, '.')
19
+ @builder.send(:copy_license)
20
+ FileUtils.rm_rf(path.dirname)
21
+ end
22
+ end
23
+
24
+ describe 'Xcodebuild command' do
25
+ describe 'compiler flags' do
26
+ before do
27
+ @spec = Specification.from_file('spec/fixtures/Builder.podspec')
28
+ @installer = stub('Installer', :pod_targets => [])
29
+ end
30
+
31
+ it "includes proper compiler flags for iOS" do
32
+ @builder = Builder.new(Platform.new(:ios), @installer, nil, nil, nil, nil, @spec, nil, nil, nil, nil, nil, nil)
33
+ @builder.expects(:xcodebuild).with("GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_Builder=PodsDummy_PodPackage_Builder' -DBASE_FLAG -DIOS_FLAG", "ARCHS='x86_64 i386 arm64 armv7 armv7s' OTHER_CFLAGS='-fembed-bitcode -Qunused-arguments'").returns(nil)
34
+ @builder.send(:compile)
35
+ end
36
+
37
+ it "includes proper compiler flags for OSX" do
38
+ @builder = Builder.new(Platform.new(:osx), @installer, nil, nil, nil, nil, @spec, nil, nil, nil, nil, nil, nil)
39
+ @builder.expects(:xcodebuild).with("GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_Builder=PodsDummy_PodPackage_Builder' -DBASE_FLAG -DOSX_FLAG", nil).returns(nil)
40
+ @builder.send(:compile)
41
+ end
42
+ end
43
+
44
+ describe 'on build failure' do
45
+ before do
46
+ @spec = Specification.from_file('spec/fixtures/Builder.podspec')
47
+ @installer = stub('Installer', :pod_targets => [])
48
+ @builder = Builder.new(Platform.new(:ios), @installer, nil, nil, nil, nil, @spec, nil, nil, nil, nil, nil, nil)
49
+ end
50
+
51
+ it 'dumps report and terminates' do
52
+ UI::BuildFailedReport.expects(:report).returns(nil)
53
+
54
+ should.raise SystemExit do
55
+ # TODO: check that it dumps report
56
+ @builder.send(:compile)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,61 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe SpecBuilder do
5
+ def compare_attributes(first_spec, second_spec, attribute_name)
6
+ first_spec.attributes_hash[attribute_name].should ==
7
+ second_spec.attributes_hash[attribute_name]
8
+
9
+ %w(ios osx).each do |platform|
10
+ first_spec.attributes_hash[platform][attribute_name].should ==
11
+ second_spec.attributes_hash[platform][attribute_name]
12
+ end
13
+ end
14
+
15
+ def specification_from_builder(builder)
16
+ spec_string = builder.spec_metadata
17
+ spec_string += builder.spec_platform(Platform.ios)
18
+ spec_string += builder.spec_platform(Platform.osx)
19
+ spec_string += builder.spec_close
20
+
21
+ return Specification.from_string(spec_string, 'Builder.podspec')
22
+ end
23
+
24
+ describe 'Preserve attributes from source specification' do
25
+ before do
26
+ @spec = Specification.from_file('spec/fixtures/Builder.podspec')
27
+ @builder = SpecBuilder.new(@spec, nil, false, nil)
28
+ end
29
+
30
+ it "preserves platform.frameworks" do
31
+ spec = specification_from_builder(@builder)
32
+ compare_attributes(spec, @spec, 'frameworks')
33
+ end
34
+
35
+ it "preserves platform.weak_frameworks" do
36
+ spec = specification_from_builder(@builder)
37
+ compare_attributes(spec, @spec, 'weak_frameworks')
38
+ end
39
+
40
+ it "preserves platform.libraries" do
41
+ spec = specification_from_builder(@builder)
42
+ compare_attributes(spec, @spec, 'libraries')
43
+ end
44
+
45
+ it "preserves platform.requires_arc" do
46
+ spec = specification_from_builder(@builder)
47
+ compare_attributes(spec, @spec, 'requires_arc')
48
+ end
49
+
50
+ it "preserves platform.deployment_target" do
51
+ spec = specification_from_builder(@builder)
52
+ compare_attributes(spec, @spec, 'deployment_target')
53
+ end
54
+
55
+ it "preserves platform.xcconfig" do
56
+ spec = specification_from_builder(@builder)
57
+ compare_attributes(spec, @spec, 'xcconfig')
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ module UserInterface
5
+ describe BuildFailedReport do
6
+ it 'should format a report correctly' do
7
+ UI::BuildFailedReport.report('a', ['b']).should == "Build command failed: a\nOutput:\n b\n"
8
+ end
9
+ end
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-packagerthk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joe.cheng
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-03-20 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: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
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-packagerthk.
42
+ email:
43
+ - joe.cheng@corp.to8to.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".vscode/launch.json"
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - cocoapods-packagerthk.gemspec
56
+ - lib/cocoapods-packagerthk.rb
57
+ - lib/cocoapods-packagerthk/builder.rb
58
+ - lib/cocoapods-packagerthk/command.rb
59
+ - lib/cocoapods-packagerthk/framework.rb
60
+ - lib/cocoapods-packagerthk/gem_version.rb
61
+ - lib/cocoapods-packagerthk/mangle.rb
62
+ - lib/cocoapods-packagerthk/pod_utils.rb
63
+ - lib/cocoapods-packagerthk/spec_builder.rb
64
+ - lib/cocoapods-packagerthk/symbols.rb
65
+ - lib/cocoapods-packagerthk/user_interface/build_failed_report.rb
66
+ - lib/cocoapods_plugin.rb
67
+ - lib/pod/command/packagethk.rb
68
+ - spec/command/error_spec.rb
69
+ - spec/command/packagerthk_spec.rb
70
+ - spec/command/subspecs_spec.rb
71
+ - spec/integration/project_spec.rb
72
+ - spec/spec_helper.rb
73
+ - spec/unit/pod/utils_spec.rb
74
+ - spec/unit/specification/builder_spec.rb
75
+ - spec/unit/specification/spec_builder_spec.rb
76
+ - spec/unit/user_interface/build_failed_report_spec.rb
77
+ homepage: https://github.com/chengzongxin/cocoapods-packagerthk
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.4.7
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: A longer description of cocoapods-packagerthk.
100
+ test_files:
101
+ - spec/command/error_spec.rb
102
+ - spec/command/packagerthk_spec.rb
103
+ - spec/command/subspecs_spec.rb
104
+ - spec/integration/project_spec.rb
105
+ - spec/spec_helper.rb
106
+ - spec/unit/pod/utils_spec.rb
107
+ - spec/unit/specification/builder_spec.rb
108
+ - spec/unit/specification/spec_builder_spec.rb
109
+ - spec/unit/user_interface/build_failed_report_spec.rb