cocoapods-acknowledgements 1.1.0 → 1.3.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
- SHA1:
3
- metadata.gz: 54435c0fb7730f387d1438481a57423e2413bc33
4
- data.tar.gz: e569eaa1915a1ee46c297cb6f4c9900f642df897
2
+ SHA256:
3
+ metadata.gz: 8675a6bfdfdda54eaf35ff8f6f71fa504323f8fb017523bc4bd1be9e1ebf51ea
4
+ data.tar.gz: 5d1ba75e2b29e463971b13a68e77d7dbe63ffcc65a6a004d7a18648c00ff55d7
5
5
  SHA512:
6
- metadata.gz: 2917315ce1ad58239938d975d2e60647c5e07052be09878e9a7eaa90358b34611a2db36c3def382afa47dc5ce46d8353d0865abda526351aa91098c780f9e0b2
7
- data.tar.gz: 7c689a4794cc670e1e26412f485575c4e3364ee8e8d446fefea90cc45fe1cd77f429ad32e0513e76a3edcb65d7968f08b9661c48f9ddb2999bb5c652141748bf
6
+ metadata.gz: 214335e620e8f61c35273de272697e43e92bb7663198fce8892a89cf5f16403252efdbc94ff04663b1dade5df2f666fb2f5d00b78daae7d57ddf59f16186e22b
7
+ data.tar.gz: ad590683f544bb718c3353766eef42f6c0b139ec7a500498f82f16071b5e8a36e67ab07dae154870bc213026e7b4691bb5517e1bea34e26d3291924d92583927
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,11 +1,75 @@
1
1
  # CocoaPods Acknowledgements Changelog
2
2
 
3
- ## Master
3
+ ## 1.3.0 (2020-10-21)
4
4
 
5
5
  ##### Enhancements
6
6
 
