pod-builder 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c7986b97b11b43e98381dc45c2a6609e0e11a37b126b27ebe12685cb931ee3d
4
- data.tar.gz: 2e662d642edddc503316edf689d0d9af5326a0c6ba6cf87b587684d0277dac9b
3
+ metadata.gz: fb569af4e67589086b8c79b3ce1d2493339a874966d9577284ed9b32b61a88e3
4
+ data.tar.gz: 8305349863232366bb440b452784f5c976c2c6c12a3488f19663867f8e246d9d
5
5
  SHA512:
6
- metadata.gz: c5a23bb253a08ef0f8f2013934d8ab358b818a0b71f9b24cc7f88c46143ed1e82dcc26a32646b8030cc7c3c9340ee5c63b7c6d582c88c1c0b33c798cbfbed9d8
7
- data.tar.gz: 3e960da37ddbb1772b87400b5001d91ec1f2a99a3bc3784a5fff3ed9575114b2f960d0828b945f83e503063edc4389b69ecacf3b27d050caafe64f9d464f3b87
6
+ metadata.gz: 14d9708d3ac46c9cb99df19433d6d632e83e3b1b147f626839c33b9d3e515bc053c2e44c1d862468e77e72b648ff39fb26707c4080599f6ad7f81c0a8347310c
7
+ data.tar.gz: 8ffeb26c4cd30109559f5a36985a847cf3156fd22f8dac3202452abe39f362a859e763dcbf0e89f0f3b17a214f3cc6fc4aa4bcaab659f10c48632694b881d504
data/.vscode/launch.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "name": "No Command",
9
9
  "type": "Ruby",
10
10
  "request": "launch",
11
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
11
+ "cwd": "~/Desktop",
12
12
  "useBundler": true,
13
13
  "program": "${workspaceRoot}/exe/pod_builder",
14
14
  "showDebuggerOutput": true,
@@ -21,7 +21,7 @@
21
21
  "name": "Init",
22
22
  "type": "Ruby",
23
23
  "request": "launch",
24
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
24
+ "cwd": "~/Desktop",
25
25
  "useBundler": true,
26
26
  "program": "${workspaceRoot}/exe/pod_builder",
27
27
  "showDebuggerOutput": true,
@@ -34,7 +34,7 @@
34
34
  "name": "Deintegrate",
35
35
  "type": "Ruby",
36
36
  "request": "launch",
37
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
37
+ "cwd": "~/Desktop",
38
38
  "useBundler": true,
39
39
  "program": "${workspaceRoot}/exe/pod_builder",
40
40
  "showDebuggerOutput": true,
@@ -47,7 +47,7 @@
47
47
  "name": "Build",
48
48
  "type": "Ruby",
49
49
  "request": "launch",
50
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
50
+ "cwd": "~/Desktop",
51
51
  "useBundler": true,
52
52
  "program": "${workspaceRoot}/exe/pod_builder",
53
53
  "showDebuggerOutput": true,
@@ -55,17 +55,14 @@
55
55
  "args": [
56
56
  "build",
57
57
  "-d",
58
- "--allow-warnings",
59
- "SchibstedTracking",
60
- "SBTUnicorn",
61
- "SchibstedEvents"
58
+ "ADvantage",
62
59
  ]
63
60
  },
64
61
  {
65
62
  "name": "Build All",
66
63
  "type": "Ruby",
67
64
  "request": "launch",
68
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
65
+ "cwd": "~/Desktop",
69
66
  "useBundler": true,
70
67
  "program": "${workspaceRoot}/exe/pod_builder",
71
68
  "showDebuggerOutput": true,
@@ -80,7 +77,7 @@
80
77
  "name": "Restore All",
81
78
  "type": "Ruby",
82
79
  "request": "launch",
83
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
80
+ "cwd": "~/Desktop",
84
81
  "useBundler": true,
85
82
  "program": "${workspaceRoot}/exe/pod_builder",
86
83
  "showDebuggerOutput": true,
@@ -94,7 +91,7 @@
94
91
  "name": "Clean",
95
92
  "type": "Ruby",
96
93
  "request": "launch",
97
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
94
+ "cwd": "~/Desktop",
98
95
  "useBundler": true,
99
96
  "program": "${workspaceRoot}/exe/pod_builder",
100
97
  "showDebuggerOutput": true,
@@ -107,7 +104,7 @@
107
104
  "name": "Install sources",
108
105
  "type": "Ruby",
109
106
  "request": "launch",
110
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
107
+ "cwd": "~/Desktop",
111
108
  "useBundler": true,
112
109
  "program": "${workspaceRoot}/exe/pod_builder",
113
110
  "showDebuggerOutput": true,
@@ -120,7 +117,7 @@
120
117
  "name": "Generate podspec",
121
118
  "type": "Ruby",
122
119
  "request": "launch",
123
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
120
+ "cwd": "~/Desktop",
124
121
  "useBundler": true,
125
122
  "program": "${workspaceRoot}/exe/pod_builder",
126
123
  "showDebuggerOutput": true,
@@ -133,7 +130,7 @@
133
130
  "name": "Switch pod",
134
131
  "type": "Ruby",
135
132
  "request": "launch",
136
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
133
+ "cwd": "~/Desktop",
137
134
  "useBundler": true,
138
135
  "program": "${workspaceRoot}/exe/pod_builder",
139
136
  "showDebuggerOutput": true,
@@ -148,7 +145,7 @@
148
145
  "name": "Update LFS",
149
146
  "type": "Ruby",
150
147
  "request": "launch",
151
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
148
+ "cwd": "~/Desktop",
152
149
  "useBundler": true,
153
150
  "program": "${workspaceRoot}/exe/pod_builder",
154
151
  "showDebuggerOutput": true,
@@ -158,16 +155,16 @@
158
155
  ]
159
156
  },
160
157
  {
161
- "name": "Synch Podfile",
158
+ "name": "Sync Podfile",
162
159
  "type": "Ruby",
163
160
  "request": "launch",
164
- "cwd": "/Users/tomas/Downloads/willhaben-ios",
161
+ "cwd": "~/Desktop",
165
162
  "useBundler": true,
166
163
  "program": "${workspaceRoot}/exe/pod_builder",
167
164
  "showDebuggerOutput": true,
168
165
  "pathToRDebugIDE": "/usr/bin/rdebug-ide",
169
166
  "args": [
170
- "synch_podfile",
167
+ "sync_podfile",
171
168
  ]
172
169
  }
173
170
  ]
data/README.md CHANGED
@@ -49,7 +49,7 @@ Podbuilder comes with a set of commands:
49
49
  - `install_sources`: installs sources of pods to debug into prebuild frameworks
50
50
  - `switch`: switch between prebuilt, development or standard pod in the Application-Podfile
51
51
  - `clean`: removes unused prebuilt frameworks, dSYMs and source files added by install_sources
52
- - `synch_podfile`: updates the Application with all pods declared in the PodBuilder-Podfile file
52
+ - `sync_podfile`: updates the Application with all pods declared in the PodBuilder-Podfile file
53
53
 
54
54
  Commands can be run from anywhere in your project's repo that is **required to be under git**.
55
55
 
@@ -102,11 +102,22 @@ Using the switch command you can choose to integrate it:
102
102
  - development. The _Development Pod_ used by CocoaPods
103
103
  - prebuilt. Use the prebuilt pod
104
104
 
105
+ To support development pods you should specify the path(s) that contain the pods sources in _Frameworks/PodBuilderDevPodsPaths.json_ as follows
106
+
107
+ ```json
108
+ [
109
+ "~/path_to_pods_1",
110
+ "~/path_to_pods_2",
111
+ ]
112
+ ```
113
+
114
+ PodBuilder will automatically determine the proper path when switching a particular pod.
115
+
105
116
  #### `clean` command
106
117
 
107
118
  Deletes all unused files by PodBuilder, including .frameworks, .dSYMs and _Source_ repos.
108
119
 
109
- #### `synch_podfile` command
120
+ #### `sync_podfile` command
110
121
 
111
122
  Updates the Application with all pods declared in the PodBuilder-Podfile file. This can come in handy when adding a new pod to the PodBuilder-Podfile file you don't won't to prebuild straight away.
112
123
 
@@ -210,14 +221,15 @@ Normally when multiple subspecs are specified in a target a single framework is
210
221
  }
211
222
  ```
212
223
 
213
- #### `update_lfs_gitattributes
224
+ #### `lfs_update_gitattributes
225
+
226
+ Adds a _.gitattributes_ to _Frameworks/Rome_ and _Frameworks/dSYM_ to exclude large files. If `lfs_include_pods_folder` is true it will add a the same _.gitattributes_ to the application's _Pods_ folder as well.
214
227
 
215
- Adds files bigger than [`lfs_min_file_size_kb`](#lfs_min_file_size_kb) to _.gitattributes_ when using [Git-LFS](#git-lfs).
216
228
 
229
+ #### `lfs_include_pods_folder`
217
230
 
218
- #### `lfs_min_file_size_kb`
231
+ See [`lfs_update_gitattributes`](#lfs_update_gitattributes).
219
232
 
220
- Change the minimum file size to add files to _.gitattributes_ when using [Git-LFS](#git-lfs).
221
233
 
222
234
  # Behind the scenes
223
235
 
@@ -251,7 +263,7 @@ Please open an issue here. You may also add the name of the pod to the [`skip_po
251
263
 
252
264
  PodBuilder integrates with [Git Large File Storage](https://git-lfs.github.com) to move large files, like the prebuilt frameworks, out of your git repo. This allows to benefit from the compilation speed ups of the precompiled frameworks without impacting on your repo overall size.
253
265
 
254
- When [`update_lfs_gitattributes = true`](#update_lfs_gitattributes) PodBuilder will automatically update the _.gitattributes_ with the files generated by PodBuilder when building pods.
266
+ When [`lfs_update_gitattributes = true`](#lfs_update_gitattributes) PodBuilder will automatically update the _.gitattributes_ with the files generated by PodBuilder when building pods.
255
267
 
256
268
  # Try it out!
257
269
 
data/exe/pod_builder CHANGED
@@ -33,7 +33,7 @@ Command:
33
33
  + install_sources Install sources of pods to debug into prebuild frameworks
34
34
  + switch Switch between prebuilt/development/standard pod in the Application-Podfile
35
35
  + clean Remove prebuild frameworks, dSYMs and source files added by install_sources no longer in Frameworks/Podfile
36
- + synch_podfile Update your Application-Podfile with all pods declared in the PodBuilder-Podfile
36
+ + sync_podfile Update your Application-Podfile with all pods declared in the PodBuilder-Podfile
37
37
 
38
38
  Options:
39
39
  "
@@ -234,12 +234,12 @@ Options:
234
234
  ]
235
235
  },
236
236
 
237
- "synch_podfile" => {
237
+ "sync_podfile" => {
238
238
  :opts => OptionParser.new do |opts|
239
239
  opts.banner = "
240
240
  Usage:
241
241
 
242
- $ pod_builder synch_podfile
242
+ $ pod_builder sync_podfile
243
243
 
244
244
  Rewrite the Application-Podfile based on the PodBuilder-Podfile.
245
245
  You may want to run this command when you add a new pod to the PodBuilder-Podfile
@@ -247,7 +247,7 @@ Usage:
247
247
 
248
248
  " end,
249
249
  :call => [
250
- PodBuilder::Command::SynchPodfile
250
+ PodBuilder::Command::SyncPodfile
251
251
  ]
252
252
  }
253
253
  }
@@ -9,4 +9,4 @@ require 'pod_builder/command/generate_podspec'
9
9
  require 'pod_builder/command/install_sources'
10
10
  require 'pod_builder/command/switch'
11
11
  require 'pod_builder/command/generate_lfs'
12
- require 'pod_builder/command/synch_podfile'
12
+ require 'pod_builder/command/sync_podfile'
@@ -37,6 +37,10 @@ module PodBuilder
37
37
  return true
38
38
  end
39
39
 
40
+ Podfile.restore_podfile_clean(all_buildable_items)
41
+
42
+ restore_file_error = Podfile.restore_file_sanity_check
43
+
40
44
  check_splitted_subspecs_are_static(all_buildable_items, options)
41
45
  check_pods_exists(argument_pods, buildable_items)
42
46
 
@@ -82,7 +86,7 @@ module PodBuilder
82
86
  FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
83
87
  end
84
88
 
85
- write_license_files(licenses, all_buildable_items)
89
+ Licenses::write(licenses, all_buildable_items)
86
90
 
87
91
  GenerateLFS::call(nil)
88
92
  Podspec::generate(analyzer)
@@ -98,6 +102,10 @@ module PodBuilder
98
102
 
99
103
  sanity_checks(options)
100
104
 
105
+ if (restore_file_error = restore_file_error) && Configuration.restore_enabled
106
+ puts "\n\n⚠️ Podfile.restore was found invalid and was overwritten. Error:\n #{restore_file_error}".red
107
+ end
108
+
101
109
  puts "\n\n🎉 done!\n".green
102
110
  return true
103
111
  end
@@ -118,62 +126,6 @@ module PodBuilder
118
126
  return []
119
127
  end
120
128
 
121
- def self.write_license_files(licenses, all_buildable_items)
122
- puts "Writing licenses".yellow
123
- license_file_path = PodBuilder::project_path(Configuration.license_filename) + ".plist"
124
-
125
- current_licenses = []
126
- if File.exist?(license_file_path)
127
- plist = CFPropertyList::List.new(:file => license_file_path)
128
- dict = CFPropertyList.native_types(plist.value)
129
- current_licenses = dict["PreferenceSpecifiers"]
130
- current_licenses.shift
131
- current_licenses.pop
132
- end
133
-
134
- licenses_header = licenses.shift
135
- raise "Unexpected license found in header" if licenses_header.has_key?("License")
136
- license_footer = licenses.pop
137
- raise "Unexpected license found in footer" if license_footer.has_key?("License")
138
-
139
- lincenses_titles = licenses.map { |x| x["Title"] }
140
- current_licenses.select! { |x| !lincenses_titles.include?(x["Title"]) }
141
-
142
- licenses += current_licenses # merge with existing license
143
- licenses.uniq! { |x| x["Title"] }
144
- licenses.sort_by! { |x| x["Title"] }
145
- licenses.select! { |x| !Configuration.skip_licenses.include?(x["Title"]) }
146
- licenses.select! { |x| all_buildable_items.map(&:root_name).include?(x["Title"]) } # Remove items that are no longer included
147
-
148
- license_dict = {}
149
- license_dict["PreferenceSpecifiers"] = [licenses_header, licenses, license_footer].flatten
150
- license_dict["StringsTable"] = "Acknowledgements"
151
- license_dict["Title"] = license_dict["StringsTable"]
152
-
153
- plist = CFPropertyList::List.new
154
- plist.value = CFPropertyList.guess(license_dict)
155
- plist.save(license_file_path, CFPropertyList::List::FORMAT_BINARY)
156
-
157
- write_markdown_licenses(license_file_path)
158
- end
159
-
160
- def self.write_markdown_licenses(plist_path)
161
- plist = CFPropertyList::List.new(:file => plist_path)
162
- dict = CFPropertyList.native_types(plist.value)
163
- licenses = dict["PreferenceSpecifiers"]
164
- header = licenses.shift
165
-
166
- markdown = []
167
- markdown += ["# #{header["Title"]}", header["FooterText"], ""]
168
- markdown += licenses.map { |x| ["## #{x["Title"]}", x["FooterText"], ""] }
169
-
170
- markdown.flatten!
171
-
172
- markdown_path = plist_path.chomp(File.extname(plist_path)) + ".md"
173
-
174
- File.write(markdown_path, markdown.join("\n"))
175
- end
176
-
177
129
  def self.add_dependencies(pods, buildable_items)
178
130
  pods.dup.each do |pod|
179
131
  build_configuration = pods.first.build_configuration
@@ -6,30 +6,38 @@ module PodBuilder
6
6
  def self.call(options)
7
7
  Configuration.check_inited
8
8
 
9
- unless Configuration.update_lfs_gitattributes
10
- return false
9
+ unless Configuration.lfs_update_gitattributes
10
+ return false
11
11
  end
12
-
13
- base_path = PodBuilder::basepath
14
- framework_files = filter_files_by_size(Dir.glob("#{base_path}/Rome/**/*.framework/**/**"), 256)
15
- dSYM_files_iphone = filter_files_by_size(Dir.glob("#{base_path}/dSYM/**/*.dSYM/**/**"), 256)
16
12
 
17
- total_size = (framework_files + dSYM_files_iphone).map { |x| File.size(x) }.inject(0, :+)
18
- puts "Total size in LFS: #{total_size / 1024 / 1024}MB"
13
+ gitattributes_excludes = ["*.h", "*.hh", "*.m", "*.mm", "*.i", "*.c", "*.cc", "*.cxx", "*.cpp", "*.def", "*.inc", "*.inl", "*.swift", "*.modulemap", "*.strings", "*.png", "*.jpg", "*.gif", "*.html", "*.htm", "*.js", "*.json", "*.xml", "*.txt", "*.md", "*.rb", "*.sh", "*.py", "*.plist", ".*"]
19
14
 
20
- home_path = Pathname.new(PodBuilder::home)
15
+ gitattributes_includes_frameworks = ["**/* filter=lfs diff=lfs merge=lfs !text"]
16
+ write_attributes(PodBuilder::basepath("Rome"), gitattributes_includes_frameworks, gitattributes_excludes)
17
+ write_attributes(PodBuilder::basepath("dSYM"), gitattributes_includes_frameworks, gitattributes_excludes)
21
18
 
22
- paths = (framework_files + dSYM_files_iphone).map { |x| Pathname.new(x) }
23
- rel_paths = paths.map { |x| x.relative_path_from(home_path).to_s }
19
+ if Configuration.lfs_include_pods_folder
20
+ gitattributes_includes_pods = ["**/*.frameworks/**/* filter=lfs diff=lfs merge=lfs !text"]
21
+ write_attributes(PodBuilder::project_path("Pods"), gitattributes_includes_pods, gitattributes_excludes)
22
+ end
23
+ end
24
24
 
25
+ private
26
+
27
+ def self.filter_files_by_size(files, size_kb)
28
+ return files.select { |x| File.size(x) / 1024 > Configuration.lfs_min_file_size }
29
+ end
30
+
31
+ def self.write_attributes(path, gitattributes_includes, gitattributes_excludes)
25
32
  stop_marker = "# pb<stop>"
26
33
  start_marker = "# pb<start> (lines up to `#{stop_marker}` are autogenerated, don't modify this section)"
27
34
 
28
35
  gitattributes_items = [start_marker]
29
- gitattributes_items += rel_paths.map { |x| "#{x} filter=lfs diff=lfs merge=lfs -text" }
36
+ gitattributes_items += gitattributes_includes + gitattributes_excludes.map { |x| "#{x} !filter !merge !diff" }
30
37
  gitattributes_items += [stop_marker]
31
-
32
- gitattributes_path = File.join(PodBuilder::home, ".gitattributes")
38
+
39
+ gitattributes_path = File.join(gitattributes_path, ".gitattributes")
40
+
33
41
  if !File.exist?(gitattributes_path)
34
42
  FileUtils.touch(gitattributes_path)
35
43
  end
@@ -55,12 +63,6 @@ module PodBuilder
55
63
 
56
64
  File.write(gitattributes_path, gitattributes_items.join("\n"))
57
65
  end
58
-
59
- private
60
-
61
- def self.filter_files_by_size(files, size_kb)
62
- return files.select { |x| File.size(x) / 1024 > Configuration.lfs_min_file_size }
63
- end
64
66
  end
65
67
  end
66
68
  end
@@ -4,6 +4,10 @@ module PodBuilder
4
4
  module Command
5
5
  class RestoreAll
6
6
  def self.call(options)
7
+ unless Configuration.restore_enabled
8
+ return
9
+ end
10
+
7
11
  Configuration.check_inited
8
12
  PodBuilder::prepare_basepath
9
13
 
@@ -106,7 +106,7 @@ module PodBuilder
106
106
 
107
107
  def self.find_podspec(podfile_item)
108
108
  unless Configuration.development_pods_paths.count > 0
109
- raise "\n\nPlease add the `development_pods_paths` in #{Configuration.dev_pods_configuration_filename} as per documentation\n".red
109
+ raise "\n\nPlease add the development pods path(s) in #{Configuration.dev_pods_configuration_filename} as per documentation\n".red
110
110
  end
111
111
 
112
112
  podspec_path = nil
@@ -2,7 +2,7 @@ require 'pod_builder/core'
2
2
 
3
3
  module PodBuilder
4
4
  module Command
5
- class SynchPodfile
5
+ class SyncPodfile
6
6
  def self.call(options)
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
@@ -18,6 +18,8 @@ module PodBuilder
18
18
  Podfile::write_prebuilt(all_buildable_items, analyzer)
19
19
  updated_podfile_content = File.read("Podfile")
20
20
 
21
+ Licenses::write([], all_buildable_items)
22
+
21
23
  if previous_podfile_content != updated_podfile_content
22
24
  system("pod install")
23
25
  end
@@ -36,8 +36,10 @@ module PodBuilder
36
36
  attr_accessor :configuration_filename
37
37
  attr_accessor :dev_pods_configuration_filename
38
38
  attr_accessor :lfs_min_file_size
39
- attr_accessor :update_lfs_gitattributes
39
+ attr_accessor :lfs_update_gitattributes
40
+ attr_accessor :lfs_include_pods_folder
40
41
  attr_accessor :project_name
42
+ attr_accessor :restore_enabled
41
43
  end
42
44
 
43
45
  @build_settings = DEFAULT_BUILD_SETTINGS
@@ -54,8 +56,10 @@ module PodBuilder
54
56
  @configuration_filename = "PodBuilder.json".freeze
55
57
  @dev_pods_configuration_filename = "PodBuilderDevPodsPaths.json".freeze
56
58
  @lfs_min_file_size = MIN_LFS_SIZE_KB
57
- @update_lfs_gitattributes = false
59
+ @lfs_update_gitattributes = false
60
+ @lfs_include_pods_folder = false
58
61
  @project_name = ""
62
+ @restore_enabled = true
59
63
 
60
64
  def self.check_inited
61
65
  raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil?
@@ -115,18 +119,14 @@ module PodBuilder
115
119
  Configuration.subspecs_to_split = value
116
120
  end
117
121
  end
118
- if value = json["update_lfs_gitattributes"]
122
+ if value = json["lfs_update_gitattributes"]
119
123
  if [TrueClass, FalseClass].include?(value.class)
120
- Configuration.update_lfs_gitattributes = value
124
+ Configuration.lfs_update_gitattributes = value
121
125
  end
122
126
  end
123
- if value = json["lfs_min_file_size_kb"]
124
- if value.is_a?(Integer)
125
- if value > 50
126
- Configuration.lfs_min_file_size = value
127
- else
128
- puts "\n\n⚠️ Skipping `lfs_min_file_size` value too small".yellow
129
- end
127
+ if value = json["lfs_include_pods_folder"]
128
+ if [TrueClass, FalseClass].include?(value.class)
129
+ Configuration.lfs_include_pods_folder = value
130
130
  end
131
131
  end
132
132
  if value = json["project_name"]
@@ -134,6 +134,11 @@ module PodBuilder
134
134
  Configuration.project_name = value
135
135
  end
136
136
  end
137
+ if value = json["restore_enabled"]
138
+ if [TrueClass, FalseClass].include?(value.class)
139
+ Configuration.restore_enabled = value
140
+ end
141
+ end
137
142
 
138
143
  Configuration.build_settings.freeze
139
144
  else
@@ -161,8 +166,8 @@ module PodBuilder
161
166
  config["build_system"] = Configuration.build_system
162
167
  config["license_filename"] = Configuration.license_filename
163
168
  config["subspecs_to_split"] = Configuration.subspecs_to_split
164
- config["update_lfs_gitattributes"] = Configuration.update_lfs_gitattributes
165
- config["lfs_min_file_size_kb"] = Configuration.lfs_min_file_size
169
+ config["lfs_update_gitattributes"] = Configuration.lfs_update_gitattributes
170
+ config["lfs_include_pods_folder"] = Configuration.lfs_include_pods_folder
166
171
 
167
172
  File.write(config_path, JSON.pretty_generate(config))
168
173
  end
@@ -8,6 +8,7 @@ require 'pod_builder/analyze'
8
8
  require 'pod_builder/install'
9
9
  require 'pod_builder/configuration'
10
10
  require 'pod_builder/podspec'
11
+ require 'pod_builder/licenses'
11
12
 
12
13
  require 'core_ext/string'
13
14
 
@@ -0,0 +1,66 @@
1
+ module PodBuilder
2
+ class Licenses
3
+ def self.write(licenses, all_buildable_items)
4
+ puts "Writing licenses".yellow
5
+ license_file_path = PodBuilder::project_path(Configuration.license_filename) + ".plist"
6
+
7
+ current_licenses = []
8
+ if File.exist?(license_file_path)
9
+ plist = CFPropertyList::List.new(:file => license_file_path)
10
+ dict = CFPropertyList.native_types(plist.value)
11
+ current_licenses = dict["PreferenceSpecifiers"]
12
+
13
+ licenses_header = current_licenses.shift
14
+ raise "Unexpected license found in header" if licenses_header.has_key?("License")
15
+ license_footer = current_licenses.pop
16
+ raise "Unexpected license found in footer" if license_footer.has_key?("License")
17
+ end
18
+
19
+ if licenses.count > 0
20
+ licenses_header = licenses.shift
21
+ raise "Unexpected license found in header" if licenses_header.has_key?("License")
22
+ license_footer = licenses.pop
23
+ raise "Unexpected license found in footer" if license_footer.has_key?("License")
24
+
25
+ lincenses_titles = licenses.map { |x| x["Title"] }
26
+ current_licenses.select! { |x| !lincenses_titles.include?(x["Title"]) }
27
+ end
28
+
29
+ licenses += current_licenses # merge with existing license
30
+ licenses.uniq! { |x| x["Title"] }
31
+ licenses.sort_by! { |x| x["Title"] }
32
+ licenses.select! { |x| !Configuration.skip_licenses.include?(x["Title"]) }
33
+ licenses.select! { |x| all_buildable_items.map(&:root_name).include?(x["Title"]) } # Remove items that are no longer included
34
+
35
+ license_dict = {}
36
+ license_dict["PreferenceSpecifiers"] = [licenses_header, licenses, license_footer].flatten
37
+ license_dict["StringsTable"] = "Acknowledgements"
38
+ license_dict["Title"] = license_dict["StringsTable"]
39
+
40
+ plist = CFPropertyList::List.new
41
+ plist.value = CFPropertyList.guess(license_dict)
42
+ plist.save(license_file_path, CFPropertyList::List::FORMAT_BINARY)
43
+
44
+ write_markdown(license_file_path)
45
+ end
46
+
47
+ private
48
+
49
+ def self.write_markdown(plist_path)
50
+ plist = CFPropertyList::List.new(:file => plist_path)
51
+ dict = CFPropertyList.native_types(plist.value)
52
+ licenses = dict["PreferenceSpecifiers"]
53
+ header = licenses.shift
54
+
55
+ markdown = []
56
+ markdown += ["# #{header["Title"]}", header["FooterText"], ""]
57
+ markdown += licenses.map { |x| ["## #{x["Title"]}", x["FooterText"], ""] }
58
+
59
+ markdown.flatten!
60
+
61
+ markdown_path = plist_path.chomp(File.extname(plist_path)) + ".md"
62
+
63
+ File.write(markdown_path, markdown.join("\n"))
64
+ end
65
+ end
66
+ end
@@ -80,6 +80,10 @@ module PodBuilder
80
80
  end
81
81
 
82
82
  def self.write_restorable(updated_pods, podfile_items, analyzer)
83
+ unless Configuration.restore_enabled
84
+ return
85
+ end
86
+
83
87
  puts "Writing Restore Podfile".yellow
84
88
 
85
89
  podfile_items = podfile_items.dup
@@ -199,8 +203,58 @@ module PodBuilder
199
203
  end
200
204
  end
201
205
 
206
+ def self.restore_podfile_clean(pod_items)
207
+ unless Configuration.restore_enabled
208
+ return
209
+ end
210
+
211
+ # remove pods that are no longer listed in pod_items
212
+ podfile_restore_path = PodBuilder::basepath("Podfile.restore")
213
+
214
+ restore_content = File.read(podfile_restore_path)
215
+
216
+ cleaned_lines = []
217
+ restore_content.each_line do |line|
218
+ if pod_name = pod_definition_in(line, false)
219
+ if pod_items.map(&:name).include?(pod_name)
220
+ cleaned_lines.push(line)
221
+ end
222
+ else
223
+ cleaned_lines.push(line)
224
+ end
225
+ end
226
+
227
+ File.write(podfile_restore_path, cleaned_lines.join)
228
+ end
229
+
230
+ def self.restore_file_sanity_check
231
+ unless Configuration.restore_enabled
232
+ return nil
233
+ end
234
+
235
+ error = nil
236
+
237
+ begin
238
+ File.rename(PodBuilder::basepath("Podfile"), PodBuilder::basepath("Podfile.tmp2"))
239
+ File.rename(PodBuilder::basepath("Podfile.restore"), PodBuilder::basepath("Podfile"))
240
+
241
+ Analyze.installer_at(PodBuilder::basepath, false)
242
+ rescue Exception => e
243
+ error = e.to_s
244
+ ensure
245
+ File.rename(PodBuilder::basepath("Podfile"), PodBuilder::basepath("Podfile.restore"))
246
+ File.rename(PodBuilder::basepath("Podfile.tmp2"), PodBuilder::basepath("Podfile"))
247
+ end
248
+
249
+ if !error.nil?
250
+ FileUtils.rm(PodBuilder::basepath("Podfile.restore"))
251
+ end
252
+
253
+ return error
254
+ end
255
+
202
256
  private
203
-
257
+
204
258
  def self.indentation_from_file(path)
205
259
  content = File.read(path)
206
260
 
@@ -26,6 +26,10 @@ module PodBuilder
26
26
  #
27
27
  attr_reader :version
28
28
 
29
+ # @return Array<[String]> The available versions of the pod
30
+ #
31
+ attr_reader :available_versions
32
+
29
33
  # @return [String] Local path, if any
30
34
  #
31
35
  attr_accessor :path
@@ -138,6 +142,7 @@ module PodBuilder
138
142
  @libraries += extract_array(spec.root, "libraries")
139
143
 
140
144
  @version = spec.root.version.version
145
+ @available_versions = spec.respond_to?(:spec_source) ? spec.spec_source.versions(@root_name)&.map(&:to_s) : [@version]
141
146
 
142
147
  @swift_version = spec.root.swift_version&.to_s
143
148
  @module_name = spec.root.module_name
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-10 00:00:00.000000000 Z
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -239,7 +239,6 @@ files:
239
239
  - exe/pod_builder
240
240
  - lib/core_ext/string.rb
241
241
  - lib/pod_builder/analyze.rb
242
- - lib/pod_builder/cocoapods/analyzer.rb
243
242
  - lib/pod_builder/cocoapods/specification.rb
244
243
  - lib/pod_builder/command.rb
245
244
  - lib/pod_builder/command/build.rb
@@ -253,10 +252,11 @@ files:
253
252
  - lib/pod_builder/command/none.rb
254
253
  - lib/pod_builder/command/restore_all.rb
255
254
  - lib/pod_builder/command/switch.rb
256
- - lib/pod_builder/command/synch_podfile.rb
255
+ - lib/pod_builder/command/sync_podfile.rb
257
256
  - lib/pod_builder/configuration.rb
258
257
  - lib/pod_builder/core.rb
259
258
  - lib/pod_builder/install.rb
259
+ - lib/pod_builder/licenses.rb
260
260
  - lib/pod_builder/podfile.rb
261
261
  - lib/pod_builder/podfile/post_actions.rb
262
262
  - lib/pod_builder/podfile_item.rb
@@ -1,26 +0,0 @@
1
- module Pod
2
- class Installer
3
- class Analyzer
4
- def pods_and_deps_in_target(target_name, podfile_items)
5
- target_name = "Pods-#{target_name}"
6
-
7
- unless specs = result.specs_by_target.select { |key, value| key.label == target_name }.values.first
8
- return [], []
9
- end
10
- specs.select! { |x| podfile_items.map(&:name).include?(x.name) }
11
-
12
- target_pods = []
13
- specs.each do |spec|
14
- pod = podfile_items.detect { |x| x.name == spec.name }
15
- raise "Pod #{spec.name} not found while trying to build Podfile.restore!" if pod.nil?
16
- target_pods.push(pod)
17
- end
18
-
19
- target_dependencies = target_pods.map { |x| x.dependencies(podfile_items) }.flatten.uniq
20
- target_pods -= target_dependencies
21
-
22
- return target_pods.uniq, target_dependencies.uniq
23
- end
24
- end
25
- end
26
- end