boxybox 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 856dbd1f6e24e2069abb4d93d8a807d9a17faf10785b546dadfd44b8fbeaa598
4
+ data.tar.gz: a8398d3e5bcb419ebab2cfbad6e432bb45c5d0795a010af70ce2afebb18596e1
5
+ SHA512:
6
+ metadata.gz: 97c9851714974d2aa8fee9c4e8ef845231291121bd43818e9d39938d87cb989fbbeec62280ac6c6e9809bdd8967ab6d3708e805a1f0746ce394e29f2024f1728
7
+ data.tar.gz: '0708622718f13f267ef82315373defd89efcdc6e0678ed4d1074e1bd09afaa07d7b6ea2718655cb40d6d45825d2fefe9986903d468f997c5f7a5ce99dff96f3a'
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .idea/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .DS_Store
16
+ # rspec failure tracking
17
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,91 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'bin/*'
4
+ - 'spec/**/*'
5
+ - 'exe/**/*'
6
+
7
+ Metrics/AbcSize:
8
+ Max: 25
9
+
10
+ Metrics/MethodLength:
11
+ Max: 25
12
+
13
+ Style/PercentLiteralDelimiters:
14
+ Enabled: false
15
+
16
+
17
+ # New Cops
18
+ Layout/EmptyLinesAroundAttributeAccessor:
19
+ Enabled: true
20
+ Layout/SpaceAroundMethodCallOperator:
21
+ Enabled: true
22
+ Lint/BinaryOperatorWithIdenticalOperands:
23
+ Enabled: true
24
+ Lint/DeprecatedOpenSSLConstant:
25
+ Enabled: true
26
+ Lint/DuplicateElsifCondition:
27
+ Enabled: true
28
+ Lint/DuplicateRescueException:
29
+ Enabled: true
30
+ Lint/EmptyConditionalBody:
31
+ Enabled: true
32
+ Lint/FloatComparison:
33
+ Enabled: true
34
+ Lint/MissingSuper:
35
+ Enabled: false
36
+ Lint/MixedRegexpCaptureTypes:
37
+ Enabled: true
38
+ Lint/OutOfRangeRegexpRef:
39
+ Enabled: true
40
+ Lint/RaiseException:
41
+ Enabled: true
42
+ Lint/SelfAssignment:
43
+ Enabled: true
44
+ Lint/StructNewOverride:
45
+ Enabled: true
46
+ Lint/TopLevelReturnWithArgument:
47
+ Enabled: true
48
+ Lint/UnreachableLoop:
49
+ Enabled: true
50
+ Style/AccessorGrouping:
51
+ Enabled: true
52
+ Style/ArrayCoercion:
53
+ Enabled: true
54
+ Style/BisectedAttrAccessor:
55
+ Enabled: true
56
+ Style/CaseLikeIf:
57
+ Enabled: true
58
+ Style/ExplicitBlockArgument:
59
+ Enabled: true
60
+ Style/ExponentialNotation:
61
+ Enabled: true
62
+ Style/GlobalStdStream:
63
+ Enabled: true
64
+ Style/HashAsLastArrayItem:
65
+ Enabled: true
66
+ Style/HashEachMethods:
67
+ Enabled: true
68
+ Style/HashLikeCase:
69
+ Enabled: true
70
+ Style/HashTransformKeys:
71
+ Enabled: true
72
+ Style/HashTransformValues:
73
+ Enabled: true
74
+ Style/OptionalBooleanParameter:
75
+ Enabled: true
76
+ Style/RedundantAssignment:
77
+ Enabled: true
78
+ Style/RedundantFetchBlock:
79
+ Enabled: true
80
+ Style/RedundantFileExtensionInRequire:
81
+ Enabled: true
82
+ Style/RedundantRegexpCharacterClass:
83
+ Enabled: true
84
+ Style/RedundantRegexpEscape:
85
+ Enabled: true
86
+ Style/SingleArgumentDig:
87
+ Enabled: true
88
+ Style/SlicingWithRange:
89
+ Enabled: true
90
+ Style/StringConcatenation:
91
+ Enabled: true
@@ -0,0 +1 @@
1
+ 2.6.6
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.6
7
+ before_install: gem install bundler -v 1.17.2
@@ -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 TODO: Write your email address. 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,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in boxybox.gemspec
8
+ gemspec
@@ -0,0 +1,153 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ boxybox (0.1.2)
5
+ pastel (~> 0.7.2)
6
+ thor (~> 0.20.0)
7
+ tty-box (~> 0.5.0)
8
+ tty-color (~> 0.5)
9
+ tty-command (~> 0.9.0)
10
+ tty-config (~> 0.3.2)
11
+ tty-cursor (~> 0.7)
12
+ tty-editor (~> 0.5)
13
+ tty-file (~> 0.8.0)
14
+ tty-font (~> 0.4.0)
15
+ tty-logger (~> 0.2.0)
16
+ tty-markdown (~> 0.6.0)
17
+ tty-pager (~> 0.12)
18
+ tty-pie (~> 0.3.0)
19
+ tty-platform (~> 0.2)
20
+ tty-progressbar (~> 0.17)
21
+ tty-prompt (~> 0.19)
22
+ tty-screen (~> 0.7)
23
+ tty-spinner (~> 0.9)
24
+ tty-table (~> 0.11.0)
25
+ tty-tree (~> 0.3)
26
+ tty-which (~> 0.4)
27
+
28
+ GEM
29
+ remote: https://rubygems.org/
30
+ specs:
31
+ ast (2.4.1)
32
+ diff-lcs (1.4.4)
33
+ equatable (0.6.1)
34
+ kramdown (1.16.2)
35
+ necromancer (0.5.1)
36
+ parallel (1.19.2)
37
+ parser (2.7.1.4)
38
+ ast (~> 2.4.1)
39
+ pastel (0.7.4)
40
+ equatable (~> 0.6)
41
+ tty-color (~> 0.5)
42
+ rainbow (3.0.0)
43
+ rake (10.5.0)
44
+ rake-compiler (1.1.1)
45
+ rake
46
+ regexp_parser (1.7.1)
47
+ rexml (3.2.4)
48
+ rouge (3.22.0)
49
+ rspec (3.9.0)
50
+ rspec-core (~> 3.9.0)
51
+ rspec-expectations (~> 3.9.0)
52
+ rspec-mocks (~> 3.9.0)
53
+ rspec-core (3.9.2)
54
+ rspec-support (~> 3.9.3)
55
+ rspec-expectations (3.9.2)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.9.0)
58
+ rspec-mocks (3.9.1)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (~> 3.9.0)
61
+ rspec-support (3.9.3)
62
+ rubocop (0.89.1)
63
+ parallel (~> 1.10)
64
+ parser (>= 2.7.1.1)
65
+ rainbow (>= 2.2.2, < 4.0)
66
+ regexp_parser (>= 1.7)
67
+ rexml
68
+ rubocop-ast (>= 0.3.0, < 1.0)
69
+ ruby-progressbar (~> 1.7)
70
+ unicode-display_width (>= 1.4.0, < 2.0)
71
+ rubocop-ast (0.3.0)
72
+ parser (>= 2.7.1.4)
73
+ ruby-progressbar (1.10.1)
74
+ strings (0.1.8)
75
+ strings-ansi (~> 0.1)
76
+ unicode-display_width (~> 1.5)
77
+ unicode_utils (~> 1.4)
78
+ strings-ansi (0.1.0)
79
+ thor (0.20.3)
80
+ tty-box (0.5.0)
81
+ pastel (~> 0.7.2)
82
+ strings (~> 0.1.6)
83
+ tty-cursor (~> 0.7)
84
+ tty-color (0.5.2)
85
+ tty-command (0.9.0)
86
+ pastel (~> 0.7.0)
87
+ tty-config (0.3.2)
88
+ tty-cursor (0.7.1)
89
+ tty-editor (0.5.1)
90
+ tty-prompt (~> 0.19)
91
+ tty-which (~> 0.4)
92
+ tty-file (0.8.0)
93
+ diff-lcs (~> 1.3)
94
+ pastel (~> 0.7.2)
95
+ tty-prompt (~> 0.18)
96
+ tty-font (0.4.0)
97
+ tty-logger (0.2.0)
98
+ pastel (~> 0.7.0)
99
+ tty-markdown (0.6.0)
100
+ kramdown (~> 1.16.2)
101
+ pastel (~> 0.7.2)
102
+ rouge (~> 3.3)
103
+ strings (~> 0.1.4)
104
+ tty-color (~> 0.4)
105
+ tty-screen (~> 0.6)
106
+ tty-pager (0.13.0)
107
+ strings (~> 0.1.8)
108
+ tty-screen (~> 0.8)
109
+ tty-pie (0.3.0)
110
+ pastel (~> 0.7.3)
111
+ tty-cursor (~> 0.7)
112
+ tty-platform (0.3.0)
113
+ tty-progressbar (0.17.0)
114
+ strings-ansi (~> 0.1.0)
115
+ tty-cursor (~> 0.7)
116
+ tty-screen (~> 0.7)
117
+ unicode-display_width (~> 1.6)
118
+ tty-prompt (0.21.0)
119
+ necromancer (~> 0.5.0)
120
+ pastel (~> 0.7.0)
121
+ tty-reader (~> 0.7.0)
122
+ tty-reader (0.7.0)
123
+ tty-cursor (~> 0.7)
124
+ tty-screen (~> 0.7)
125
+ wisper (~> 2.0.0)
126
+ tty-screen (0.8.1)
127
+ tty-spinner (0.9.3)
128
+ tty-cursor (~> 0.7)
129
+ tty-table (0.11.0)
130
+ equatable (~> 0.6)
131
+ necromancer (~> 0.5)
132
+ pastel (~> 0.7.2)
133
+ strings (~> 0.1.5)
134
+ tty-screen (~> 0.7)
135
+ tty-tree (0.4.0)
136
+ tty-which (0.4.2)
137
+ unicode-display_width (1.7.0)
138
+ unicode_utils (1.4.0)
139
+ wisper (2.0.1)
140
+
141
+ PLATFORMS
142
+ ruby
143
+
144
+ DEPENDENCIES
145
+ boxybox!
146
+ bundler (~> 1.17)
147
+ rake (~> 10.0)
148
+ rake-compiler
149
+ rspec (~> 3.0)
150
+ rubocop (~> 0.89.0)
151
+
152
+ BUNDLED WITH
153
+ 1.17.2
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Travis Carter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,157 @@
1
+ # Boxybox
2
+
3
+ Need to create boxes in boxes in boxes in boxes? Great news! You've found a gem that does just that. This is a dive into the world of command line apps using TTY focusing on the tty-box and supporting gems. This has been done in a way to extend out the customization of each box quite easily by adding additional root properties to the boxes. For the purpose of this exercise I've chosen to stick with just the examples given in the challenge as well as the ability to craft new box nesting patterns by supplying custom JSON configs.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'boxybox'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install boxybox
20
+
21
+ ## Usage
22
+
23
+ To print one of the 4 provided examples along with the config json used to construct the boxes use the following command
24
+ ```shell script
25
+ $ boxybox boxes -e example1 -p
26
+ ```
27
+ This is helpful when wanting to understand the config syntax with clear examples.
28
+
29
+ ```shell script
30
+ $ boxybox boxes -f ~/some_config.json
31
+ ```
32
+
33
+ Use the above command if you wish to pass in a custom JSON config.
34
+
35
+ #### Configuration
36
+
37
+ The following example shows how boxes can be configured using JSON. There is a top level `boxes` object which represents our outer or parent box.
38
+ Each box may have children boxes in a horizontal or vertical pattern which is designated by the `direction` property. `children` are given as an array with content boxes using the `content` propery. The examples given follow the examples given in the project requirements, however content can be populated with text and all boxes will scale properly.
39
+
40
+ While this may be a bit overkill, using JSON in this way allows for more complicated structures in the future. As this gem utilizes the `tty` toolset, specifically the `tty-box` gem, many properties may be passed through and included in the future with relative ease.
41
+
42
+ ```json
43
+ {
44
+ "boxes": {
45
+ "direction": "vertical",
46
+ "children": [
47
+ {
48
+ "direction": "horizontal",
49
+ "children": [
50
+ {
51
+ "direction": "vertical",
52
+ "children": [
53
+ {
54
+ "content": " "
55
+ },
56
+ {
57
+ "content": " "
58
+ }
59
+ ]
60
+ },
61
+ {
62
+ "content": " "
63
+ },
64
+ {
65
+ "content": " "
66
+ }
67
+ ]
68
+ },
69
+ {
70
+ "content": " "
71
+ },
72
+ {
73
+ "content": " "
74
+ },
75
+ {
76
+ "direction": "horizontal",
77
+ "children": [
78
+ {
79
+ "content": " "
80
+ },
81
+ {
82
+ "content": " "
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ }
89
+ ```
90
+
91
+ The above config will print out the following:
92
+
93
+ ```text
94
+ +-------------------------+
95
+ | |
96
+ | +---------------------+ |
97
+ | | | |
98
+ | | +-------++---++---+ | |
99
+ | | | || || | | |
100
+ | | | +---+ || || | | |
101
+ | | | | | || || | | |
102
+ | | | | | |+---++---+ | |
103
+ | | | | | | | |
104
+ | | | +---+ | | |
105
+ | | | +---+ | | |
106
+ | | | | | | | |
107
+ | | | | | | | |
108
+ | | | | | | | |
109
+ | | | +---+ | | |
110
+ | | | | | |
111
+ | | | | | |
112
+ | | +-------+ | |
113
+ | | | |
114
+ | +---------------------+ |
115
+ | +---+ |
116
+ | | | |
117
+ | | | |
118
+ | | | |
119
+ | +---+ |
120
+ | +---+ |
121
+ | | | |
122
+ | | | |
123
+ | | | |
124
+ | +---+ |
125
+ | +------------+ |
126
+ | | | |
127
+ | | +---++---+ | |
128
+ | | | || | | |
129
+ | | | || | | |
130
+ | | | || | | |
131
+ | | +---++---+ | |
132
+ | | | |
133
+ | +------------+ |
134
+ | |
135
+ | |
136
+ | |
137
+ | |
138
+ +-------------------------+
139
+ ```
140
+
141
+ ## Development
142
+
143
+ 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.
144
+
145
+ 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).
146
+
147
+ ## Contributing
148
+
149
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/boxybox. 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.
150
+
151
+ ## Code of Conduct
152
+
153
+ Everyone interacting in the Boxybox project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/boxybox/blob/master/CODE_OF_CONDUCT.md).
154
+
155
+ ## Copyright
156
+
157
+ Copyright (c) 2020 Travis Carter. See [MIT License](LICENSE.txt) for further details.