cocoaseeds 0.7.1 → 0.8.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
  SHA1:
3
- metadata.gz: 3515b3bb59f4caee72cb773812b96cf22984eb21
4
- data.tar.gz: 78c9891f282fc20c2141da44d9a828a1d20bb98b
3
+ metadata.gz: ca06877ea5f6767a1203ce3df7ce37a116a051e9
4
+ data.tar.gz: d40683b4c70cb136050f8398faf01a01d384a317
5
5
  SHA512:
6
- metadata.gz: 73061623d8476cbd588cd2450e26101c6103357451c1f0e9b060f8f2222641eb40d78482271040b105d91e09b48797f7b13f510d8b4c28e574ed0b095d48983d
7
- data.tar.gz: a37d1938de0809cf4e902c7be66d4ac67fe8ea441473e81d2bfa28c029623cfb22eddf87e396e21562c6f3bab579eabc45892fc294abf2f48738ca6b20c0f91c
6
+ metadata.gz: 788fe09b09f8b3f1bb886f6549f43e5bc46267c3e07b77fc944c01bcfb4e057b8b75b5cbdc4235f63c93e16e205bca656eeda8d49da1239f6416761a3bd1105a
7
+ data.tar.gz: adf64b9030855dfa77c75f38c7e88ff8207f5d8fe7fabd6931fe65843a9bd2f5fd789b411cbf3d1a8b2f9bcb61fd13116ca12daec199fefaa681fa401e17e663
data/README.md CHANGED
@@ -45,6 +45,9 @@ github "devxoul/JLToast", "1.2.5", :files => "JLToast/*.{swift,h}"
45
45
  github "devxoul/SwipeBack", "1.0.4"
46
46
  github "SnapKit/SnapKit", :commit => "62e7645", :files => "Source/*.{swift,h}"
47
47
 
48
+ git "https://gitlab.com/MyCompany/CompanyLibrary.git", "1.1.0"
49
+ local "PrivateLibrary", "../libs/PrivateLibrary", :files => "Source/*.{swift,h}"
50
+
48
51
  target :MyAppTest do
49
52
  github "Quick/Quick", "v0.3.1", :files => "Quick/**.{swift,h}"
50
53
  github "Quick/Nimble", "v0.4.2", :files => "Nimble/**.{swift,h}"
@@ -219,6 +219,38 @@ module Seeds
219
219
  @current_target_name = nil
220
220
  end
221
221
 
222
+ def local(name, source_dir, options={})
223
+ self.validate_project
224
+ if not @current_target_name
225
+ target *self.project.targets.map(&:name) do
226
+ send(__callee__, name, source_dir, options)
227
+ end
228
+ else
229
+ seed = Seeds::Seed::LocalSeed.new
230
+ if not name
231
+ raise Seeds::Exception.new\
232
+ "Need a name to identifier."
233
+ else
234
+ seed.name = name
235
+ end
236
+
237
+ if not source_dir
238
+ raise Seeds::Exception.new\
239
+ "Need a source dir."
240
+ else
241
+ seed.source_dir = source_dir
242
+ end
243
+
244
+ seed.files = options[:files] || '**/*.{h,m,mm,swift}'
245
+ if seed.files.kind_of? String
246
+ seed.files = [seed.files]
247
+ end
248
+ seed.exclude_files = options[:exclude_files] || []
249
+ self.seeds[seed.name] = seed
250
+ self.targets[seed.name] ||= []
251
+ self.targets[seed.name] << @current_target_name.to_s
252
+ end
253
+ end
222
254
  # Creates a new instance of {#Seeds::Seed::GitHub} and adds to {#seeds}.
223
255
  #
224
256
  # @see #Seeds::Seed::GitHub
@@ -314,6 +346,44 @@ module Seeds
314
346
  end
315
347
  end
316
348
 
