zewo-dev 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zewo/version.rb +1 -1
  3. data/lib/zewo.rb +154 -14
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7caa55d8307364a926dd47f27e3572dd58dc63bd
4
- data.tar.gz: cad32cc0e839e4182b939f0bb7fee2bd5c85a7ea
3
+ metadata.gz: 7403c6b926202e7bc02eae2995f9cfe76e1b4e88
4
+ data.tar.gz: a1c384428305425517031772c7c37bc0095c1ab7
5
5
  SHA512:
6
- metadata.gz: 3421d0b33a4b17f157cd1fe00e35722b02756fc0d5f17b5529b437dad527ed7374da56048a081b18cd7e7cb36d8bd0b547937af4cdf6bc267d4f0c08c3a54593
7
- data.tar.gz: 6abf42351c179f663a67ee3bf01d421151c7d7bc00ed18d3284142fea767790ea8a546e66f457a11106de9578e562558a9cadff13a586fc860af78fd1482811e
6
+ metadata.gz: 3840e573f9d56bb2f8ac732dccbd84846f2ca337c9069ddddb9a8809765ce0b45c3aaeaa07d3e366dc20669255e3a1223d0b82465a0f3e5ee447eebd61f9c1a1
7
+ data.tar.gz: 99c9dac1da147e72d30ea426523378bf127274a6331abb5b1c6a5f20eb86cc7067d3999c3694133b9e02627a988de313c705f071e77b8d39864f61e5efce1d83
data/lib/zewo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zewo
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
data/lib/zewo.rb CHANGED
@@ -33,6 +33,11 @@ module Zewo
33
33
 
34
34
  def framework_target
35
35
  target_name = name.gsub('-OSX', '').gsub('-', '_')
36
+
37
+ if target_name == 'OS'
38
+ target_name = 'OperatingSystem'
39
+ end
40
+
36
41
  xcode_project.native_targets.find { |t| t.name == target_name } || xcode_project.new_target(:framework, target_name, :osx)
37
42
  end
38
43
 
@@ -96,10 +101,14 @@ module Zewo
96
101
 
97
102
  def build_dependencies
98
103
  puts "Configuring dependencies for #{name}".green
99
- dependency_repos = File.read(dir('Package.swift')).scan(/(?<=Zewo\/)(.*?)(?=\.git)/).map(&:first)
104
+ dependency_repos = File.read(dir('Package.swift')).scan(/(?<=Zewo\/|SwiftX\/|VeniceX\/|paulofaria\/)(.*?)(?=\.git)/).map(&:first)
105
+
106
+ # here we should do something like dependency_repos -= ['CMySQL', 'COpenSSL', 'CLibpq']
100
107
 
101
108
  group = xcode_project.new_group('Subprojects')
102
109
  dependency_repos.each do |repo_name|
110
+ next if repo_name.end_with?('-OSX')
111
+
103
112
  repo = Repo.new(repo_name)
104
113
  project_reference = group.new_file("#{repo.xcode_project_path}")
105
114
  project_reference.path = "../../#{project_reference.path}"
@@ -168,14 +177,7 @@ module Zewo
168
177
  request = Net::HTTP::Get.new(uri.request_uri)
169
178
 
170
179
  blacklist = [
171
- 'Core',
172
- 'GrandCentralDispatch',
173
- 'JSONParserMiddleware',
174
- 'LoggerMiddleware',
175
- 'Middleware',
176
- 'SSL',
177
- 'SwiftZMQ',
178
- 'HTTPMiddleware'
180
+ 'ZeroMQ'
179
181
  ]
180
182
 
181
183
  response = http.request(request)
@@ -252,6 +254,42 @@ module Zewo
252
254
  def master_branch?(repo_name)
253
255
  name = `cd #{repo_name}; git rev-parse --abbrev-ref HEAD`
254
256
  end
257
+
258
+ def each_osx_whitelisted_repo
259
+ Zewo::OSX_CODE_REPO_WHITELIST.each do |repo_name|
260
+
261
+ name = repo_name.split('/').last
262
+ if name.end_with?('-OSX')
263
+ name = name[0...-4]
264
+ end
265
+
266
+ repo_data = Hash[
267
+ 'name', name,
268
+ 'organization', repo_name.split('/').first,
269
+ 'clone_url', "https://github.com/#{repo_name}"
270
+ ]
271
+
272
+ yield Repo.new(repo_data['name'], repo_data)
273
+ end
274
+ end
275
+
276
+ def each_osx_whitelisted_repo_async
277
+ threads = []
278
+ each_osx_whitelisted_repo do |repo|
279
+ threads << Thread.new do
280
+ yield(repo)
281
+ end
282
+ end
283
+ ThreadsWait.all_waits(*threads)
284
+ end
285
+
286
+ def checkout_modulemap_versions
287
+ repos = ['CLibvenice', 'CURIParser', 'CHTTPParser']
288
+ repos.each do |repo|
289
+ silent_cmd("cd #{repo} && git checkout 0.2.0")
290
+ puts "Checked out #{repo} at 0.2.0".green
291
+ end
292
+ end
255
293
  end
256
294
 
257
295
  desc :status, 'Get status of all repos'
@@ -290,11 +328,12 @@ module Zewo
290
328
  return
291
329
  end
292
330
 
293
- each_code_repo do |repo|
331
+ Dir['*/'].each do |folder_name|
332
+ folder_name = folder_name[0...-1]
294
333
  matched = nil
295
334
 
296
335
  if options[:tag]
297
- matched = `cd #{repo.name} && git tag`
336
+ matched = `cd #{folder_name} && git tag`
298
337
  .split("\n")
299
338
  .select { |t| t.start_with?(options[:tag]) }
300
339
  .last
@@ -305,10 +344,10 @@ module Zewo
305
344
  end
306
345
 
307
346
  if matched
308
- silent_cmd("cd #{repo.name} && git checkout #{matched}")
309
- puts "Checked out #{repo.name} at #{matched}".green
347
+ silent_cmd("cd #{folder_name} && git checkout #{matched}")
348
+ puts "Checked out #{folder_name} at #{matched}".green
310
349
  else
311
- puts "No matching specifiers for #{repo.name}".red
350
+ puts "No matching specifiers for #{folder_name}".red
312
351
  end
313
352
  end
314
353
  end
@@ -346,5 +385,106 @@ module Zewo
346
385
  end
347
386
  puts 'Done!'
348
387
  end
388
+
389
+ desc :clone_osx_dev, 'Clones repositories for OSX development'
390
+ def clone_osx_dev
391
+ puts 'Cloning repositories...'
392
+ each_osx_whitelisted_repo_async do |repo|
393
+ unless File.directory?(repo.name)
394
+ print "Cloning #{repo.data['organization']}/#{repo.name}...".green + "\n"
395
+ silent_cmd("git clone #{repo.data['clone_url']}")
396
+
397
+ cloned_name = repo.data['clone_url'].split('/').last
398
+ if cloned_name.end_with?('-OSX')
399
+ FileUtils.mv cloned_name, cloned_name[0...-4]
400
+ end
401
+ end
402
+ end
403
+ end
404
+
405
+ desc :make_osx_dev_projects, 'Makes Xcode projects for OSX development repositories'
406
+ def make_osx_dev_projects
407
+ each_osx_whitelisted_repo(&:configure_xcode_project)
408
+ each_osx_whitelisted_repo(&:build_dependencies)
409
+ end
410
+
411
+ desc :setup_osx_dev, 'Sets up OSX development environment (clone, checkout, create xcode projects)'
412
+ option :version, :required => true
413
+ def setup_osx_dev()
414
+ clone_osx_dev()
415
+
416
+ invoke 'checkout', [], :tag => options[:version]
417
+
418
+ checkout_modulemap_versions()
419
+
420
+ make_osx_dev_projects()
421
+ end
349
422
  end
423
+
424
+ OSX_CODE_REPO_WHITELIST = [
425
+
426
+ # Zewo stuff
427
+ 'zewo/Base64',
428
+ 'zewo/BasicAuthMiddleware',
429
+ 'zewo/ContentNegotiationMiddleware',
430
+ 'zewo/Data',
431
+ 'zewo/Event',
432
+ 'zewo/HTTP',
433
+ 'zewo/HTTPJSON',
434
+ 'zewo/HTTPParser',
435
+ 'zewo/HTTPSerializer',
436
+ 'zewo/InterchangeData',
437
+ 'zewo/JSON',
438
+ 'zewo/JSONMediaType',
439
+ 'zewo/Log',
440
+ 'zewo/LogMiddleware',
441
+ 'zewo/MediaType',
442
+ 'zewo/Mustache',
443
+ 'zewo/MySQL',
444
+ 'zewo/OS',
445
+ 'zewo/OpenSSL', 'paulofaria/stream', #just for OpenSSL
446
+ 'zewo/POSIXRegex',
447
+ 'zewo/PathParameterMiddleware',
448
+ 'zewo/PostgreSQL',
449
+ 'zewo/RecoveryMiddleware',
450
+ 'zewo/RegexRouteMatcher',
451
+ 'zewo/Router',
452
+ 'zewo/SQL',
453
+ 'zewo/Sideburns',
454
+ 'zewo/String',
455
+ 'zewo/TrieRouteMatcher',
456
+ 'zewo/URI',
457
+ 'zewo/URLEncodedForm',
458
+ 'zewo/URLEncodedFormMediaType',
459
+ 'zewo/WebSocket',
460
+ 'zewo/ZeroMQ',
461
+ 'zewo/Zewo',
462
+
463
+ # C stuff
464
+ 'zewo/CHTTPParser',
465
+ 'zewo/CLibpq-OSX',
466
+ 'zewo/CMySQL-OSX',
467
+ 'zewo/COpenSSL-OSX',
468
+ 'zewo/CURIParser',
469
+ 'zewo/CZeroMQ',
470
+
471
+ # VeniceX stuff
472
+ 'venicex/CLibvenice',
473
+ 'venicex/Venice',
474
+ 'venicex/IP',
475
+ 'venicex/TCP',
476
+ 'venicex/UDP',
477
+ 'venicex/HTTPServer',
478
+ 'venicex/HTTPClient',
479
+ 'venicex/TCPSSL',
480
+ 'venicex/HTTPSServer',
481
+ 'venicex/HTTPSClient',
482
+ 'venicex/File',
483
+ 'venicex/HTTPFile',
484
+ 'venicex/ChannelStream',
485
+
486
+ # SwiftX stuff
487
+ 'swiftx/S4',
488
+ 'swiftx/C7'
489
+ ]
350
490
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zewo-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ask
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-21 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj