xcassets_exporter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2bdd704e1c82a830532503f1c7dc950aab1b0a4d
4
+ data.tar.gz: 07edcb0b8b20397d3e747fb7cbf23966a2befc0f
5
+ SHA512:
6
+ metadata.gz: 0f4ba74903a994c31ebacca49f32c59bbaebad3ebb3178ecbfd9a4a70a7c039197f55098112a0035dd9e9563b4a02de9c5c9080ab678082312f9e0853c3aaf43
7
+ data.tar.gz: 6e00fd4d9f9ccf7381adac05dac8cf6a83e54dfe481046b52b230f949de13f7da1cb0f01e1d18ff90781b017bfc5c190a7080105542dd3915f9ee17e4b8df6af
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xcassets_exporter.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Yoonchul Koh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # XcassetsExporter
2
+
3
+ Export `xcassets` exclude `.imageset` directories and `Contents.json` from `Images.xcassets`.
4
+
5
+ ### Input
6
+ ```
7
+ Images.xcassets
8
+ |-TopScreen
9
+ | |-newButton.imageset
10
+ | | |-newButton.png
11
+ | | |-newButton@2x.png
12
+ | | |-newButton@3x.png
13
+ | | |-Contents.json
14
+ | |-contentView
15
+ | | |-header.imageset
16
+ | | | |-header.png
17
+ | | | |-header@2x.png
18
+ | | | |-header@3x.png
19
+ | | | |-Contents.json
20
+ ```
21
+
22
+ ### Output
23
+ ```
24
+ Images.xcassets
25
+ |-TopScreen
26
+ | |-newButton.png
27
+ | |-newButton@2x.png
28
+ | |-newButton@3x.png
29
+ | |-contentView
30
+ | | |-header.png
31
+ | | |-header@2x.png
32
+ | | |-header@3x.png
33
+ ```
34
+
35
+ ## Installation
36
+
37
+ Add this line to your application's Gemfile:
38
+
39
+ ```ruby
40
+ gem 'xcassets_exporter'
41
+ ```
42
+
43
+ And then execute:
44
+
45
+ $ bundle
46
+
47
+ Or install it yourself as:
48
+
49
+ $ gem install xcassets_exporter
50
+
51
+ ## Usage
52
+
53
+ ```
54
+ export_xcassets -i [Image.xcassets path] -o [Image directory]
55
+ ```
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yoonchulkoh/xcassets_exporter.
60
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "xcassets_exporter"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "xcassets_exporter"
4
+ require 'optparse'
5
+
6
+ option={}
7
+ OptionParser.new do |opt|
8
+ begin
9
+ opt.on('-i', '--input=SRC_PATH', 'xcassets source path') {|v| option[:input] = v}
10
+ opt.on('-o', '--output=DEST_PATH', 'export destination path') {|v| option[:output] = v}
11
+ opt.parse!(ARGV)
12
+ XcassetsExporter::Exporter.new.export(option[:input], option[:output])
13
+ rescue => e
14
+ puts "Error: #{e}.\nSee #{opt}"
15
+ exit
16
+ end
17
+ end
18
+
@@ -0,0 +1,6 @@
1
+ require "xcassets_exporter/version"
2
+ require "xcassets_exporter/exporter"
3
+
4
+ module XcassetsExporter
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,20 @@
1
+ require 'fileutils'
2
+
3
+ module XcassetsExporter
4
+ class Exporter
5
+ def export(src, dest)
6
+ raise "SRC_PATH and DEST_PATH is required" and return if src == nil || dest == nil
7
+ raise "SRC_PATH is not xcassets directory" and return unless src.end_with?("xcassets")
8
+
9
+ paths = Dir.glob("#{src}/**/*")
10
+ file_paths = paths.select do |path|
11
+ !(File.directory?(path) || path.end_with?("Contents.json"))
12
+ end
13
+ file_paths.map do |path|
14
+ new_path = path.gsub(src, dest).gsub(/\/[^\/]*\.imageset/, "")
15
+ FileUtils.mkdir_p(File.dirname(new_path))
16
+ FileUtils.cp(path, new_path)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module XcassetsExporter
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xcassets_exporter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xcassets_exporter"
8
+ spec.version = XcassetsExporter::VERSION
9
+ spec.authors = ["yoonchul.koh"]
10
+ spec.email = ["yoonchul.koh@gmail.com"]
11
+
12
+ spec.summary = %q{xcassets exporter}
13
+ spec.description = %q{xcassets exporter}
14
+ spec.homepage = "https://github.com/yoonchulkoh/xcassets_exporter"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.11"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcassets_exporter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - yoonchul.koh
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-06-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: xcassets exporter
56
+ email:
57
+ - yoonchul.koh@gmail.com
58
+ executables:
59
+ - xcassets_exporter
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - LICENSE
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - exe/xcassets_exporter
73
+ - lib/xcassets_exporter.rb
74
+ - lib/xcassets_exporter/exporter.rb
75
+ - lib/xcassets_exporter/version.rb
76
+ - xcassets_exporter.gemspec
77
+ homepage: https://github.com/yoonchulkoh/xcassets_exporter
78
+ licenses: []
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.5.1
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: xcassets exporter
100
+ test_files: []