tileset_tooling 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +35 -0
  3. data/.gitignore +8 -0
  4. data/.rubocop.yml +63 -0
  5. data/.ruby-version +1 -0
  6. data/.vscode/settings.json +16 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +161 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.rdoc +59 -0
  11. data/Rakefile +54 -0
  12. data/bin/tileset_tooling +7 -0
  13. data/features/insert_bleed.feature +56 -0
  14. data/features/step_definitions/file_steps.rb +19 -0
  15. data/features/step_definitions/help_steps.rb +10 -0
  16. data/features/step_definitions/insert_bleed_steps.rb +28 -0
  17. data/features/support/configuration.rb +18 -0
  18. data/features/support/env.rb +19 -0
  19. data/features/support/test_data.rb +16 -0
  20. data/features/tileset_tooling.feature +7 -0
  21. data/lib/tileset_tooling.rb +4 -0
  22. data/lib/tileset_tooling/app.rb +58 -0
  23. data/lib/tileset_tooling/commands.rb +22 -0
  24. data/lib/tileset_tooling/commands/insert_bleed.rb +126 -0
  25. data/lib/tileset_tooling/data.rb +13 -0
  26. data/lib/tileset_tooling/data/tile.rb +30 -0
  27. data/lib/tileset_tooling/data/tileset.rb +96 -0
  28. data/lib/tileset_tooling/data/types.rb +11 -0
  29. data/lib/tileset_tooling/utils.rb +26 -0
  30. data/lib/tileset_tooling/version.rb +7 -0
  31. data/test/commands/insert_bleed_test.rb +76 -0
  32. data/test/data/UIpackSheet_transparent.png +0 -0
  33. data/test/data/expected/simple_with_bad_specs.png +0 -0
  34. data/test/data/expected/simple_with_margin.png +0 -0
  35. data/test/data/expected/simple_with_specs.png +0 -0
  36. data/test/data/simple_no_margin.png +0 -0
  37. data/test/data/simple_with_bad_specs.png +0 -0
  38. data/test/data/simple_with_bad_specs.specs +2 -0
  39. data/test/data/simple_with_margin.png +0 -0
  40. data/test/data/simple_with_specs.png +0 -0
  41. data/test/data/simple_with_specs.specs +7 -0
  42. data/test/data/source/simple_no_margin.xcf +0 -0
  43. data/test/data/source/simple_with_margin.xcf +0 -0
  44. data/test/test_helper.rb +23 -0
  45. data/test/utils_test.rb +12 -0
  46. data/tileset_tooling.gemspec +34 -0
  47. data/tileset_tooling.rdoc +48 -0
  48. metadata +317 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f4ef2f1fdedff5ed99ecaa3e5ae8abff27f0713d4aeb345b441260e1170dcf0b
4
+ data.tar.gz: 8aedce5b1c13268daf71424f6c759be677eab14d8046b6a07260fa891a9caa99
5
+ SHA512:
6
+ metadata.gz: f1cae98cca145f189b410bd1b823c2a8c82307dba322672b9a6db2692b1362d56d0063bda2e17560a468cf26b9c5e4e2a19bb8fbfdaaa309931a7b44f0e6f082
7
+ data.tar.gz: bb6567a71e7433d737a49592996f93cff8e158145dd214aa85e737736f1501a7ecc0fb5d9093d5e76a1266844ba2e0604d7e489aae3624e8542a01d598aaca9c
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
+ # uses: ruby/setup-ruby@v1
27
+ uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
28
+ with:
29
+ ruby-version: 2.6.3
30
+ - name: Install dependencies
31
+ run: |
32
+ sudo apt-get install imagemagick
33
+ bundle install
34
+ - name: Run tests
35
+ run: bundle exec rake
@@ -0,0 +1,8 @@
1
+ vendor/
2
+ .bundle
3
+ test/data/tmp_output.png
4
+
5
+ results.html
6
+ test/data/*_result.png
7
+
8
+ tileset_tooling-0.0.1.gem
@@ -0,0 +1,63 @@
1
+ inherit_mode:
2
+ merge:
3
+ - AllowedNames
4
+
5
+ AllCops:
6
+ EnabledByDefault: true
7
+ Include:
8
+ - 'bin/tileset_tooling'
9
+ - 'features/**/*.rb'
10
+ - 'lib/**/*.rb'
11
+ - 'test/**/*.rb'
12
+
13
+ Metrics/AbcSize:
14
+ Max: 50
15
+
16
+ Metrics/CyclomaticComplexity:
17
+ Max: 8
18
+
19
+ Layout/LineLength:
20
+ Max: 150
21
+
22
+ Metrics/MethodLength:
23
+ Max: 50
24
+
25
+ Metrics/ParameterLists:
26
+ Max: 7
27
+
28
+ Metrics/PerceivedComplexity:
29
+ Max: 8
30
+
31
+ Naming/MethodParameterName:
32
+ AllowedNames:
33
+ - x1
34
+ - y1
35
+ - x2
36
+ - y2
37
+
38
+ Style/DisableCopsWithinSourceCodeDirective:
39
+ Enabled: False
40
+
41
+ Style/Documentation:
42
+ Exclude:
43
+ - 'features/**/*'
44
+ - 'test/**/*'
45
+
46
+ Style/DocumentationMethod:
47
+ Exclude:
48
+ - 'features/**/*'
49
+ - 'test/**/*'
50
+
51
+ Style/MethodCallWithArgsParentheses:
52
+ Exclude:
53
+ - 'features/**/*'
54
+ - 'test/**/*'
55
+ IgnoredMethods:
56
+ - require
57
+
58
+ Style/Copyright:
59
+ Notice: '# Copyright \(c\) 2020 Jean-Sebastien Gelinas, see LICENSE\.txt'
60
+ AutocorrectNotice: '# Copyright (c) 2020 Jean-Sebastien Gelinas, see LICENSE.txt'
61
+
62
+ Style/ClassAndModuleChildren:
63
+ EnforcedStyle: compact
@@ -0,0 +1 @@
1
+ ruby-2.6.3
@@ -0,0 +1,16 @@
1
+ {
2
+ "ruby.format": "rubocop",
3
+ "ruby.intellisense": "rubyLocate",
4
+ "ruby.codeCompletion": "rcodetools",
5
+ "ruby.lint": {
6
+ "rubocop": {
7
+ "useBundler": true // enable rubocop via bundler
8
+ },
9
+ "reek": {
10
+ "useBundler": true // enable reek via bundler
11
+ }
12
+ },
13
+ "editor.insertSpaces": true,
14
+ "editor.tabSize": 2,
15
+ "editor.detectIndentation": true
16
+ }
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ ruby "2.6.3"
2
+ source 'https://rubygems.org'
3
+ gemspec
@@ -0,0 +1,161 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tileset_tooling (0.0.1)
5
+ dry-struct (~> 1.3, >= 1.3.0)
6
+ gli (~> 2.19, = 2.19.2)
7
+ highline (~> 2.0, >= 2.0.3)
8
+ mini_magick (~> 4.10, >= 4.10.1)
9
+ semantic_logger (~> 4.7, >= 4.7.2)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activesupport (6.0.3.3)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 0.7, < 2)
17
+ minitest (~> 5.1)
18
+ tzinfo (~> 1.1)
19
+ zeitwerk (~> 2.2, >= 2.2.2)
20
+ aruba (1.0.3)
21
+ childprocess (>= 2.0, < 5.0)
22
+ contracts (~> 0.16.0)
23
+ cucumber (>= 2.4, < 6.0)
24
+ ffi (~> 1.9)
25
+ rspec-expectations (~> 3.4)
26
+ thor (~> 1.0)
27
+ ast (2.4.1)
28
+ builder (3.2.4)
29
+ childprocess (4.0.0)
30
+ concurrent-ruby (1.1.7)
31
+ contracts (0.16.0)
32
+ cucumber (5.1.1)
33
+ builder (~> 3.2, >= 3.2.4)
34
+ cucumber-core (~> 8.0, >= 8.0.1)
35
+ cucumber-create-meta (~> 2.0, >= 2.0.2)
36
+ cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
37
+ cucumber-gherkin (~> 15.0, >= 15.0.2)
38
+ cucumber-html-formatter (~> 9.0, >= 9.0.0)
39
+ cucumber-messages (~> 13.0, >= 13.0.1)
40
+ cucumber-wire (~> 4.0, >= 4.0.1)
41
+ diff-lcs (~> 1.4, >= 1.4.4)
42
+ multi_test (~> 0.1, >= 0.1.2)
43
+ sys-uname (~> 1.2, >= 1.2.1)
44
+ cucumber-core (8.0.1)
45
+ cucumber-gherkin (~> 15.0, >= 15.0.2)
46
+ cucumber-messages (~> 13.0, >= 13.0.1)
47
+ cucumber-tag-expressions (~> 2.0, >= 2.0.4)
48
+ cucumber-create-meta (2.0.2)
49
+ cucumber-messages (~> 13.0, >= 13.0.1)
50
+ sys-uname (~> 1.2, >= 1.2.1)
51
+ cucumber-cucumber-expressions (10.3.0)
52
+ cucumber-gherkin (15.0.2)
53
+ cucumber-messages (~> 13.0, >= 13.0.1)
54
+ cucumber-html-formatter (9.0.0)
55
+ cucumber-messages (~> 13.0, >= 13.0.1)
56
+ cucumber-messages (13.0.1)
57
+ protobuf-cucumber (~> 3.10, >= 3.10.8)
58
+ cucumber-tag-expressions (2.0.4)
59
+ cucumber-wire (4.0.1)
60
+ cucumber-core (~> 8.0, >= 8.0.1)
61
+ cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
62
+ cucumber-messages (~> 13.0, >= 13.0.1)
63
+ diff-lcs (1.4.4)
64
+ dry-configurable (0.11.6)
65
+ concurrent-ruby (~> 1.0)
66
+ dry-core (~> 0.4, >= 0.4.7)
67
+ dry-equalizer (~> 0.2)
68
+ dry-container (0.7.2)
69
+ concurrent-ruby (~> 1.0)
70
+ dry-configurable (~> 0.1, >= 0.1.3)
71
+ dry-core (0.4.9)
72
+ concurrent-ruby (~> 1.0)
73
+ dry-equalizer (0.3.0)
74
+ dry-inflector (0.2.0)
75
+ dry-logic (1.0.7)
76
+ concurrent-ruby (~> 1.0)
77
+ dry-core (~> 0.2)
78
+ dry-equalizer (~> 0.2)
79
+ dry-struct (1.3.0)
80
+ dry-core (~> 0.4, >= 0.4.4)
81
+ dry-equalizer (~> 0.3)
82
+ dry-types (~> 1.3)
83
+ ice_nine (~> 0.11)
84
+ dry-types (1.4.0)
85
+ concurrent-ruby (~> 1.0)
86
+ dry-container (~> 0.3)
87
+ dry-core (~> 0.4, >= 0.4.4)
88
+ dry-equalizer (~> 0.3)
89
+ dry-inflector (~> 0.1, >= 0.1.2)
90
+ dry-logic (~> 1.0, >= 1.0.2)
91
+ ffi (1.13.1)
92
+ gli (2.19.2)
93
+ highline (2.0.3)
94
+ i18n (1.8.5)
95
+ concurrent-ruby (~> 1.0)
96
+ ice_nine (0.11.2)
97
+ middleware (0.1.0)
98
+ mini_magick (4.10.1)
99
+ minitest (5.14.2)
100
+ mocha (1.11.2)
101
+ multi_test (0.1.2)
102
+ parallel (1.19.2)
103
+ parser (2.7.1.4)
104
+ ast (~> 2.4.1)
105
+ power_assert (1.2.0)
106
+ protobuf-cucumber (3.10.8)
107
+ activesupport (>= 3.2)
108
+ middleware
109
+ thor
110
+ thread_safe
111
+ rainbow (3.0.0)
112
+ rake (12.3.3)
113
+ rdoc (6.2.1)
114
+ regexp_parser (1.7.1)
115
+ rexml (3.2.4)
116
+ rspec-expectations (3.9.2)
117
+ diff-lcs (>= 1.2.0, < 2.0)
118
+ rspec-support (~> 3.9.0)
119
+ rspec-support (3.9.3)
120
+ rubocop (0.90.0)
121
+ parallel (~> 1.10)
122
+ parser (>= 2.7.1.1)
123
+ rainbow (>= 2.2.2, < 4.0)
124
+ regexp_parser (>= 1.7)
125
+ rexml
126
+ rubocop-ast (>= 0.3.0, < 1.0)
127
+ ruby-progressbar (~> 1.7)
128
+ unicode-display_width (>= 1.4.0, < 2.0)
129
+ rubocop-ast (0.4.0)
130
+ parser (>= 2.7.1.4)
131
+ ruby-progressbar (1.10.1)
132
+ semantic_logger (4.7.2)
133
+ concurrent-ruby (~> 1.0)
134
+ sys-uname (1.2.1)
135
+ ffi (>= 1.0.0)
136
+ test-unit (3.3.6)
137
+ power_assert
138
+ thor (1.0.1)
139
+ thread_safe (0.3.6)
140
+ tzinfo (1.2.7)
141
+ thread_safe (~> 0.1)
142
+ unicode-display_width (1.7.0)
143
+ zeitwerk (2.4.0)
144
+
145
+ PLATFORMS
146
+ ruby
147
+
148
+ DEPENDENCIES
149
+ aruba (~> 1.0, >= 1.0.3)
150
+ mocha (~> 1.11, >= 1.11.2)
151
+ rake (~> 12.3, >= 12.3.3)
152
+ rdoc (~> 6.2, >= 6.2.1)
153
+ rubocop (~> 0.90, >= 0.90.0)
154
+ test-unit (~> 3.3, >= 3.3.6)
155
+ tileset_tooling!
156
+
157
+ RUBY VERSION
158
+ ruby 2.6.3p62
159
+
160
+ BUNDLED WITH
161
+ 1.17.2
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Jean-Sebastien Gelinas
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.
@@ -0,0 +1,59 @@
1
+ = tileset_tooling
2
+
3
+ {<img src="https://github.com/calestar/tileset_tooling/workflows/Ruby/badge.svg?branch=master" alt="Build Status" />}[https://github.com/calestar/tileset_tooling/actions?query=workflow%3ARuby]
4
+ {<img src="https://ruby-gem-downloads-badge.herokuapp.com/tileset_tooling?metric=true" alt="Build Status" />}[https://rubygems.org/gems/tileset_tooling]
5
+
6
+ Bits of tooling I use for working with tilesets.
7
+
8
+ == Use
9
+ Install if you need to:
10
+
11
+ sudo apt-get install imagemagick
12
+
13
+ You can then clone this repository, and run the following in the cloned directory:
14
+
15
+ bundle install
16
+ bundle exec tileset_tooling help
17
+
18
+ Documentation for all the commands can be found in {tileset_tooling.rdoc}[https://github.com/calestar/tileset_tooling/blob/master/tileset_tooling.rdoc].
19
+
20
+ == Contributing to the project
21
+ === Local setup
22
+ Nothing special is needed to run this tool besides the normal runtime environment. You will need to follow the {Use section}[rdoc-label:label-Use].
23
+
24
+ === Submitting a Pull Request
25
+ If you want to work on something, make sure an issue for that feature/bug exists and is approved. If it is not, you might spend time on something
26
+ that won't be merged into master.
27
+
28
+ Once you select work to be done:
29
+ 1. Fork the repository
30
+ 2. Create a branch with either the issue ID as name, or a meaningful name
31
+ 3. Work on the branch, make sure to rebase often since only branches on tip of master will be accepted
32
+ 4. Make sure to add new tests/features/documentation in your branch
33
+ 5. Create pull request, wait for feedback
34
+
35
+ === Generating <tt>tileset_tooling.rdoc</tt>
36
+ This file contains all the documentation for all the commands. It is automatically generated by +gli+ when running:
37
+
38
+ bundle exec tileset_tooling _doc
39
+
40
+ === Validating gem before pushing
41
+ Easiest way to validate the gem is to create a RVM virtual environment. In order to do so, simply run the following:
42
+
43
+ $ gem build tileset_tooling.gemspec
44
+ $ rvm gemset create project1
45
+ $ rvm gemset use project1
46
+ $ gem install tileset_tooling-0.0.1.gem
47
+ $ tileset_tooling help
48
+ $ rvm gemset use default
49
+ $ rvm gemset delete project1
50
+
51
+ == Credits
52
+ === Author
53
+ Jean-Sebastien Gelinas (aka {calestar}[https://github.com/calestar]).
54
+
55
+ === Copyright
56
+ Copyright © 2020 by Jean-Sebastien Gelinas
57
+
58
+ === License
59
+ Distributes under the MIT License, see LICENSE.txt in the source distro
@@ -0,0 +1,54 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ require 'cucumber'
6
+ require 'cucumber/rake/task'
7
+ require 'rubocop/rake_task'
8
+
9
+ Rake::RDocTask.new do |rd|
10
+ rd.main = "README.rdoc"
11
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
12
+ rd.title = 'Your application title'
13
+ end
14
+
15
+ spec = eval(File.read('tileset_tooling.gemspec'))
16
+
17
+ Gem::PackageTask.new(spec) do |pkg|
18
+ end
19
+
20
+ CUKE_RESULTS = 'results.html'
21
+ CLEAN << CUKE_RESULTS
22
+
23
+ desc 'Run features'
24
+ Cucumber::Rake::Task.new(:features) do |t|
25
+ opts = "features --publish-quiet --format html -o #{CUKE_RESULTS} --format progress -x"
26
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
27
+ t.cucumber_opts = opts
28
+ t.fork = false
29
+ end
30
+
31
+ desc 'Run features tagged as work-in-progress (@wip)'
32
+ Cucumber::Rake::Task.new('features:wip') do |t|
33
+ tag_opts = ' --publish-quiet --tags ~@pending'
34
+ tag_opts = ' --tags @wip'
35
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
36
+ t.fork = false
37
+ end
38
+
39
+ task :cucumber => :features
40
+ task 'cucumber:wip' => 'features:wip'
41
+ task :wip => 'features:wip'
42
+ require 'rake/testtask'
43
+ Rake::TestTask.new do |t|
44
+ t.libs << "test"
45
+ t.pattern = 'test/**/*_test.rb'
46
+ t.warning = false
47
+ end
48
+
49
+ desc 'Run RuboCop'
50
+ RuboCop::RakeTask.new(:rubocop) do |task|
51
+ task.fail_on_error = false
52
+ end
53
+
54
+ task :default => [:rubocop, :test, :features]
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (c) 2020 Jean-Sebastien Gelinas, see LICENSE.txt
3
+ # frozen_string_literal: true
4
+
5
+ require 'tileset_tooling'
6
+
7
+ exit(::TilesetTooling::App.run(::ARGV))