pod-builder 0.6.0 → 0.7.0

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: 4482b9b27c940312353d43961f6f6295d10690bcdf1c13cad503058ed09b6db3
4
- data.tar.gz: c95ecae1dcbef118f09bf0409050d6a7e8fcb9549f63d453d021099c4b6b0391
3
+ metadata.gz: bf0fd6c7fa3523935f376b8a1c9cd375a86ef13da1d81762c9c1b678ca81581b
4
+ data.tar.gz: 28781b306ed31e7346d152f57069cd9883ea0f00bacca94a8f4a03c57039f47f
5
5
  SHA512:
6
- metadata.gz: f6bca5110b2ece5df63e49cb105034b7494ebbedf0206dca8b9e6c4a2cf043659683347c03e20c84de5b5645b7dbe38cfed9acdbf641e9a6e41bccfed3a21eb0
7
- data.tar.gz: fe8f9450bd522f13161d8cdd56f37a4dd134d029b1390c2457574e4bad8dfa82d501f485e48227c0cad4709c98f3e39f8cad66ae5a6730db90edfeefa12373ce
6
+ metadata.gz: 897c953a6bb6e73d8d1293328a90ca146d6a824d0df7c59b560acba01c7505d81119f787129101df116cbfec60997acb2389eab9fdeaa73c95c927f8c680241f
7
+ data.tar.gz: f2d58bc71c28c990474e6f289242f3b67d31f7bf39cc6ec354421facb6c072b44ce8ca8308c3eb414be860adb4d025011f09ac10683657fa04755dc3a14d723f
data/exe/pod_builder CHANGED
@@ -332,6 +332,8 @@ begin
332
332
  raise "\n\nFor safety do not run this as root\n".red
333
333
  end
334
334
 
335
+ PodBuilder::add_lock_file
336
+ valid_lock_file = true
335
337
  command_ret = parse_commandline
336
338
  rescue Exception => e
337
339
  error = e.to_s
@@ -341,17 +343,21 @@ rescue Exception => e
341
343
  puts e.backtrace.join("\n\t").red
342
344
  puts "\n\nCommand failed!".red
343
345
  else
344
- error_log = "/tmp/pod_builder.err"
346
+ error_log = File.join(PodBuilder::Configuration.build_path, "pod_builder.err")
345
347
  puts "\n\nCommand failed, check #{error_log}!".red
346
348
  File.write(error_log, error)
347
349
  end
348
350
  ensure
349
351
  if command_ret == 0
350
352
  PodBuilder::clean_basepath
353
+
351
354
  if !OPTIONS.has_key?(:debug)
352
355
  PodBuilder::safe_rm_rf(PodBuilder::Configuration.build_path)
353
356
  end
354
357
  end
358
+ if valid_lock_file
359
+ PodBuilder::remove_lock_file
360
+ end
355
361
 
356
362
  exit(command_ret)
357
363
  end
@@ -132,6 +132,7 @@ module PodBuilder
132
132
  end
133
133
 
134
134
  def self.expected_common_dependencies(pods_to_build, buildable_items)
135
+ warned_expected_pod_list = []
135
136
  expected_pod_list = []
136
137
  errors = []
137
138
 
@@ -145,8 +146,13 @@ module PodBuilder
145
146
  if buildable_pod.dependency_names.include?(dependency) && !buildable_pod.has_subspec(dependency) && !buildable_pod.has_common_spec(dependency) then
146
147
  expected_pod_list += pods_to_build.map(&:root_name) + [buildable_pod.root_name]
147
148
  expected_pod_list.uniq!
148
- errors.push("Can't build #{pod_to_build.name} because it has common dependencies (#{dependency}) with #{buildable_pod.name}.\n\nUse `pod_builder build #{expected_pod_list.join(" ")}` instead\n\n")
149
- errors.uniq!
149
+
150
+ expected_list = expected_pod_list.join(" ")
151
+ if !warned_expected_pod_list.include?(expected_list)
152
+ errors.push("Can't build #{pod_to_build.name} because it has common dependencies (#{dependency}) with #{buildable_pod.name}.\n\nUse `pod_builder build #{expected_list}` instead or use `pod_builder build -a #{pod_to_build.name}` to automatically resolve missing dependencies\n\n")
153
+ errors.uniq!
154
+ warned_expected_pod_list.push(expected_list)
155
+ end
150
156
  end
