merge_plist 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/merge_plist.rb +30 -0
  3. metadata +72 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 183535ff3dd71f8eb81d1d9a22998bebb156a0b6
4
+ data.tar.gz: c0c5629c5096d2344b05ec1cee3f1d23c4fae4af
5
+ SHA512:
6
+ metadata.gz: 4ec110d6cab617967525b562298a2a25e52390e6c34b8ae2ec5fccb144024e672e547cbb3354ef681a0571f3ec2427b33e43ba310a3becdd035d9e3f04783c2b
7
+ data.tar.gz: 82d615693d954bc37abd93ac221bdb1b4cb2963eaa816bbe2256950326e0fb0bfe7bbe9d4492d9800b9b675fbe67787e01458c6020f124382e5fa60e9e4281c0
@@ -0,0 +1,30 @@
1
+ require 'deep_merge'
2
+ require 'plist'
3
+
4
+ module MergePlist
5
+ def self.ensure_plist obj
6
+ if obj.class == String
7
+ return Plist::parse_xml obj
8
+ elsif obj.class == Hash
9
+ return obj
10
+ end
11
+
12
+ raise ArgumentError.new("invalid argument #{obj}")
13
+ end
14
+
15
+ def self.merge *targets
16
+ if targets.count == 2
17
+ return ensure_plist(targets[0])
18
+ .deep_merge(ensure_plist(targets[1]))
19
+ else
20
+ return merge(merge(targets[0], targets[1]), *targets.slice(2..-1))
21
+ end
22
+ end
23
+ end
24
+
25
+ a = MergePlist::merge(
26
+ File.read("google_idp_info.plist.erb"),
27
+ File.read("kakao_idp_info.plist.erb"),
28
+ File.read("facebook_idp_info.plist.erb"))
29
+
30
+ p a
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: merge_plist
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - pjc0247
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: plist
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: deep_merge
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: merge_plist
42
+ email:
43
+ - pjc0247@naver.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/merge_plist.rb
49
+ homepage: http://github.com/pjc0247/merge_plist
50
+ licenses: []
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project: merge_plist
68
+ rubygems_version: 2.4.5
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: merge_plist
72
+ test_files: []