xcassets 0.1.0 → 0.2.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
- SHA1:
3
- metadata.gz: aba4781c8d422f88d7431e60e86879dfd6134f4d
4
- data.tar.gz: 72474205a1ba7e032524b7482756f24b405427e7
2
+ SHA256:
3
+ metadata.gz: fb39c7f818049dbfa0ac3b21e2b3dd932ab9d1411d01eae9b09472d2c36e3cbb
4
+ data.tar.gz: be77472318564c62d47643446c5bd20566c9506bbf63d08b03e4c3c4703a5d10
5
5
  SHA512:
6
- metadata.gz: 93cf09c33f9c22de3c0f85debf17fb401d85843be5cc169a67e87bdf40a753f15e51a60048b88cf9a916bc19563b0223e81715c6d4a30089dc6419b32469c75c
7
- data.tar.gz: 340da785986d5f252459045eee98c274e0780b249544334d0edbd6bcca16aa0a77a7cfae7c8f071e634543860a3b933990f0e33d09edc167b54c85ad2732ad6c
6
+ metadata.gz: a7abce30c9f27b268460670acd7ef9912981fab751c5bdcb095e70726746f33c0ac5091c5b8d86474f9c25773bc53261aaf6d93153ebb5d23d04e3f5f39103cc
7
+ data.tar.gz: cbe62120bff4b9cf459a8ea8354d0603c9235a7fff3fbe6c8fc6d17caa56760ea4bdfa030bc7eb674bc44ca94a580a0d0140ddbfe74bdbb99b104172536a2cb4
data/lib/xcassets/dsl.rb CHANGED
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xcassets'
2
4
 
3
5
  module XCAssets
4
- module DSL
6
+ module DSL # :nodoc:
5
7
  def xcassets(name, **options, &block)
6
8
  @assets = ::XCAssets::XCAssets.new(name, **options)
7
9
  instance_eval(&block)
@@ -10,7 +12,7 @@ module XCAssets
10
12
 
11
13
  def iconset(name, **options, &block)
12
14
  @iconset = ::XCAssets::Iconset.new(name, **options)
13
- @assets.add(@iconset) if @assets
15
+ @assets&.add(@iconset)
14
16
  instance_eval(&block)
15
17
  @iconset
16
18
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module XCAssets
4
- class Iconset
6
+ class Iconset # :nodoc:
5
7
  attr_reader :name, :author, :version, :images
6
8
 
7
9
  def initialize(name, author: 'xcassets', version: 1)
@@ -1,14 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
4
  require 'fastimage'
3
5
 
4
6
  module XCAssets
5
- class Image
7
+ class Image # :nodoc:
6
8
  attr_reader :source, :filename, :size, :idiom, :scale
7
9
 
8
10
  def initialize(source, filename: nil, size: nil, idiom: nil, scale: nil)
9
- unless File.readable?(source)
10
- raise IOError, "#{File.absolute_path(source)} is not readable."
11
- end
11
+ raise IOError, "#{File.absolute_path(source)} is not readable." unless File.readable?(source)
12
+
12
13
  @source = source
13
14
  @filename = filename || File.basename(source)
14
15
  @size = size || FastImage.size(source).join('x')
@@ -35,7 +36,8 @@ module XCAssets
35
36
  def guess_idiom
36
37
  if @filename.include?('~iphone') then :iphone
37
38
  elsif @filename.include?('~ipad') then :ipad
38
- else :universal
39
+ else
40
+ :universal
39
41
  end
40
42
  end
41
43
 
@@ -43,7 +45,8 @@ module XCAssets
43
45
  basename = File.basename(@filename, '.*')
44
46
  if basename.end_with?('@2x') then 2
45
47
  elsif basename.end_with?('@3x') then 3
46
- else 1
48
+ else
49
+ 1
47
50
  end
48
51
  end
49
52
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module XCAssets
2
- VERSION = '0.1.0'.freeze
4
+ VERSION = '0.2.0'
3
5
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module XCAssets
4
- class XCAssets
6
+ class XCAssets # :nodoc:
5
7
  attr_reader :name, :author, :version, :iconsets
6
8
 
7
9
  def initialize(name, author: 'xcassets', version: 1)
data/lib/xcassets.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xcassets/xcassets'
2
4
  require 'xcassets/iconset'
3
5
  require 'xcassets/image'
metadata CHANGED
@@ -1,85 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcassets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryosuke Ito
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2022-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastimage
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 1.8.1
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 1.8.1
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.13'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.13'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '10.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
15
  requirement: !ruby/object:Gem::Requirement
58
16
  requirements:
59
17
  - - ">="
60
18
  - !ruby/object:Gem::Version
61
19
  version: '0'
62
- type: :development
20
+ type: :runtime
63
21
  prerelease: false
64
22
  version_requirements: !ruby/object:Gem::Requirement
65
23
  requirements:
66
24
  - - ">="
67
25
  - !ruby/object:Gem::Version
68
26
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: minitest
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '5.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '5.0'
83
27
  description: Generates *.xcassets
84
28
  email:
85
29
  - rito.0305@gmail.com
@@ -87,26 +31,17 @@ executables: []
87
31
  extensions: []
88
32
  extra_rdoc_files: []
89
33
  files:
90
- - ".gitignore"
91
- - ".travis.yml"
92
- - Gemfile
93
- - Gemfile.lock
94
- - LICENSE.txt
95
- - README.md
96
- - Rakefile
97
- - bin/console
98
- - bin/setup
99
34
  - lib/xcassets.rb
100
35
  - lib/xcassets/dsl.rb
101
36
  - lib/xcassets/iconset.rb
102
37
  - lib/xcassets/image.rb
103
38
  - lib/xcassets/version.rb
104
39
  - lib/xcassets/xcassets.rb
105
- - xcassets.gemspec
106
40
  homepage: https://github.com/manicmaniac/xcassets
107
41
  licenses:
108
42
  - MIT
109
- metadata: {}
43
+ metadata:
44
+ rubygems_mfa_required: 'true'
110
45
  post_install_message:
111
46
  rdoc_options: []
112
47
  require_paths:
@@ -115,15 +50,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
50
  requirements:
116
51
  - - ">="
117
52
  - !ruby/object:Gem::Version
118
- version: '0'
53
+ version: 2.6.0
119
54
  required_rubygems_version: !ruby/object:Gem::Requirement
120
55
  requirements:
121
56
  - - ">="
122
57
  - !ruby/object:Gem::Version
123
58
  version: '0'
124
59
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.4.5
60
+ rubygems_version: 3.0.3.1
127
61
  signing_key:
128
62
  specification_version: 4
129
63
  summary: Generates *.xcassets
data/.gitignore DELETED
@@ -1,54 +0,0 @@
1
- ### https://raw.github.com/github/gitignore/abad92dac5a4306f72242dae3bca6e277bce3615/Ruby.gitignore
2
-
3
- *.gem
4
- *.rbc
5
- /.config
6
- /coverage/
7
- /InstalledFiles
8
- /pkg/
9
- /spec/reports/
10
- /spec/examples.txt
11
- /test/tmp/
12
- /test/version_tmp/
13
- /tmp/
14
-
15
- # Used by dotenv library to load environment variables.
16
- # .env
17
-
18
- ## Specific to RubyMotion:
19
- .dat*
20
- .repl_history
21
- build/
22
- *.bridgesupport
23
- build-iPhoneOS/
24
- build-iPhoneSimulator/
25
-
26
- ## Specific to RubyMotion (use of CocoaPods):
27
- #
28
- # We recommend against adding the Pods directory to your .gitignore. However
29
- # you should judge for yourself, the pros and cons are mentioned at:
30
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
31
- #
32
- # vendor/Pods/
33
-
34
- ## Documentation cache and generated files:
35
- /.yardoc/
36
- /_yardoc/
37
- /doc/
38
- /rdoc/
39
-
40
- ## Environment normalization:
41
- /.bundle/
42
- /vendor/bundle
43
- /lib/bundler/man/
44
-
45
- # for a library or gem, you might want to ignore these files since the code is
46
- # intended to run in multiple environments; otherwise, check them in:
47
- # Gemfile.lock
48
- # .ruby-version
49
- # .ruby-gemset
50
-
51
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
52
- .rvmrc
53
-
54
-
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.2.2
5
- before_install: gem install bundler -v 1.13.2
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in xcassets.gemspec
4
- gemspec
data/Gemfile.lock DELETED
@@ -1,40 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- xcassets (0.1.0)
5
- fastimage (~> 1.8.1)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- addressable (2.4.0)
11
- ast (2.3.0)
12
- fastimage (1.8.1)
13
- addressable (~> 2.3, >= 2.3.5)
14
- minitest (5.9.1)
15
- parser (2.3.1.4)
16
- ast (~> 2.2)
17
- powerpack (0.1.1)
18
- rainbow (2.1.0)
19
- rake (10.5.0)
20
- rubocop (0.44.1)
21
- parser (>= 2.3.1.1, < 3.0)
22
- powerpack (~> 0.1)
23
- rainbow (>= 1.99.1, < 3.0)
24
- ruby-progressbar (~> 1.7)
25
- unicode-display_width (~> 1.0, >= 1.0.1)
26
- ruby-progressbar (1.8.1)
27
- unicode-display_width (1.1.1)
28
-
29
- PLATFORMS
30
- ruby
31
-
32
- DEPENDENCIES
33
- bundler (~> 1.13)
34
- minitest (~> 5.0)
35
- rake (~> 10.0)
36
- rubocop
37
- xcassets!
38
-
39
- BUNDLED WITH
40
- 1.13.2
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Ryosuke Ito <rito.0305@gmail.com>
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
13
- all 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
21
- THE SOFTWARE.
data/README.md DELETED
@@ -1,54 +0,0 @@
1
- # XCAssets
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/xcassets`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'xcassets'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install xcassets
22
-
23
- ## Usage
24
-
25
- ```ruby
26
- require 'xcassets/dsl'
27
-
28
- include XCAssets::DSL
29
-
30
- assets = xcassets 'Assets' do
31
- iconset 'LaunchImage' do
32
- image fixture('40x40.png') => 'Default.png'
33
- image fixture('40x40.png')
34
- end
35
- end
36
-
37
- assets.save(Dir.pwd)
38
- ```
39
-
40
- ## Development
41
-
42
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
-
44
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
-
46
- ## Contributing
47
-
48
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/xcassets.
49
-
50
-
51
- ## License
52
-
53
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
54
-
data/Rakefile DELETED
@@ -1,13 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
3
- require 'rubocop/rake_task'
4
-
5
- Rake::TestTask.new(:test) do |t|
6
- t.libs << 'test'
7
- t.libs << 'lib'
8
- t.test_files = FileList['test/**/*_test.rb']
9
- end
10
-
11
- RuboCop::RakeTask.new
12
-
13
- task default: [:test, :rubocop]
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'xcassets'
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 DELETED
@@ -1,8 +0,0 @@
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
data/xcassets.gemspec DELETED
@@ -1,30 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'xcassets/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'xcassets'
8
- spec.version = XCAssets::VERSION
9
- spec.authors = ['Ryosuke Ito']
10
- spec.email = ['rito.0305@gmail.com']
11
-
12
- spec.summary = 'Generates *.xcassets'
13
- spec.description = 'Generates *.xcassets'
14
- spec.homepage = 'https://github.com/manicmaniac/xcassets'
15
- spec.license = 'MIT'
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
- f.match(%r{^(test|spec|features)/})
19
- end
20
- spec.bindir = 'exe'
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ['lib']
23
-
24
- spec.add_runtime_dependency 'fastimage', '~> 1.8.1'
25
-
26
- spec.add_development_dependency 'bundler', '~> 1.13'
27
- spec.add_development_dependency 'rake', '~> 10.0'
28
- spec.add_development_dependency 'rubocop'
29
- spec.add_development_dependency 'minitest', '~> 5.0'
30
- end