151
157
  end
152
158
  end
@@ -41,6 +41,7 @@ module PodBuilder
41
41
  attr_accessor :project_name
42
42
  attr_accessor :restore_enabled
43
43
  attr_accessor :framework_plist_filename
44
+ attr_accessor :lock_filename
44
45
  end
45
46
 
46
47
  @build_settings = DEFAULT_BUILD_SETTINGS
@@ -53,7 +54,7 @@ module PodBuilder
53
54
  @license_filename = "Pods-acknowledgements"
54
55
  @subspecs_to_split = []
55
56
  @development_pods_paths = []
56
- @build_path = "/tmp/pod_builder".freeze
57
+ @build_path = "/tmp/pod_builder_#{(Time.now.to_f * 1000).to_i}".freeze
57
58
  @configuration_filename = "PodBuilder.json".freeze
58
59
  @dev_pods_configuration_filename = "PodBuilderDevPodsPaths.json".freeze
59
60
  @lfs_min_file_size = MIN_LFS_SIZE_KB
@@ -62,6 +63,7 @@ module PodBuilder
62
63
  @project_name = ""
63
64
  @restore_enabled = true
64
65
  @framework_plist_filename = "PodBuilder.plist"
66
+ @lock_filename = "PodBuilder.lock"
65
67
 
66
68
  def self.check_inited
67
69
  raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil?
@@ -79,7 +81,11 @@ module PodBuilder
79
81
  Configuration.base_path = podbuilder_path
80
82
 
81
83
  if exists
82
- json = JSON.parse(File.read(config_path))
84
+ begin
85
+ json = JSON.parse(File.read(config_path))
86
+ rescue => exception
87
+ raise "\n\n#{File.basename(config_path)} is an invalid JSON\n".red
88
+ end
83
89
 
84
90
  if value = json["spec_overrides"]
85
91
  if value.is_a?(Hash) && value.keys.count > 0
@@ -150,7 +156,12 @@ module PodBuilder
150
156
  dev_pods_configuration_path = File.join(Configuration.base_path, Configuration.dev_pods_configuration_filename)
151
157
 
152
158
  if File.exist?(dev_pods_configuration_path)
153
- json = JSON.parse(File.read(dev_pods_configuration_path))
159
+ begin
160
+ json = JSON.parse(File.read(dev_pods_configuration_path))
161
+ rescue => exception
162
+ raise "\n\n#{File.basename(dev_pods_configuration_path)} is an invalid JSON\n".red
163
+ end
164
+
154
165
  Configuration.development_pods_paths = json || []
155
166
  Configuration.development_pods_paths.freeze
156
167
  end
@@ -91,6 +91,30 @@ module PodBuilder
91
91
  return swift_version
92
92
  end
93
93
 
94
+ def self.add_lock_file
95
+ lockfile_path = File.join(home, Configuration.lock_filename)
96
+
97
+ if File.exist?(lockfile_path)
98
+ if pid = File.read(lockfile_path)
99
+ begin
100
+ if Process.getpgid(pid)
101
+ raise "\n\nAnother PodBuilder pending task is running on this project\n".red
102
+ end
103
+ rescue
104
+ end
105
+ end
106
+ end
107
+
108
+ File.write(lockfile_path, Process.pid, mode: "w")
109
+ end
110
+
111
+ def self.remove_lock_file
112
+ lockfile_path = File.join(home, Configuration.lock_filename)
113
+ if File.exist?(lockfile_path)
114
+ FileUtils.rm(lockfile_path)
115
+ end
116
+ end
117
+
94
118
  private
95
119
 
96
120
  def self.home
@@ -98,4 +122,4 @@ module PodBuilder
98
122
  raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if h.empty?
99
123
  return h
100
124
  end
101
- end
125
+ end
@@ -105,7 +105,7 @@ module PodBuilder
105
105
  @name = spec.name
106
106
  @root_name = spec.name.split("/").first
107
107
 
108
- checkout_options_keys = [@name, @root_name]
108
+ checkout_options_keys = [@root_name, @name]
109
109
 
110
110
  if opts_key = checkout_options_keys.detect { |x| checkout_options.has_key?(x) }
111
111
  @repo = checkout_options[opts_key][:git]
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-13 00:00:00.000000000 Z
11
+ date: 2019-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler