cocoapods-acknowledgements 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dea90b6cc9946925808971560e4e4748f40c709d1ab31f19d6d1c3fdeeb6ee84
4
- data.tar.gz: 59db6e539ddb3bd7e3956c3dd505c85f039a26b94042309b2637ca92f0e47472
3
+ metadata.gz: 0f75510ee94aabecc1ad7344e4f06d1f48137321fc153b970ec73c3c4bf68d81
4
+ data.tar.gz: f032430ac9827e8dbb6753c2e415d860992c213850c7a2ee38178297a5104594
5
5
  SHA512:
6
- metadata.gz: 8e4b19c4eb23677ebe75d919e24cae38b2bb029b64120ee7092e6799a255dacebbf47fe035ac69d7aed58e97e1040f50627feb6ad85d7ddeeb152bb3dc4cf570
7
- data.tar.gz: c65a59d01d3337e5dcec5729d1dd855c098584d3c342503ea9a1ef534b1f9d97edfc50c5866331c9b274ecd194e8c51f69dc47526eb5b95f37add8a25afdbe9b
6
+ metadata.gz: 7df979610134e829e971ed8ecd92ac7bfcac68b9dd70b9995a64c3ecafa8b54baee1ff0e514d87d5f8adaddd1abc7e1a27b8b681c366e9c2208870cd3a8bcfaf
7
+ data.tar.gz: 1ad0eb6bcbd3f6472851c9990dfbee26cd22e7d9e6de9507a8f6d97fa40a4e82522872675119d1f0224b6b9263b1e52f3f98c1edee9e363136bca8732f0b6e2e
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
@@ -1,5 +1,30 @@
1
1
  # CocoaPods Acknowledgements Changelog
2
2
 
3
+ ## 1.2.0 (2020-03-23)
4
+
5
+ ##### Enhancements
6
+
7
+ * Update internal gem dependencies to latest versions
8
+ [Olivier Halligon](https://github.com/AliSoftware)
9
+ [#56](https://github.com/CocoaPods/cocoapods-acknowledgements/pull/56)
10
+
11
+ * Add `targets` options to specify targets to add metadata
12
+ [Richard Lee](https://github.com/dlackty)
13
+ [#46](https://github.com/CocoaPods/cocoapods-acknowledgements/issues/46)
14
+
15
+ * Improve the performance of metadata generation
16
+ [Eric Amorde](https://github.com/amorde)
17
+ [#54](https://github.com/CocoaPods/cocoapods-acknowledgements/pull/54)
18
+
19
+ * Add tests
20
+ [Eric Amorde](https://github.com/amorde)
21
+ [#1](https://github.com/CocoaPods/cocoapods-acknowledgements/issues/1)
22
+
23
+ ##### Bug Fixes
24
+
25
+ * None.
26
+
27
+
3
28
  ## 1.1.3 (2018-04-04)
4
29
 
5
30
  ##### Enhancements
@@ -0,0 +1,115 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cocoapods-acknowledgements (1.2.0)
5
+ activesupport (>= 4.0.2, < 5)
6
+ redcarpet (~> 3.3)
7
+ xcodeproj
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ CFPropertyList (3.0.2)
13
+ activesupport (4.2.11.1)
14
+ i18n (~> 0.7)
15
+ minitest (~> 5.1)
16
+ thread_safe (~> 0.3, >= 0.3.4)
17
+ tzinfo (~> 1.1)
18
+ algoliasearch (1.27.1)
19
+ httpclient (~> 2.8, >= 2.8.3)
20
+ json (>= 1.5.1)
21
+ atomos (0.1.3)
22
+ bacon (1.2.0)
23
+ claide (1.0.3)
24
+ cocoapods (1.9.1)
25
+ activesupport (>= 4.0.2, < 5)
26
+ claide (>= 1.0.2, < 2.0)
27
+ cocoapods-core (= 1.9.1)
28
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
29
+ cocoapods-downloader (>= 1.2.2, < 2.0)
30
+ cocoapods-plugins (>= 1.0.0, < 2.0)
31
+ cocoapods-search (>= 1.0.0, < 2.0)
32
+ cocoapods-stats (>= 1.0.0, < 2.0)
33
+ cocoapods-trunk (>= 1.4.0, < 2.0)
34
+ cocoapods-try (>= 1.1.0, < 2.0)
35
+ colored2 (~> 3.1)
36
+ escape (~> 0.0.4)
37
+ fourflusher (>= 2.3.0, < 3.0)
38
+ gh_inspector (~> 1.0)
39
+ molinillo (~> 0.6.6)
40
+ nap (~> 1.0)
41
+ ruby-macho (~> 1.4)
42
+ xcodeproj (>= 1.14.0, < 2.0)
43
+ cocoapods-core (1.9.1)
44
+ activesupport (>= 4.0.2, < 6)
45
+ algoliasearch (~> 1.0)
46
+ concurrent-ruby (~> 1.1)
47
+ fuzzy_match (~> 2.0.4)
48
+ nap (~> 1.0)
49
+ netrc (~> 0.11)
50
+ typhoeus (~> 1.0)
51
+ cocoapods-deintegrate (1.0.4)
52
+ cocoapods-downloader (1.3.0)
53
+ cocoapods-plugins (1.0.0)
54
+ nap
55
+ cocoapods-search (1.0.0)
56
+ cocoapods-stats (1.1.0)
57
+ cocoapods-trunk (1.4.1)
58
+ nap (>= 0.8, < 2.0)
59
+ netrc (~> 0.11)
60
+ cocoapods-try (1.1.0)
61
+ colored2 (3.1.2)
62
+ concurrent-ruby (1.1.6)
63
+ escape (0.0.4)
64
+ ethon (0.12.0)
65
+ ffi (>= 1.3.0)
66
+ ffi (1.12.2)
67
+ fourflusher (2.3.1)
68
+ fuzzy_match (2.0.4)
69
+ gh_inspector (1.1.3)
70
+ httpclient (2.8.3)
71
+ i18n (0.9.5)
72
+ concurrent-ruby (~> 1.0)
73
+ json (2.3.0)
74
+ metaclass (0.0.4)
75
+ minitest (5.14.0)
76
+ mocha (0.11.4)
77
+ metaclass (~> 0.0.1)
78
+ mocha-on-bacon (0.2.1)
79
+ mocha (>= 0.9.8)
80
+ molinillo (0.6.6)
81
+ nanaimo (0.2.6)
82
+ nap (1.1.0)
83
+ netrc (0.11.0)
84
+ prettybacon (0.0.2)
85
+ bacon (~> 1.2)
86
+ rake (13.0.1)
87
+ redcarpet (3.5.0)
88
+ ruby-macho (1.4.0)
89
+ thread_safe (0.3.6)
90
+ typhoeus (1.3.1)
91
+ ethon (>= 0.9.0)
92
+ tzinfo (1.2.6)
93
+ thread_safe (~> 0.1)
94
+ xcodeproj (1.15.0)
95
+ CFPropertyList (>= 2.3.3, < 4.0)
96
+ atomos (~> 0.1.3)
97
+ claide (>= 1.0.2, < 2.0)
98
+ colored2 (~> 3.1)
99
+ nanaimo (~> 0.2.6)
100
+
101
+ PLATFORMS
102
+ ruby
103
+
104
+ DEPENDENCIES
105
+ bacon
106
+ bundler (~> 2.0)
107
+ cocoapods
108
+ cocoapods-acknowledgements!
109
+ mocha (~> 0.11.4)
110
+ mocha-on-bacon
111
+ prettybacon
112
+ rake
113
+
114
+ BUNDLED WITH
115
+ 2.0.2
data/README.md CHANGED
@@ -35,7 +35,7 @@ plugin 'cocoapods-acknowledgements', :settings_bundle => true , :settings_post_p
35
35
 
36
36
  The plugin will search through your project files to find a `Settings.bundle` file, and add the file to the bundle. If this is not enough for you, we'd love a PR.
37
37
 
38
- You can also exclude some dependencies so they won't be added to the generated plists. This is useful when you don't want to add private dependencies.
38
+ You can exclude some dependencies so they won't be added to the generated plists. This is useful when you don't want to add private dependencies.
39
39
 
40
40
  ```ruby
41
41
  plugin 'cocoapods-acknowledgements', :settings_bundle => true, :exclude => 'PrivateKit'
@@ -43,6 +43,12 @@ plugin 'cocoapods-acknowledgements', :settings_bundle => true, :exclude => 'Priv
43
43
  plugin 'cocoapods-acknowledgements', :settings_bundle => true, :exclude => ['PrivateKit', 'SecretLib']
44
44
  ```
45
45
 
46
+ You can also specify a list of targets for which to generate acknowledgements. This can be useful to exclude test or extension targets.
47
+
48
+ ``` ruby
49
+ plugin 'cocoapods-acknowledgements', :targets => ['MyApp']
50
+ ```
51
+
46
52
  ### Location
47
53
 
48
54
  The plist generated by this plugin is located under the root of your ```Pods``` directory.
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_runtime_dependency 'activesupport', '>= 4.0.2', '< 5'
21
21
 
22
22
  spec.add_dependency "redcarpet", "~> 3.3"
23
- spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_dependency "xcodeproj"
24
+ spec.add_development_dependency "bundler", "~> 2.0"
24
25
  spec.add_development_dependency "rake"
25
26
  end
@@ -29,7 +29,6 @@ module CocoaPodsAcknowledgements
29
29
  end
30
30
 
31
31
  project.save
32
-
33
32
  end
34
33
 
35
34
  def self.settings_bundle_in_project(project)
@@ -51,8 +50,9 @@ module CocoaPodsAcknowledgements
51
50
 
52
51
  Pod::UI.section 'Adding Acknowledgements' do
53
52
 
54
- should_include_settings = user_options["settings_bundle"] != nil
53
+ should_include_settings = user_options["settings_bundle"]
55
54
  excluded_pods = Set.new(user_options["exclude"])
55
+ targets = Set.new(user_options["targets"])
56
56
 
57
57
  sandbox = context.sandbox if defined? context.sandbox
58
58
  sandbox ||= Pod::Sandbox.new(context.sandbox_root)
@@ -60,44 +60,46 @@ module CocoaPodsAcknowledgements
60
60
  context.umbrella_targets.each do |umbrella_target|
61
61
  project = Xcodeproj::Project.open(umbrella_target.user_project_path)
62
62
 
63
- umbrella_target.user_target_uuids.each do |user_target_uuid|
64
-
65
- # Generate a plist representing all of the podspecs
66
- metadata = PlistGenerator.generate(umbrella_target, sandbox, excluded_pods)
67
-
68
- next unless metadata
69
-
70
- plist_path = sandbox.root + "#{umbrella_target.cocoapods_target_label}-metadata.plist"
71
- save_metadata(metadata, plist_path, project, sandbox, user_target_uuid)
72
-
73
- if should_include_settings
63
+ # Generate a plist representing all of the podspecs
64
+ metadata = PlistGenerator.generate(umbrella_target, sandbox, excluded_pods)
65
+ next unless metadata
66
+
67
+ if should_include_settings
68
+ # We need to look for a Settings.bundle
69
+ # and add this to the root of the bundle
70
+ settings_bundle = settings_bundle_in_project(project)
71
+ if settings_bundle == nil
72
+ Pod::UI.warn "Could not find a Settings.bundle to add the Pod Settings Plist to."
73
+ else
74
74
  # Generate a plist in Settings format
75
75
  settings_metadata = SettingsPlistGenerator.generate(umbrella_target, sandbox, excluded_pods)
76
+ settings_plist_path = settings_bundle + "/#{umbrella_target.cocoapods_target_label}-settings-metadata.plist"
77
+ end
78
+ end
76
79
 
77
- # We need to look for a Settings.bundle
78
- # and add this to the root of the bundle
80
+ plist_path = sandbox.root + "#{umbrella_target.cocoapods_target_label}-metadata.plist"
79
81
 
80
- settings_bundle = settings_bundle_in_project(project)
81
- if settings_bundle == nil
82
- Pod::UI.warn "Could not find a Settings.bundle to add the Pod Settings Plist to."
83
- else
84
- settings_plist_path = settings_bundle + "/#{umbrella_target.cocoapods_target_label}-settings-metadata.plist"
85
- save_metadata(settings_metadata, settings_plist_path, project, sandbox, user_target_uuid)
86
- Pod::UI.info "Added Pod info to Settings.bundle for target #{umbrella_target.cocoapods_target_label}"
82
+ user_target_uuids = if targets.empty?
83
+ umbrella_target.user_target_uuids
84
+ else
85
+ umbrella_target.user_targets.select do |target|
86
+ targets.include?(target.name)
87
+ end.map(&:uuid)
88
+ end
87
89
 
88
- # Support a callback for the key :settings_post_process
89
- if user_options["settings_post_process"]
90
- user_options["settings_post_process"].call(settings_plist_path, umbrella_target, excluded_pods)
91
- end
90
+ user_target_uuids.each do |user_target_uuid|
91
+ save_metadata(metadata, plist_path, project, sandbox, user_target_uuid)
92
92
 
93
+ if settings_metadata && settings_plist_path
94
+ save_metadata(settings_metadata, settings_plist_path, project, sandbox, user_target_uuid)
95
+ Pod::UI.info "Added Pod info to Settings.bundle for target #{umbrella_target.cocoapods_target_label}"
96
+ # Support a callback for the key :settings_post_process
97
+ if user_options["settings_post_process"]
98
+ user_options["settings_post_process"].call(settings_plist_path, umbrella_target, excluded_pods)
93
99
  end
94
100
  end
95
-
96
101
  end
97
-
98
102
  end
99
-
100
103
  end
101
-
102
104
  end
103
105
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'redcarpet'
2
3
 
3
4
  module CocoaPodsAcknowledgements
@@ -13,14 +14,12 @@ module CocoaPodsAcknowledgements
13
14
 
14
15
  return nil if root_specs.empty?
15
16
 
16
- specs_metadata = []
17
- root_specs.each do |spec|
18
- pod_root = sandbox.pod_dir(spec.name)
17
+ specs_metadata = root_specs.map do |spec|
19
18
  platform = Pod::Platform.new(target_description.platform_name)
20
19
  file_accessor = file_accessor(spec, platform, sandbox)
21
20
  license_text = license_text(spec, file_accessor)
22
21
 
23
- spec_metadata = {
22
+ {
24
23
  "name" => spec.name,
25
24
  "version" => spec.version,
26
25
  "authors" => spec.authors,
@@ -31,12 +30,11 @@ module CocoaPodsAcknowledgements
31
30
  "licenseText" => license_text,
32
31
  "homepage" => spec.homepage,
33
32
  }
34
- specs_metadata << spec_metadata
35
33
  end
36
34
 
37
- metadata = {}
38
- metadata["specs"] = specs_metadata
39
- metadata
35
+ {
36
+ "specs" => specs_metadata
37
+ }
40
38
  end
41
39
 
42
40
  #-----------------------------------------------------------------------#
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cocoapods_acknowledgements/plist_generator'
2
3
 
3
4
  module CocoaPodsAcknowledgements
@@ -12,7 +13,6 @@ module CocoaPodsAcknowledgements
12
13
  specs_metadata = [header]
13
14
 
14
15
  root_specs.each do |spec|
15
- pod_root = sandbox.pod_dir(spec.name)
16
16
  platform = Pod::Platform.new(target_description.platform_name)
17
17
  file_accessor = file_accessor(spec, platform, sandbox)
18
18
  license_text = license_text(spec, file_accessor)
@@ -26,7 +26,7 @@ module CocoaPodsAcknowledgements
26
26
  end
27
27
 
28
28
  specs_metadata << footer
29
- metadata = {
29
+ {
30
30
  "PreferenceSpecifiers" => specs_metadata,
31
31
  "Title" => "Acknowledgements",
32
32
  "StringsTable" => "Acknowledgements"
@@ -34,7 +34,7 @@ module CocoaPodsAcknowledgements
34
34
  end
35
35
 
36
36
  def header
37
- header = {
37
+ {
38
38
  "FooterText" => "This application makes use of the following third party libraries:",
39
39
  "Title" => "Acknowledgements",
40
40
  "Type" => "PSGroupSpecifier"
@@ -42,8 +42,8 @@ module CocoaPodsAcknowledgements
42
42
  end
43
43
 
44
44
  def footer
45
- footer = {
46
- "FooterText" => "Generated by CocoaPods - http://cocoapods.org",
45
+ {
46
+ "FooterText" => "Generated by CocoaPods - https://cocoapods.org",
47
47
  "Title" => nil,
48
48
  "Type" => "PSGroupSpecifier"
49
49
  }
@@ -1,3 +1,3 @@
1
1
  module CocoaPodsAcknowledgements
2
- VERSION = "1.1.3"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -1,5 +1,155 @@
1
1
  require File.expand_path('../spec_helper.rb', __FILE__)
2
+ require 'xcodeproj'
2
3
 
3
4
  describe CocoaPodsAcknowledgements do
4
5
 
6
+ UmbrellaTargetDescription = Pod::Installer::PostInstallHooksContext::UmbrellaTargetDescription
7
+
8
+ before do
9
+ @project_path = SpecHelper.temporary_directory + 'project.xcodeproj'
10
+ @project = Xcodeproj::Project.new(@project_path)
11
+ @project.initialize_from_scratch
12
+ @sandbox = temporary_sandbox
13
+ @spec1 = SpecHelper.spec1
14
+ @spec2 = SpecHelper.spec2
15
+
16
+ @settings_plist_content = {
17
+ 'Title' => 'Acknowledgements',
18
+ 'StringsTable' => 'Acknowledgements',
19
+ 'PreferenceSpecifiers' => [
20
+ {
21
+ 'Title' => 'Acknowledgements',
22
+ 'Type' => 'PSGroupSpecifier',
23
+ 'FooterText' => 'This application makes use of the following third party libraries:'
24
+ },
25
+ {
26
+ 'Title' => 'monkeylib',
27
+ 'Type' => 'PSGroupSpecifier',
28
+ 'FooterText' => 'Permission is hereby granted ...'
29
+ },
30
+ {
31
+ 'Title' => 'BananaLib',
32
+ 'Type' => 'PSGroupSpecifier',
33
+ 'FooterText' => 'Permission is hereby granted ...'
34
+ },
35
+ {
36
+ 'Title' => nil,
37
+ 'Type' => 'PSGroupSpecifier',
38
+ 'FooterText' => 'Generated by CocoaPods - https://cocoapods.org'
39
+ },
40
+ ]
41
+ }
42
+ @plist_content = {
43
+ "specs" => [
44
+ {
45
+ "name" => "monkeylib",
46
+ "version"=> Pod::Version.new(1.0),
47
+ "authors"=> {
48
+ "CocoaPods" => "email@cocoapods.org"
49
+ },
50
+ "socialMediaURL" => "https://twitter.com/CocoaPods",
51
+ "summary" => "A lib to do monkey things",
52
+ "description" => "<h2>What is it</h2>\n\n<p>A lib to do monkey things</p>\n\n<h2>Why?</h2>\n\n<p>Why not?</p>\n",
53
+ "licenseType" => "MIT",
54
+ "licenseText" => "Permission is hereby granted ...",
55
+ "homepage" => "https://github.com/CocoaPods/monkeylib"
56
+ },
57
+ {
58
+ "name" => "BananaLib",
59
+ "version" => Pod::Version.new(1.0),
60
+ "authors" => {
61
+ "Banana Corp" => nil,
62
+ "Monkey Boy" => "monkey@banana-corp.local"
63
+ },
64
+ "socialMediaURL" => nil,
65
+ "summary" => "Chunky bananas!",
66
+ "description" => "<p>Full of chunky bananas.</p>\n",
67
+ "licenseType" => "MIT",
68
+ "licenseText" => "Permission is hereby granted ...",
69
+ "homepage" => "http://banana-corp.local/banana-lib.html"
70
+ }
71
+ ]
72
+ }
73
+
74
+ @target = @project.new_target(:application, 'MyApp', :ios)
75
+ @plist_path = @sandbox.root + 'Pods-MyApp-metadata.plist'
76
+ @project.save
77
+ end
78
+
79
+ after do
80
+ FileUtils.rm_rf(SpecHelper.temporary_directory)
81
+ end
82
+
83
+ describe 'In general' do
84
+ it 'finds existing settings bundles' do
85
+ settings_bundle = SpecHelper.temporary_directory + 'Settings.bundle'
86
+ FileUtils.mkdir(settings_bundle)
87
+ resource_group = @project.main_group.new_group('Resources')
88
+ resource_group.new_file(settings_bundle)
89
+
90
+ result = CocoaPodsAcknowledgements.settings_bundle_in_project(@project)
91
+ result.to_s.should == settings_bundle.to_s
92
+ FileUtils.rm_rf(settings_bundle)
93
+ end
94
+ end
95
+
96
+ describe '#save_metadata' do
97
+ it 'saves the metadata to disk' do
98
+ Xcodeproj::Plist.expects(:write_to_path).with(@plist_content, @plist_path).once
99
+ CocoaPodsAcknowledgements.save_metadata(@plist_content, @plist_path, @project, @sandbox, @target.uuid)
100
+ end
101
+
102
+ it 'adds the Pods group if not already existing' do
103
+ @project.main_group["Pods"].should.be.nil?
104
+ CocoaPodsAcknowledgements.save_metadata(@plist_content, @plist_path, @project, @sandbox, @target.uuid)
105
+ @project.main_group["Pods"].should.not.be.nil?
106
+ end
107
+
108
+ it 'adds the plist to the Pods group' do
109
+ CocoaPodsAcknowledgements.save_metadata(@plist_content, @plist_path, @project, @sandbox, @target.uuid)
110
+ @project.main_group["Pods"].files.find { |f| f.path == 'Pods-MyApp-metadata.plist' }.should.not.be.nil?
111
+ end
112
+
113
+ it 'adds the plist to user target Copy Resources build phase' do
114
+ CocoaPodsAcknowledgements.save_metadata(@plist_content, @plist_path, @project, @sandbox, @target.uuid)
115
+ file_ref = @project.main_group["Pods"].files.find { |f| f.path == 'Pods-MyApp-metadata.plist' }
116
+ file_ref.should.not.be.nil?
117
+
118
+ @target.resources_build_phase.files.find { |f| f.file_ref == file_ref }.should.not.be.nil?
119
+ end
120
+ end
121
+
122
+ describe 'plugin-hook' do
123
+ before do
124
+ @target_description = UmbrellaTargetDescription.new(@project, [@target], [@spec1, @spec2], :ios, '8.0', 'Pods-MyApp')
125
+ @hook_context = Pod::Installer::PostInstallHooksContext.new(@sandbox, @sandbox.root, nil, [@target_description])
126
+ Xcodeproj::Project.stubs(:open).returns(@project)
127
+ end
128
+
129
+ it 'generates acknowledgement plists' do
130
+ CocoaPodsAcknowledgements.expects(:save_metadata).with(@plist_content, @plist_path, @project, @sandbox, @target.uuid)
131
+ Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-acknowledgements' => {}})
132
+ end
133
+
134
+ it 'generates a settings plist when specified' do
135
+ settings_bundle = SpecHelper.temporary_directory + 'Settings.bundle'
136
+ settings_plist_path = settings_bundle + 'Pods-MyApp-settings-metadata.plist'
137
+ FileUtils.mkdir(settings_bundle)
138
+ resource_group = @project.main_group.new_group('Resources')
139
+ resource_group.new_file(settings_bundle)
140
+
141
+ CocoaPodsAcknowledgements.expects(:save_metadata).with(@plist_content, @plist_path, @project, @sandbox, @target.uuid).once
142
+ CocoaPodsAcknowledgements.expects(:save_metadata).with(@settings_plist_content, settings_plist_path.to_s, @project, @sandbox, @target.uuid).once
143
+ Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-acknowledgements' => { :settings_bundle => true }})
144
+ FileUtils.rm_rf(settings_bundle)
145
+ end
146
+
147
+ it "generates acknowledgement plists to only specified targets" do
148
+ CocoaPodsAcknowledgements.expects(:save_metadata).with(@plist_content, @plist_path, @project, @sandbox, @target.uuid).once
149
+ Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-acknowledgements' => { targets: ['MyApp'] }})
150
+
151
+ CocoaPodsAcknowledgements.expects(:save_metadata).never
152
+ Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-acknowledgements' => { targets: ['TheOtherTarget'] }})
153
+ end
154
+ end
5
155
  end
@@ -1,5 +1,142 @@
1
1
  require File.expand_path('../spec_helper.rb', __FILE__)
2
2
 
3
- describe CocoaPodsAcknowledgements::PlistGenerator do
3
+ describe PlistGenerator = CocoaPodsAcknowledgements::PlistGenerator do
4
4
 
5
+ before do
6
+ @spec1 = SpecHelper.spec1
7
+ @spec2 = SpecHelper.spec2
8
+ PlistGenerator.stubs(:file_accessor).returns(nil)
9
+ @sandbox = temporary_sandbox
10
+ @target_description = stub('target_description',
11
+ :specs => [@spec1, @spec2],
12
+ :platform_name => 'ios')
13
+ end
14
+
15
+ describe 'In general' do
16
+ it 'generates metadata' do
17
+ result = PlistGenerator.generate(@target_description, @sandbox, [])
18
+ result.should == {
19
+ "specs" => [
20
+ {
21
+ "name" => "monkeylib",
22
+ "version"=> Pod::Version.new(1.0),
23
+ "authors"=> {
24
+ "CocoaPods" => "email@cocoapods.org"
25
+ },
26
+ "socialMediaURL" => "https://twitter.com/CocoaPods",
27
+ "summary" => "A lib to do monkey things",
28
+ "description" => "<h2>What is it</h2>\n\n<p>A lib to do monkey things</p>\n\n<h2>Why?</h2>\n\n<p>Why not?</p>\n",
29
+ "licenseType" => "MIT",
30
+ "licenseText" => "Permission is hereby granted ...",
31
+ "homepage" => "https://github.com/CocoaPods/monkeylib"
32
+ },
33
+ {
34
+ "name" => "BananaLib",
35
+ "version" => Pod::Version.new(1.0),
36
+ "authors" => {
37
+ "Banana Corp" => nil,
38
+ "Monkey Boy" => "monkey@banana-corp.local"
39
+ },
40
+ "socialMediaURL" => nil,
41
+ "summary" => "Chunky bananas!",
42
+ "description" => "<p>Full of chunky bananas.</p>\n",
43
+ "licenseType" => "MIT",
44
+ "licenseText" => "Permission is hereby granted ...",
45
+ "homepage" => "http://banana-corp.local/banana-lib.html"
46
+ }
47
+ ]
48
+ }
49
+ end
50
+
51
+ it 'generates nil if specs is empty' do
52
+ target_description = stub('target_description',
53
+ :specs => [],
54
+ :platform_name => 'ios')
55
+ result = PlistGenerator.generate(target_description, @sandbox, [])
56
+ result.should.be.nil?
57
+ end
58
+
59
+ it 'does not include metadata for excluded specs' do
60
+ target_description = stub('target_description',
61
+ :specs => [@spec1, @spec2],
62
+ :platform_name => 'ios')
63
+ result = PlistGenerator.generate(target_description, @sandbox, [@spec1.name])
64
+ result.should == {
65
+ "specs" => [
66
+ {
67
+ "name" => "BananaLib",
68
+ "version" => Pod::Version.new(1.0),
69
+ "authors" => {
70
+ "Banana Corp" => nil,
71
+ "Monkey Boy" => "monkey@banana-corp.local"
72
+ },
73
+ "socialMediaURL" => nil,
74
+ "summary" => "Chunky bananas!",
75
+ "description" => "<p>Full of chunky bananas.</p>\n",
76
+ "licenseType" => "MIT",
77
+ "licenseText" => "Permission is hereby granted ...",
78
+ "homepage" => "http://banana-corp.local/banana-lib.html"
79
+ }
80
+ ]
81
+ }
82
+ end
83
+
84
+ it 'generates nil when all specs are excluded' do
85
+ target_description = stub('target_description',
86
+ :specs => [@spec1, @spec2],
87
+ :platform_name => 'ios')
88
+ result = PlistGenerator.generate(target_description, @sandbox, [@spec1.name, @spec2.name])
89
+ result.should.be.nil?
90
+ end
91
+
92
+ describe '#license_text' do
93
+ it 'returns nil if license is missing' do
94
+ spec = stub('spec', :license => nil)
95
+ result = PlistGenerator.license_text(spec, nil)
96
+ result.should.be.nil?
97
+ end
98
+
99
+ it 'returns text if specified' do
100
+ spec = stub('spec', :license => { :text => 'Permission is hereby granted ...'})
101
+ result = PlistGenerator.license_text(spec, nil)
102
+ result.should == 'Permission is hereby granted ...'
103
+ end
104
+
105
+ it 'reads license files when specified' do
106
+ license_file = SpecHelper.temporary_directory + 'LICENSE'
107
+ license_file.open('w') { |f| f.write("Permission is hereby granted ...") }
108
+ spec = stub('spec', :license => { :file => license_file })
109
+ file_accessor = stub('file_accessor', :license => license_file)
110
+ result = PlistGenerator.license_text(spec, file_accessor)
111
+ result.should == 'Permission is hereby granted ...'
112
+ FileUtils.rm_f(license_file)
113
+ end
114
+
115
+ it 'warns when a license file is specified but does not exist' do
116
+ license_file = SpecHelper.temporary_directory + 'non-existent-file.txt'
117
+ spec = stub('spec', :license => { :file => license_file })
118
+ file_accessor = stub('file_accessor', :license => license_file)
119
+ PlistGenerator.license_text(spec, file_accessor)
120
+ Pod::UI.warnings.should.match /Unable to read the license file/
121
+ end
122
+ end
123
+
124
+ it 'renders markdown' do
125
+ contents = <<EOT
126
+ # Title
127
+ Title description
128
+
129
+ ## H2 Title
130
+ * List item 1
131
+ * List item 2
132
+
133
+ ### Sub Sub Head
134
+ > Some interesting quote
135
+ **
136
+ EOT
137
+ expected = "<h1>Title</h1>\n\n<p>Title description</p>\n\n<h2>H2 Title</h2>\n\n<ul>\n<li>List item 1</li>\n<li>List item 2</li>\n</ul>\n\n<h3>Sub Sub Head</h3>\n\n<blockquote>\n<p>Some interesting quote\n**</p>\n</blockquote>\n"
138
+ result = PlistGenerator.parse_markdown(contents)
139
+ result.should == "<h1>Title</h1>\n\n<p>Title description</p>\n\n<h2>H2 Title</h2>\n\n<ul>\n<li>List item 1</li>\n<li>List item 2</li>\n</ul>\n\n<h3>Sub Sub Head</h3>\n\n<blockquote>\n<p>Some interesting quote\n**</p>\n</blockquote>\n"
140
+ end
141
+ end
5
142
  end
@@ -1,5 +1,80 @@
1
1
  require File.expand_path('../spec_helper.rb', __FILE__)
2
2
 
3
- describe CocoaPodsAcknowledgements::SettingsPlistGenerator do
3
+ describe SettingsPlistGenerator = CocoaPodsAcknowledgements::SettingsPlistGenerator do
4
4
 
5
+ before do
6
+ @spec1 = SpecHelper.spec1
7
+ @spec2 = SpecHelper.spec2
8
+ SettingsPlistGenerator.stubs(:file_accessor).returns(nil)
9
+ @sandbox = temporary_sandbox
10
+ @target_description = stub('target_description',
11
+ :specs => [@spec1, @spec2],
12
+ :platform_name => 'ios')
13
+ end
14
+
15
+ it 'generates metadata' do
16
+ result = SettingsPlistGenerator.generate(@target_description, @sandbox, [])
17
+ result.should == {
18
+ 'Title' => 'Acknowledgements',
19
+ 'StringsTable' => 'Acknowledgements',
20
+ 'PreferenceSpecifiers' => [
21
+ {
22
+ 'Title' => 'Acknowledgements',
23
+ 'Type' => 'PSGroupSpecifier',
24
+ 'FooterText' => 'This application makes use of the following third party libraries:'
25
+ },
26
+ {
27
+ 'Title' => 'monkeylib',
28
+ 'Type' => 'PSGroupSpecifier',
29
+ 'FooterText' => 'Permission is hereby granted ...'
30
+ },
31
+ {
32
+ 'Title' => 'BananaLib',
33
+ 'Type' => 'PSGroupSpecifier',
34
+ 'FooterText' => 'Permission is hereby granted ...'
35
+ },
36
+ {
37
+ 'Title' => nil,
38
+ 'Type' => 'PSGroupSpecifier',
39
+ 'FooterText' => 'Generated by CocoaPods - https://cocoapods.org'
40
+ },
41
+ ]
42
+ }
43
+ end
44
+
45
+ it 'generates nil if specs is empty' do
46
+ target_description = stub('target_description',
47
+ :specs => [],
48
+ :platform_name => 'ios')
49
+ result = SettingsPlistGenerator.generate(target_description, @sandbox, [])
50
+ result.should.be.nil?
51
+ end
52
+
53
+ it 'does not include metadata for excluded specs' do
54
+ target_description = stub('target_description',
55
+ :specs => [@spec1, @spec2],
56
+ :platform_name => 'ios')
57
+ result = SettingsPlistGenerator.generate(target_description, @sandbox, [@spec1.name])
58
+ result.should == {
59
+ 'Title' => 'Acknowledgements',
60
+ 'StringsTable' => 'Acknowledgements',
61
+ 'PreferenceSpecifiers' => [
62
+ {
63
+ 'Title' => 'Acknowledgements',
64
+ 'Type' => 'PSGroupSpecifier',
65
+ 'FooterText' => 'This application makes use of the following third party libraries:'
66
+ },
67
+ {
68
+ 'Title' => 'BananaLib',
69
+ 'Type' => 'PSGroupSpecifier',
70
+ 'FooterText' => 'Permission is hereby granted ...'
71
+ },
72
+ {
73
+ 'Title' => nil,
74
+ 'Type' => 'PSGroupSpecifier',
75
+ 'FooterText' => 'Generated by CocoaPods - https://cocoapods.org'
76
+ },
77
+ ]
78
+ }
79
+ end
5
80
  end
@@ -44,4 +44,66 @@ module Pod
44
44
  end
45
45
  end
46
46
 
47
+ module SpecHelper
48
+ def self.temporary_directory
49
+ ROOT + 'tmp'
50
+ end
51
+
52
+ def self.spec1
53
+ Pod::Specification.new do |s|
54
+ s.name = 'monkeylib'
55
+ s.version = '1.0'
56
+ s.authors = {
57
+ 'CocoaPods' => 'email@cocoapods.org'
58
+ }
59
+ s.social_media_url = 'https://twitter.com/CocoaPods'
60
+ s.homepage = 'https://github.com/CocoaPods/monkeylib'
61
+ s.license = {
62
+ :type => 'MIT',
63
+ :file => 'LICENSE',
64
+ :text => 'Permission is hereby granted ...'
65
+ }
66
+ s.summary = 'A lib to do monkey things'
67
+ s.description = <<EOF
68
+ ## What is it
69
+ A lib to do monkey things
70
+ ## Why?
71
+ Why not?
72
+ EOF
73
+ end
74
+ end
75
+
76
+ def self.spec2
77
+ Pod::Specification.new do |s|
78
+ s.name = 'BananaLib'
79
+ s.version = '1.0'
80
+ s.authors = 'Banana Corp', { 'Monkey Boy' => 'monkey@banana-corp.local' }
81
+ s.homepage = 'http://banana-corp.local/banana-lib.html'
82
+ s.summary = 'Chunky bananas!'
83
+ s.description = 'Full of chunky bananas.'
84
+ s.source = { :git => 'http://banana-corp.local/banana-lib.git', :tag => 'v1.0' }
85
+ s.license = {
86
+ :type => 'MIT',
87
+ :file => 'LICENSE',
88
+ :text => 'Permission is hereby granted ...'
89
+ }
90
+ s.source_files = 'Classes/*.{h,m,d}', 'Vendor', 'framework/Source/*.h'
91
+ s.resources = "Resources/*", "Resources/Images.xcassets"
92
+ s.vendored_framework = 'BananaFramework.framework'
93
+ s.vendored_library = 'libBananaStaticLib.a'
94
+ s.preserve_paths = 'preserve_me.txt'
95
+ s.public_header_files = 'Classes/Banana.h', 'framework/Source/MoreBanana.h'
96
+ s.module_map = 'Banana.modulemap'
97
+
98
+ s.prefix_header_file = 'Classes/BananaLib.pch'
99
+ s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-framework SystemConfiguration' }
100
+ s.dependency 'monkey', '~> 1.0.1', '< 1.0.9'
101
+ end
102
+ end
103
+ end
104
+
105
+ def temporary_sandbox
106
+ Pod::Sandbox.new(SpecHelper.temporary_directory + 'Pods')
107
+ end
108
+
47
109
  #-----------------------------------------------------------------------------#
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-acknowledgements
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Pelosin
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-04-04 00:00:00.000000000 Z
13
+ date: 2020-03-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -46,20 +46,34 @@ dependencies:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '3.3'
49
+ - !ruby/object:Gem::Dependency
50
+ name: xcodeproj
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
49
63
  - !ruby/object:Gem::Dependency
50
64
  name: bundler
51
65
  requirement: !ruby/object:Gem::Requirement
52
66
  requirements:
53
67
  - - "~>"
54
68
  - !ruby/object:Gem::Version
55
- version: '1.3'
69
+ version: '2.0'
56
70
  type: :development
57
71
  prerelease: false
58
72
  version_requirements: !ruby/object:Gem::Requirement
59
73
  requirements:
60
74
  - - "~>"
61
75
  - !ruby/object:Gem::Version
62
- version: '1.3'
76
+ version: '2.0'
63
77
  - !ruby/object:Gem::Dependency
64
78
  name: rake
65
79
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +98,7 @@ files:
84
98
  - ".travis.yml"
85
99
  - CHANGELOG.md
86
100
  - Gemfile
101
+ - Gemfile.lock
87
102
  - LICENSE
88
103
  - README.md
89
104
  - Rakefile
@@ -116,8 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
131
  - !ruby/object:Gem::Version
117
132
  version: '0'
118
133
  requirements: []
119
- rubyforge_project:
120
- rubygems_version: 2.7.6
134
+ rubygems_version: 3.0.6
121
135
  signing_key:
122
136
  specification_version: 4
123
137
  summary: CocoaPods plugin that generates an acknowledgements plist to make it easy