procreate-swatches 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +7 -0
  3. data/.gitignore +16 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +8 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +19 -0
  8. data/.yardopts +5 -0
  9. data/CODE_OF_CONDUCT.md +74 -0
  10. data/Gemfile +6 -0
  11. data/Gemfile.lock +102 -0
  12. data/LICENSE.txt +21 -0
  13. data/README.md +230 -0
  14. data/Rakefile +8 -0
  15. data/bin/console +14 -0
  16. data/bin/setup +8 -0
  17. data/doc/Procreate/Swatches/ColorsHelper.html +693 -0
  18. data/doc/Procreate/Swatches/Errors/InvalidFormat.html +220 -0
  19. data/doc/Procreate/Swatches/Errors/InvalidPath.html +220 -0
  20. data/doc/Procreate/Swatches/Errors.html +128 -0
  21. data/doc/Procreate/Swatches/Exporter.html +754 -0
  22. data/doc/Procreate/Swatches/Parser.html +622 -0
  23. data/doc/Procreate/Swatches/Wrapper.html +1168 -0
  24. data/doc/Procreate/Swatches.html +497 -0
  25. data/doc/Procreate.html +128 -0
  26. data/doc/_index.html +209 -0
  27. data/doc/class_list.html +51 -0
  28. data/doc/css/common.css +1 -0
  29. data/doc/css/full_list.css +58 -0
  30. data/doc/css/style.css +496 -0
  31. data/doc/file.CODE_OF_CONDUCT.html +146 -0
  32. data/doc/file.LICENSE.html +70 -0
  33. data/doc/file.README.html +296 -0
  34. data/doc/file_list.html +66 -0
  35. data/doc/frames.html +17 -0
  36. data/doc/index.html +296 -0
  37. data/doc/js/app.js +292 -0
  38. data/doc/js/full_list.js +216 -0
  39. data/doc/js/jquery.js +4 -0
  40. data/doc/method_list.html +275 -0
  41. data/doc/top-level-namespace.html +110 -0
  42. data/lib/procreate/swatches/colors_helper.rb +83 -0
  43. data/lib/procreate/swatches/errors/invalid_format.rb +19 -0
  44. data/lib/procreate/swatches/errors/invalid_path.rb +16 -0
  45. data/lib/procreate/swatches/exporter.rb +131 -0
  46. data/lib/procreate/swatches/parser.rb +82 -0
  47. data/lib/procreate/swatches/version.rb +8 -0
  48. data/lib/procreate/swatches/wrapper.rb +155 -0
  49. data/lib/procreate/swatches.rb +60 -0
  50. data/procreate-swatches.gemspec +41 -0
  51. metadata +275 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec13bab1fc2489c184a2fbed315b935fb473142c
4
+ data.tar.gz: 1e4e30688706459e898957b487f238b5703fb778
5
+ SHA512:
6
+ metadata.gz: 3189244ac5bb28fc3eeca118540133fb637bb5030f6fccddb260141fb603b68bedcd38be4e33c942adbc6b9ae8919397fa22ba7caef53352a7f6843dd24ae9b4
7
+ data.tar.gz: 7b3827654b0414752a0003f05186604eec9148fb416ff3d666096f6223fd00fa00d3386af8778f9e4ed0dc454743aade870cea41ab7bacbf98ec27948c5a6897
data/.codeclimate.yml ADDED
@@ -0,0 +1,7 @@
1
+ plugins:
2
+ rubymotion:
3
+ enabled: true
4
+ rubocop:
5
+ enabled: true
6
+ config:
7
+ file: .rubocop.yml
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
8
+
9
+ # rspec failure tracking
10
+ .rspec_status
11
+
12
+ .ruby-gemset
13
+
14
+ .rubocop-https*
15
+
16
+ .vscode
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ require: rubocop-performance
2
+ inherit_from: https://raw.githubusercontent.com/laurentzziu/utils/master/gems/.rubocop.yml
3
+ RSpec/InstanceVariable:
4
+ Enabled: false
5
+ RSpec/BeforeAfterAll:
6
+ Enabled: false
7
+ RSpec/NestedGroups:
8
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.4.3
data/.travis.yml ADDED
@@ -0,0 +1,19 @@
1
+ sudo: false
2
+ env:
3
+ global:
4
+ - CC_TEST_REPORTER_ID=5648e754d49f6154023cde47863ff91f98019493f6fd2b9be28619479a1bd248
5
+ language: ruby
6
+ rvm:
7
+ - 2.4.3
8
+ before_install: gem install bundler -v 1.16.1
9
+ before_script:
10
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
11
+ - chmod +x ./cc-test-reporter
12
+ - ./cc-test-reporter before-build
13
+ script:
14
+ - bundle exec rspec
15
+ after_script:
16
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
17
+ notifications:
18
+ slack:
19
+ secure: IhsciBpwwC/HFIIfqM2D9vJDgoG45qz3cx4Tw8j5EUOvs55oboFNU0FN/4IPEqDPlEFx9C4p3FsF+/ajYZ3Cr/304rNMJx8eKX2Sx5iudJw2Psikslk8Ix+mmnCfGuhb1eqxa1wC7fA2UMifanCxX7nxdLKfu2EV23mJrBhhNtzrcB+CenKjLtzPfxhIWmp2nE7y+dh42fVnuiudc+ZT0638EajL03z0z2udipXzhIBk74lK043S5KATs2wGmxDXr4GxjyDfA8n4HBin4RRViNpOJGOnAbAqpSwkscm08eaKGRcFF+hSZIRUn7Qd6IXTm2qCZmVi09Z9/frtRI8rQfP5n/XCFSvEzDYMHebfJQbXrQ5e6eqcsmhHxT+TKiTfzQJ2WZsFUFqIXaBWwF2JCEatH12v2K688g5BBRs0trpk84mGD5lQFfA30hnQ9o15azIKPCk63E/9LOn1EiqTX1TH8MrV8tbktuZoagBJ9P1KXrkK/OQF0hRWx2RBEoDNZQhyYuQoy5x9P7jpQuCiP48i6liKJPLn683wNtzdoF2M2k1HCbH5/4lEl/+ZKBnIlCCkfhvjoEuXnyppdCYoIlqTSdDQLF0zP6yaRcy80mCqkhx9Y0ciGPbmjS2H+MwcYDgbVOPxNMCUg1hq3v+oUMEyXkx0BITsr2WSRddfN2U=
data/.yardopts ADDED
@@ -0,0 +1,5 @@
1
+ --protected
2
+ --no-private
3
+ -
4
+ LICENSE.txt
5
+ CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at florin@floringorgan.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ ruby '2.4.3'
4
+
5
+ # Specify your gem's dependencies in procreate-swatches.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,102 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ procreate-swatches (0.1.0)
5
+ callable_class (~> 0.1.1)
6
+ chroma
7
+ rubyzip (>= 1.0.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (5.2.3)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 0.7, < 2)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ ansi (1.5.0)
18
+ ast (2.4.0)
19
+ callable_class (0.1.1)
20
+ chroma (0.2.0)
21
+ coderay (1.1.2)
22
+ concurrent-ruby (1.1.5)
23
+ diff-lcs (1.3)
24
+ docile (1.3.1)
25
+ hirb (0.7.3)
26
+ i18n (1.6.0)
27
+ concurrent-ruby (~> 1.0)
28
+ jaro_winkler (1.5.2)
29
+ json (2.2.0)
30
+ method_source (0.9.2)
31
+ minitest (5.11.3)
32
+ parallel (1.17.0)
33
+ parser (2.6.2.1)
34
+ ast (~> 2.4.0)
35
+ pry (0.12.2)
36
+ coderay (~> 1.1.0)
37
+ method_source (~> 0.9.0)
38
+ psych (3.1.0)
39
+ rainbow (3.0.0)
40
+ rake (10.5.0)
41
+ rspec (3.8.0)
42
+ rspec-core (~> 3.8.0)
43
+ rspec-expectations (~> 3.8.0)
44
+ rspec-mocks (~> 3.8.0)
45
+ rspec-core (3.8.0)
46
+ rspec-support (~> 3.8.0)
47
+ rspec-expectations (3.8.2)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.8.0)
50
+ rspec-mocks (3.8.0)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.8.0)
53
+ rspec-support (3.8.0)
54
+ rubocop (0.67.2)
55
+ jaro_winkler (~> 1.5.1)
56
+ parallel (~> 1.10)
57
+ parser (>= 2.5, != 2.5.1.1)
58
+ psych (>= 3.1.0)
59
+ rainbow (>= 2.2.2, < 4.0)
60
+ ruby-progressbar (~> 1.7)
61
+ unicode-display_width (>= 1.4.0, < 1.6)
62
+ rubocop-performance (1.1.0)
63
+ rubocop (>= 0.67.0)
64
+ rubocop-rspec (1.32.0)
65
+ rubocop (>= 0.60.0)
66
+ ruby-progressbar (1.10.0)
67
+ rubyzip (1.2.2)
68
+ simplecov (0.16.1)
69
+ docile (~> 1.1)
70
+ json (>= 1.8, < 3)
71
+ simplecov-html (~> 0.10.0)
72
+ simplecov-console (0.4.2)
73
+ ansi
74
+ hirb
75
+ simplecov
76
+ simplecov-html (0.10.2)
77
+ thread_safe (0.3.6)
78
+ tzinfo (1.2.5)
79
+ thread_safe (~> 0.1)
80
+ unicode-display_width (1.5.0)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ activesupport
87
+ bundler (~> 2.0)
88
+ procreate-swatches!
89
+ pry
90
+ rake (~> 10.0)
91
+ rspec (~> 3.0)
92
+ rubocop
93
+ rubocop-performance
94
+ rubocop-rspec
95
+ simplecov
96
+ simplecov-console
97
+
98
+ RUBY VERSION
99
+ ruby 2.4.3p205
100
+
101
+ BUNDLED WITH
102
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Florinel Gorgan
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 ADDED
@@ -0,0 +1,230 @@
1
+ # Procreate::Swatches
2
+
3
+ [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](https://www.rubydoc.info/gems/procreate-swatches/)
4
+ [![Build Status](https://travis-ci.org/laurentzziu/procreate-swatches.svg?branch=master)](https://travis-ci.org/laurentzziu/procreate-swatches)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/b82e0b6e6aade556abe0/maintainability)](https://codeclimate.com/github/laurentzziu/procreate-swatches/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/b82e0b6e6aade556abe0/test_coverage)](https://codeclimate.com/github/laurentzziu/procreate-swatches/test_coverage)
7
+
8
+ A gem to interact with [Procreate](https://procreate.art) `.swatches` files.
9
+
10
+ This gem offers the possibility to:
11
+ * parse an existing `.swatches` color palette to an object and extract the colors in various color formats
12
+ * generate a Procreate color palette from an array of colors and export it to a `.swatches` file
13
+
14
+ Behind the scenes, `Procreate::Swatches` uses the [Chroma gem](https://github.com/jfairbank/chroma) to wrap colors and provide a better experience in interacting with colors. For more in depth use cases, consult the documentation for `Chroma::Color`, available [here](https://www.rubydoc.info/gems/chroma/0.2.0/Chroma/Color).
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ ```ruby
21
+ gem 'procreate-swatches'
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ $ bundle
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install procreate-swatches
31
+
32
+ ## Usage
33
+
34
+ Before using the gem, you have to require the main file:
35
+ ```ruby
36
+ require 'procreate/swatches'
37
+ ```
38
+
39
+ ### Parsing
40
+
41
+ The gem allows you to parse an existing `.swatches` file to a `Procreate::Swatches::Wrapper` instance, which will allow you to further manipulate the colors.
42
+
43
+ _For full documentation, refer to [Procreate::Swatches::Parser documentation](https://www.rubydoc.info/gems/procreate-swatches/Procreate/Swatches/Parser)_
44
+
45
+ __*Example 1*__
46
+ ```ruby
47
+ file_path = '/file/path/to/palette.swatches'
48
+ # Initialize a new instance of `Procreate::Swatches::Parser` with the file path to the `.swatches` file
49
+ parser = Procreate::Swatches::Parser.new(file_path)
50
+ # Use the method `#call` to parse the file; this will return an instance of `Procreate::Swatches::Wrapper`
51
+ wrapper = parser.call
52
+ ```
53
+
54
+ __*Example 2*__
55
+
56
+ For ease of use, a `.call` method is available:
57
+ ```ruby
58
+ file_path = '/file/path/to/palette.swatches'
59
+ wrapper = Procreate::Swatches::Parser.call(file_path)
60
+ ```
61
+
62
+ __*Example 3*__
63
+
64
+ For convenience, a top-level method can be used to parse a `.swatches` file
65
+ ```ruby
66
+ file_path = '/file/path/to/palette.swatches'
67
+ wrapper = Procreate::Swatches.parse(file_path)
68
+ # which is also aliased as `.from_file`
69
+ wrapper = Procreate::Swatches.from_file(file_path)
70
+ ```
71
+
72
+ ### Interacting with a wrapped palette
73
+
74
+ _For full documentation, refer to [Procreate::Swatches::Wrapper documentation](https://www.rubydoc.info/gems/procreate-swatches/Procreate/Swatches/Wrapper)_
75
+
76
+ After successfully converting a `.swatches` file to a `Procreate::Swatches::Wrapper` instance, you can further interact with the palette in a Ruby way.
77
+
78
+ Using the `Procreate::Swatches::Wrapper`, you can access the name and the colors array of the `.swatches` file.
79
+
80
+ ```ruby
81
+ wrapper.name
82
+ # => "Snowy Landscape"
83
+
84
+ wrapper.colors
85
+ # => [hsv(195, 16%, 81%), hsv(288, 6%, 68%), hsv(232, 19%, 67%)]
86
+ ```
87
+
88
+ By default, each color availabe in the colors array is an instance of Chroma::Color
89
+ By providing a format parameter to the `#colors` method, you can retrieve the colors in one of the availabe formats (supported by Chroma::Color)
90
+ ```ruby
91
+ # converting to hex
92
+ wrapper.colors(format: :hex)
93
+ # => ["#aec6cf", "#aba3ad", "#8a8fab"]
94
+ ```
95
+
96
+ All the availabe formats for converting colors:
97
+ ```ruby
98
+ wrapper.available_color_formats
99
+ # => [:hsv, :hsl, :hex, :hex8, :rgb, :name]
100
+
101
+ # the list is also available using
102
+ Procreate::Swatches::Wrapper::AVAILABLE_COLOR_FORMATS
103
+ ```
104
+
105
+ To add a new color to the wrapper's colors array, use the `push` or `<<` method
106
+ ```ruby
107
+ wrapper.push("#aaa")
108
+ # => [hsv(195, 16%, 81%), hsv(288, 6%, 68%), hsv(232, 19%, 67%), #aaa]
109
+ wrapper << "#bbb"
110
+ # => [hsv(195, 16%, 81%), hsv(288, 6%, 68%), hsv(232, 19%, 67%), #aaa, #bbb]
111
+ ```
112
+ This will add the color to the array (if valid) and return the colors array, including the newly-added color. Note that each color is an instance of `Chroma::Color`
113
+
114
+ For convenience, you can directly export a Procreate::Swatches::Wrapper instance to a `.swatches` file:
115
+ ```ruby
116
+ wrapper.export
117
+ # => "path/to/your/palette.swatches"
118
+
119
+ # which is also aliased as
120
+ wrapper.to_file
121
+ # => "path/to/your/palette-1.swatches"
122
+ ```
123
+
124
+ ### Exporting
125
+
126
+ _For full documentation, refer to [Procreate::Swatches::Exporter documentation](https://www.rubydoc.info/gems/procreate-swatches/Procreate/Swatches/Exporter)_
127
+
128
+ You can easily export a `Procreate::Swatches::Wrapper` to a `.swatches` file.
129
+
130
+ __*Example 1*__
131
+
132
+ ```ruby
133
+ exporter = Procreate::Swatches::Exporter.new(wrapper, options)
134
+
135
+ swatches_path = export.call
136
+ # => "path/to/your/palette.swatches"
137
+ ```
138
+
139
+ The `.swatches` path is also available afterwards, using the `swatches_path` attribute:
140
+ ```ruby
141
+ exporter.swatches_path
142
+ # => "path/to/your/palette.swatches"
143
+ ```
144
+
145
+ __*Example 2*__
146
+
147
+ For ease of use, a `.call` method is available:
148
+ ```ruby
149
+ swatches_path = Procreate::Swatches::Exporter.call(wrapper, options)
150
+ ```
151
+
152
+ __*Example 3*__
153
+
154
+ For convenience, a top-level method can be used to export an array of colors to a `.swatches` file:
155
+ ```ruby
156
+ name = 'Snowy landscape'
157
+ colors = ["#aaa", "#bbb", "#ccc"]
158
+
159
+ swatches_path = Procreate::Swatches.export(name, colors)
160
+ # => "path/to/your/snowy_landscape.swatches"
161
+
162
+
163
+ # which is also aliased as
164
+ swatches_path = Procreate::Swatches.to_file(name, colors)
165
+ # => "path/to/your/snowy_landscape-1.swatches"
166
+ ```
167
+
168
+ #### Export options
169
+
170
+ The `Procreate::Swatches::Exporter` class supports a number of options while exporting to a `.swatches` file.
171
+
172
+ ```ruby
173
+ options = { export_directory: '/Users/username/Desktop' }
174
+
175
+ swatches_path = Procreate::Swatches.to_file(name, colors, options)
176
+ # => "/Users/username/Desktop/snowy_landscape.swatches"
177
+ ```
178
+
179
+ ```ruby
180
+ options = {
181
+ export_directory = '/Users/username/Desktop',
182
+ file_name: 'gorgeous_palette'
183
+ }
184
+
185
+ swatches_path = Procreate::Swatches.to_file(name, colors, options)
186
+ # => "/Users/username/Desktop/gorgeous_palette.swatches"
187
+ ```
188
+
189
+ The default values for these options are:
190
+ ```ruby
191
+ # The result of calling `Dir.pwd`, which returns the current working directory
192
+ export_directory = Dir.pwd
193
+
194
+ # The sanitized string of the `Procreate::Swatches::Wrapper` name
195
+ file_name = wrapper.name
196
+ ```
197
+
198
+ These options are supported on every method that can export a `.swatches` file:
199
+
200
+ ```ruby
201
+ Procreate::Swatches::Exporter.new(wrapper, options).call
202
+
203
+ Procreate::Swatches::Exporter.call(wrapper, options)
204
+
205
+ Procreate::Swatches.to_file(name, colors, options)
206
+
207
+ Procreate::Swatches.export(name, colors, options)
208
+
209
+ wrapper.export(options)
210
+
211
+ wrapper.to_file(options)
212
+ ```
213
+
214
+ ## Development
215
+
216
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
217
+
218
+ 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).
219
+
220
+ ## Contributing
221
+
222
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/laurentzziu/procreate-swatches>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
223
+
224
+ ## License
225
+
226
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
227
+
228
+ ## Code of Conduct
229
+
230
+ Everyone interacting in the `Procreate::Swatches` project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/laurentzziu/procreate-swatches/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'procreate/swatches'
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(__FILE__)
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