7
+ * Update to work with 1.10 release of cocoapods
8
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
9
+ [#57](https://github.com/CocoaPods/cocoapods-acknowledgements/issues/57)
10
+
11
+ ##### Bug Fixes
12
+
13
+ * None.
14
+
15
+
16
+ ## 1.2.0 (2020-03-23)
17
+
18
+ ##### Enhancements
19
+
20
+ * Update internal gem dependencies to latest versions
21
+ [Olivier Halligon](https://github.com/AliSoftware)
22
+ [#56](https://github.com/CocoaPods/cocoapods-acknowledgements/pull/56)
23
+
24
+ * Add `targets` options to specify targets to add metadata
25
+ [Richard Lee](https://github.com/dlackty)
26
+ [#46](https://github.com/CocoaPods/cocoapods-acknowledgements/issues/46)
27
+
28
+ * Improve the performance of metadata generation
29
+ [Eric Amorde](https://github.com/amorde)
30
+ [#54](https://github.com/CocoaPods/cocoapods-acknowledgements/pull/54)
31
+
32
+ * Add tests
33
+ [Eric Amorde](https://github.com/amorde)
34
+ [#1](https://github.com/CocoaPods/cocoapods-acknowledgements/issues/1)
35
+
36
+ ##### Bug Fixes
37
+
7
38
  * None.
8
39
 
40
+
41
+ ## 1.1.3 (2018-04-04)
42
+
43
+ ##### Enhancements
44
+
45
+ * Update matching for `Settings.bundle` file in project.
46
+ [Jim Hildensperger](https://github.com/jhildensperger)
47
+
48
+ ##### Bug Fixes
49
+
50
+ * None.
51
+
52
+
53
+ ## 1.1.2 (2016-10-28)
54
+
55
+ ##### Enhancements
56
+
57
+ * None.
58
+
59
+ ##### Bug Fixes
60
+
61
+ * Fix NameError when a license is not found.
62
+ [Danielle Tomlinson](https://github.com/dantoml)
63
+ [#31](https://github.com/CocoaPods/cocoapods-acknowledgements/issues/31)
64
+
65
+
66
+ ## 1.1.1 (2016-04-15)
67
+
68
+ ##### Enhancements
69
+
70
+ * Add `homepage` to the spec's metadata.
71
+ [Orta Therox](https://github.com/orta)
72
+
9
73
  ##### Bug Fixes
10
74
 
11
75
  * None.
data/Gemfile CHANGED
@@ -3,7 +3,6 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem 'cocoapods'
7
6
  gem 'bacon'
8
7
  gem 'mocha-on-bacon'
9
8
  gem 'mocha', '~> 0.11.4'
@@ -0,0 +1,117 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cocoapods-acknowledgements (1.3.0)
5
+ cocoapods
6
+ redcarpet (~> 3.3)
7
+ xcodeproj
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ CFPropertyList (3.0.2)
13
+ activesupport (5.2.4.4)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (>= 0.7, < 2)
16
+ minitest (~> 5.1)
17
+ tzinfo (~> 1.1)
18
+ addressable (2.7.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ algoliasearch (1.27.4)
21
+ httpclient (~> 2.8, >= 2.8.3)
22
+ json (>= 1.5.1)
23
+ atomos (0.1.3)
24
+ bacon (1.2.0)
25
+ claide (1.0.3)
26
+ cocoapods (1.10.0)
27
+ addressable (~> 2.6)
28
+ claide (>= 1.0.2, < 2.0)
29
+ cocoapods-core (= 1.10.0)
30
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
31
+ cocoapods-downloader (>= 1.4.0, < 2.0)
32
+ cocoapods-plugins (>= 1.0.0, < 2.0)
33
+ cocoapods-search (>= 1.0.0, < 2.0)
34
+ cocoapods-trunk (>= 1.4.0, < 2.0)
35
+ cocoapods-try (>= 1.1.0, < 2.0)
36
+ colored2 (~> 3.1)
37
+ escape (~> 0.0.4)
38
+ fourflusher (>= 2.3.0, < 3.0)
39
+ gh_inspector (~> 1.0)
40
+ molinillo (~> 0.6.6)
41
+ nap (~> 1.0)
42
+ ruby-macho (~> 1.4)
43
+ xcodeproj (>= 1.19.0, < 2.0)
44
+ cocoapods-core (1.10.0)
45
+ activesupport (> 5.0, < 6)
46
+ addressable (~> 2.6)
47
+ algoliasearch (~> 1.0)
48
+ concurrent-ruby (~> 1.1)
49
+ fuzzy_match (~> 2.0.4)
50
+ nap (~> 1.0)
51
+ netrc (~> 0.11)
52
+ public_suffix
53
+ typhoeus (~> 1.0)
54
+ cocoapods-deintegrate (1.0.4)
55
+ cocoapods-downloader (1.4.0)
56
+ cocoapods-plugins (1.0.0)
57
+ nap
58
+ cocoapods-search (1.0.0)
59
+ cocoapods-trunk (1.5.0)
60
+ nap (>= 0.8, < 2.0)
61
+ netrc (~> 0.11)
62
+ cocoapods-try (1.2.0)
63
+ colored2 (3.1.2)
64
+ concurrent-ruby (1.1.7)
65
+ escape (0.0.4)
66
+ ethon (0.12.0)
67
+ ffi (>= 1.3.0)
68
+ ffi (1.13.1)
69
+ fourflusher (2.3.1)
70
+ fuzzy_match (2.0.4)
71
+ gh_inspector (1.1.3)
72
+ httpclient (2.8.3)
73
+ i18n (1.8.5)
74
+ concurrent-ruby (~> 1.0)
75
+ json (2.3.1)
76
+ metaclass (0.0.4)
77
+ minitest (5.14.2)
78
+ mocha (0.11.4)
79
+ metaclass (~> 0.0.1)
80
+ mocha-on-bacon (0.2.1)
81
+ mocha (>= 0.9.8)
82
+ molinillo (0.6.6)
83
+ nanaimo (0.3.0)
84
+ nap (1.1.0)
85
+ netrc (0.11.0)
86
+ prettybacon (0.0.2)
87
+ bacon (~> 1.2)
88
+ public_suffix (4.0.6)
89
+ rake (13.0.1)
90
+ redcarpet (3.5.0)
91
+ ruby-macho (1.4.0)
92
+ thread_safe (0.3.6)
93
+ typhoeus (1.4.0)
94
+ ethon (>= 0.9.0)
95
+ tzinfo (1.2.7)
96
+ thread_safe (~> 0.1)
97
+ xcodeproj (1.19.0)
98
+ CFPropertyList (>= 2.3.3, < 4.0)
99
+ atomos (~> 0.1.3)
100
+ claide (>= 1.0.2, < 2.0)
101
+ colored2 (~> 3.1)
102
+ nanaimo (~> 0.3.0)
103
+
104
+ PLATFORMS
105
+ ruby
106
+
107
+ DEPENDENCIES
108
+ bacon
109
+ bundler (~> 2.0)
110
+ cocoapods-acknowledgements!
111
+ mocha (~> 0.11.4)
112
+ mocha-on-bacon
113
+ prettybacon
114
+ rake
115
+
116
+ BUNDLED WITH
117
+ 2.1.2
data/README.md CHANGED
@@ -33,12 +33,22 @@ plugin 'cocoapods-acknowledgements', :settings_bundle => true , :settings_post_p
33
33
  }
34
34
  ```
35
35
 
36
- The plugin will search through the first two levels of your project 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.
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'
42
42
 
43
43
  plugin 'cocoapods-acknowledgements', :settings_bundle => true, :exclude => ['PrivateKit', 'SecretLib']
44
44
  ```
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
+
52
+ ### Location
53
+
54
+ The plist generated by this plugin is located under the root of your ```Pods``` directory.
@@ -16,7 +16,10 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
+ spec.add_runtime_dependency 'cocoapods'
20
+
19
21
  spec.add_dependency "redcarpet", "~> 3.3"
20
- spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_dependency "xcodeproj"
23
+ spec.add_development_dependency "bundler", "~> 2.0"
21
24
  spec.add_development_dependency "rake"
22
25
  end
@@ -29,12 +29,11 @@ module CocoaPodsAcknowledgements
29
29
  end
30
30
 
31
31
  project.save
32
-
33
32
  end
34
33
 
35
- # TODO: Code golf this
36
- def self.settings_bundle_in_project
37
- Dir.glob("**/*Settings.bundle").first
34
+ def self.settings_bundle_in_project(project)
35
+ file = project.files.find { |f| f.path =~ /Settings\.bundle$/ }
36
+ file.real_path.to_path unless file.nil?
38
37
  end
39
38
 
40
39
  Pod::HooksManager.register('cocoapods-acknowledgements', :post_install) do |context, user_options|
@@ -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
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,
@@ -29,13 +28,13 @@ module CocoaPodsAcknowledgements
29
28
  "description" => parse_markdown(spec.description),
30
29
  "licenseType" => spec.license[:type],
31
30
  "licenseText" => license_text,
31
+ "homepage" => spec.homepage,
32
32
  }
33
- specs_metadata << spec_metadata
34
33
  end
35
34
 
36
- metadata = {}
37
- metadata["specs"] = specs_metadata
38
- metadata
35
+ {
36
+ "specs" => specs_metadata
37
+ }
39
38
  end
40
39
 
41
40
  #-----------------------------------------------------------------------#
@@ -65,7 +64,7 @@ module CocoaPodsAcknowledgements
65
64
  if license_file.exist?
66
65
  text = IO.read(license_file)
67
66
  else
68
- UI.warn "Unable to read the license file `#{license_file }` " \
67
+ Pod::UI.warn "Unable to read the license file `#{license_file }` " \
69
68
  "for the spec `#{spec}`"
70
69
  end
71
70
  end
@@ -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.0"
2
+ VERSION = "1.3.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,17 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-acknowledgements
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Pelosin
8
8
  - Orta Therox
9
9
  - Marcelo Fabri
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-10 00:00:00.000000000 Z
13
+ date: 2020-10-21 00:00:00.000000000 Z
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: cocoapods
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
15
29
  - !ruby/object:Gem::Dependency
16
30
  name: redcarpet
17
31
  requirement: !ruby/object:Gem::Requirement
@@ -26,20 +40,34 @@ dependencies:
26
40
  - - "~>"
27
41
  - !ruby/object:Gem::Version
28
42
  version: '3.3'
43
+ - !ruby/object:Gem::Dependency
44
+ name: xcodeproj
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
29
57
  - !ruby/object:Gem::Dependency
30
58
  name: bundler
31
59
  requirement: !ruby/object:Gem::Requirement
32
60
  requirements:
33
61
  - - "~>"
34
62
  - !ruby/object:Gem::Version
35
- version: '1.3'
63
+ version: '2.0'
36
64
  type: :development
37
65
  prerelease: false
38
66
  version_requirements: !ruby/object:Gem::Requirement
39
67
  requirements:
40
68
  - - "~>"
41
69
  - !ruby/object:Gem::Version
42
- version: '1.3'
70
+ version: '2.0'
43
71
  - !ruby/object:Gem::Dependency
44
72
  name: rake
45
73
  requirement: !ruby/object:Gem::Requirement
@@ -54,8 +82,8 @@ dependencies:
54
82
  - - ">="
55
83
  - !ruby/object:Gem::Version
56
84
  version: '0'
57
- description:
58
- email:
85
+ description:
86
+ email:
59
87
  executables: []
60
88
  extensions: []
61
89
  extra_rdoc_files: []
@@ -64,6 +92,7 @@ files:
64
92
  - ".travis.yml"
65
93
  - CHANGELOG.md
66
94
  - Gemfile
95
+ - Gemfile.lock
67
96
  - LICENSE
68
97
  - README.md
69
98
  - Rakefile
@@ -81,7 +110,7 @@ homepage: https://github.com/CocoaPods/cocoapods-acknowledgements
81
110
  licenses:
82
111
  - MIT
83
112
  metadata: {}
84
- post_install_message:
113
+ post_install_message:
85
114
  rdoc_options: []
86
115
  require_paths:
87
116
  - lib
@@ -96,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
125
  - !ruby/object:Gem::Version
97
126
  version: '0'
98
127
  requirements: []
99
- rubyforge_project:
100
- rubygems_version: 2.6.1
101
- signing_key:
128
+ rubygems_version: 3.0.6
129
+ signing_key:
102
130
  specification_version: 4
103
131
  summary: CocoaPods plugin that generates an acknowledgements plist to make it easy
104
132
  to create tools to use in apps.