349
+ def git(repo, tag, options={})
350
+ self.validate_project
351
+ if not @current_target_name
352
+ target *self.project.targets.map(&:name) do
353
+ send(__callee__, repo, tag, options)
354
+ end
355
+ elsif not repo.end_with? ".git"
356
+ raise Seeds::Exception.new\
357
+ "#{repo}: is not a valid git repo.\n"
358
+ else
359
+ seed = Seeds::Seed::CustomSeed.new
360
+ seed.url = repo
361
+ seed.name = repo.split('/').last.sub /.git$/, ''
362
+ if tag.is_a? String
363
+ if options[:commit]
364
+ raise Seeds::Exception.new\
365
+ "#{repo}: Version and commit are both specified."
366
+ end
367
+ seed.version = tag
368
+ seed.files = options[:files] || '**/*.{h,m,mm,swift}'
369
+ seed.exclude_files = options[:exclude_files] || []
370
+ elsif tag.is_a? Hash
371
+ seed.commit = tag[:commit][0..6]
372
+ seed.files = tag[:files] || '**/*.{h,m,mm,swift}'
373
+ seed.exclude_files = options[:exclude_files] || []
374
+ end
375
+ if seed.files.kind_of? String
376
+ seed.files = [seed.files]
377
+ end
378
+ if seed.exclude_files.kind_of? String
379
+ seed.exclude_files = [seed.exclude_files]
380
+ end
381
+ self.seeds[seed.name] = seed
382
+ self.targets[seed.name] ||= []
383
+ self.targets[seed.name] << @current_target_name.to_s
384
+ end
385
+ end
386
+
317
387
  eval seedfile
318
388
  end
319
389
 
@@ -335,9 +405,18 @@ module Seeds
335
405
  # @!visibility private
336
406
  #
337
407
  def install_seeds
408
+ seed_dir = File.join self.root_path, "Seeds"
409
+ if not Dir.exist? seed_dir
410
+ Dir.mkdir seed_dir
411
+ end
412
+
338
413
  self.seeds.sort.each do |name, seed|
339
414
  dirname = File.join(self.root_path, "Seeds", seed.name)
340
- self.install_seed(seed, Shellwords.escape(dirname))
415
+ if seed.instance_of? Seeds::Seed::LocalSeed
416
+ self.install_local_seed(seed, Shellwords.escape(dirname))
417
+ else
418
+ self.install_seed(seed, Shellwords.escape(dirname))
419
+ end
341
420
 
342
421
  next if not seed.files
343
422
 
@@ -362,7 +441,6 @@ module Seeds
362
441
  end
363
442
  end
364
443
 
365
-
366
444
  # Installs new seed or updates existing seed in {#dirname}.
367
445
  #
368
446
  # @!visibility private
@@ -454,6 +532,23 @@ module Seeds
454
532
 
455
533
  end
456
534
 
535
+ def install_local_seed(seed, dirname)
536
+ FileUtils.rm_rf dirname
537
+ if not File.exist? dirname
538
+ say "Installing local seed: #{seed.name}"
539
+ Dir.mkdir dirname
540
+ end
541
+
542
+ if seed.source_dir
543
+ full_source_path = File.expand_path(seed.source_dir)
544
+ command = "cp -R #{full_source_path}/ #{self.root_path}/Seeds/#{seed.name}"
545
+ output = `#{command}`
546
+ else
547
+ raise Seeds::Exception.new\
548
+ "Not found source dir."
549
+ end
550
+ end
551
+
457
552
  # Append seed name as a prefix to file name and returns the path.
458
553
  #
459
554
  # @!visibility private
@@ -617,7 +712,9 @@ module Seeds
617
712
  def build_lockfile
618
713
  tree = { "SEEDS" => [] }
619
714
  self.seeds.each do |name, seed|
620
- tree["SEEDS"] << "#{name} (#{seed.version or '$' + seed.commit})"
715
+ if not seed.instance_of? Seeds::Seed::LocalSeed
716
+ tree["SEEDS"] << "#{name} (#{seed.version or '$' + seed.commit})"
717
+ end
621
718
  end
622
719
  File.write(self.lockfile_path, YAML.dump(tree))
623
720
  end
@@ -44,5 +44,22 @@ module Seeds
44
44
  "#{self.name} (#{self.version})"
45
45
  end
46
46
  end
47
+
48
+ class LocalSeed < Seed
49
+ # @return [String] the source directory of the seed
50
+ #
51
+ attr_accessor :source_dir
52
+
53
+ def to_s
54
+ "#{self.name} (#{self.source_dir})"
55
+ end
56
+ end
57
+
58
+ class CustomSeed < Seed
59
+ def to_s
60
+ "#{self.name} (#{self.version})"
61
+ end
62
+ end
63
+
47
64
  end
48
65
  end
@@ -1,3 +1,3 @@
1
1
  module Seeds
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoaseeds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suyeol Jeon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-11 00:00:00.000000000 Z
11
+ date: 2016-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj