flammarion-utils 0.2.1 → 0.3.0

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: 814e946edd8c7da15ee7fb5190511bc0f140996d1de1e8e4359a08ab00cb64eb
4
+ data.tar.gz: bb76f7f61d4b54d02e6c7d1e5675189cfacc52b22709edb24ab8e4c18e0c3223
5
+ SHA512:
6
+ metadata.gz: 7adf894a8192ec80e9d26981ae25b5a0b01386952f96ee5b60f55ac35659ff463f368f8da3381ea0bf60a4cd40348045656100871bcc98350b6c40acaf368ab9
7
+ data.tar.gz: c22cfedc2ffec1d3392dd4af90aa0053a8aadfdd746675f12228c9226b3ec8161f67b97751c350ee6a51dab9f3361cab24f472d1724d2498927479fbabac47a1
data/LICENSE CHANGED
@@ -1,147 +1,165 @@
1
- # Flammarion
2
-
3
- Copyright (c) 2015 Zachary Capalbo
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.
22
-
23
-
24
- # External Packages
25
-
26
- Flammarion is bundled with a number of 3rd party packages:
27
-
28
- ## Font Awesome
29
-
30
- This software incorporates
31
- [Font Awesome by Dave Gandy - http://fontawesome.io](http://fontawesome.io). The
32
- fonts in Font Awesome are licensed under the
33
- [SIL OFL 1.1](http://scripts.sil.org/OFL). The css files in Font Awesome are
34
- licensed under the [MIT License](http://opensource.org/licenses/mit-license.html)
35
-
36
- C.f. https://fortawesome.github.io/Font-Awesome/license/
37
-
38
- ## JQuery
39
-
40
- jQuery Foundation projects are released under the terms of the license specified in the project's repository or if not specified, under the [MIT license](https://tldrlegal.com/license/mit-license)
41
-
42
- ## Highlight JS
43
-
44
- Copyright (c) 2006, Ivan Sagalaev
45
- All rights reserved.
46
- Redistribution and use in source and binary forms, with or without
47
- modification, are permitted provided that the following conditions are met:
48
-
49
- * Redistributions of source code must retain the above copyright
50
- notice, this list of conditions and the following disclaimer.
51
- * Redistributions in binary form must reproduce the above copyright
52
- notice, this list of conditions and the following disclaimer in the
53
- documentation and/or other materials provided with the distribution.
54
- * Neither the name of highlight.js nor the names of its contributors
55
- may be used to endorse or promote products derived from this software
56
- without specific prior written permission.
57
-
58
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
59
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
60
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
61
- DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
62
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
63
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
64
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
65
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
66
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
67
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68
-
69
- ## Leaflet
70
-
71
- Copyright (c) 2010-2015, Vladimir Agafonkin
72
- Copyright (c) 2010-2011, CloudMade
73
- All rights reserved.
74
-
75
- Redistribution and use in source and binary forms, with or without modification, are
76
- permitted provided that the following conditions are met:
77
-
78
- 1. Redistributions of source code must retain the above copyright notice, this list of
79
- conditions and the following disclaimer.
80
-
81
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
82
- of conditions and the following disclaimer in the documentation and/or other materials
83
- provided with the distribution.
84
-
85
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
86
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
87
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
88
- COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
89
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
90
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
91
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
92
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
93
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
94
-
95
- ## Rubame
96
-
97
- (The MIT License)
98
-
99
- Copyright © 2013 Mark Saward
100
-
101
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
102
-
103
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
104
-
105
- THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
106
-
107
- ## Emojione
108
-
109
- Emoji provided free by [Emoji One](http://emojione.com)
110
-
111
- #### Emoji One Artwork
112
-
113
- * Applies to all PNG and SVG files as well as any adaptations made.
114
- * License: Creative Commons Attribution 4.0 International
115
- * Human Readable License: http://creativecommons.org/licenses/by/4.0/
116
- * Complete Legal Terms: http://creativecommons.org/licenses/by/4.0/legalcode
117
-
118
-
119
- #### Emoji One Non-Artwork
120
-
121
- * Applies to the Javascript, JSON, PHP, CSS, HTML files, and everything else not covered under the artwork license above.
122
- * License: MIT
123
- * Complete Legal Terms: http://opensource.org/licenses/MIT
124
-
125
- ## Plotly
126
-
127
- The MIT License (MIT)
128
-
129
- Copyright (c) 2016 Plotly, Inc
130
-
131
- Permission is hereby granted, free of charge, to any person obtaining a copy
132
- of this software and associated documentation files (the "Software"), to deal
133
- in the Software without restriction, including without limitation the rights
134
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
135
- copies of the Software, and to permit persons to whom the Software is
136
- furnished to do so, subject to the following conditions:
137
-
138
- The above copyright notice and this permission notice shall be included in
139
- all copies or substantial portions of the Software.
140
-
141
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
142
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
143
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
144
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
145
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
146
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
147
- THE SOFTWARE.
1
+ # Flammarion
2
+
3
+ Copyright (c) 2015 Zachary Capalbo
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.
22
+
23
+
24
+ # External Packages
25
+
26
+ Flammarion is bundled with a number of 3rd party packages:
27
+
28
+ ## Font Awesome
29
+
30
+ This software incorporates
31
+ [Font Awesome by Dave Gandy - http://fontawesome.io](http://fontawesome.io). The
32
+ fonts in Font Awesome are licensed under the
33
+ [SIL OFL 1.1](http://scripts.sil.org/OFL). The css files in Font Awesome are
34
+ licensed under the [MIT License](http://opensource.org/licenses/mit-license.html)
35
+
36
+ C.f. https://fortawesome.github.io/Font-Awesome/license/
37
+
38
+ ## JQuery
39
+
40
+ jQuery Foundation projects are released under the terms of the license specified in the project's repository or if not specified, under the [MIT license](https://tldrlegal.com/license/mit-license)
41
+
42
+ ## Highlight JS
43
+
44
+ Copyright (c) 2006, Ivan Sagalaev
45
+ All rights reserved.
46
+ Redistribution and use in source and binary forms, with or without
47
+ modification, are permitted provided that the following conditions are met:
48
+
49
+ * Redistributions of source code must retain the above copyright
50
+ notice, this list of conditions and the following disclaimer.
51
+ * Redistributions in binary form must reproduce the above copyright
52
+ notice, this list of conditions and the following disclaimer in the
53
+ documentation and/or other materials provided with the distribution.
54
+ * Neither the name of highlight.js nor the names of its contributors
55
+ may be used to endorse or promote products derived from this software
56
+ without specific prior written permission.
57
+
58
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
59
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
60
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
61
+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
62
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
63
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
64
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
65
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
66
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
67
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68
+
69
+ ## Leaflet
70
+
71
+ Copyright (c) 2010-2015, Vladimir Agafonkin
72
+ Copyright (c) 2010-2011, CloudMade
73
+ All rights reserved.
74
+
75
+ Redistribution and use in source and binary forms, with or without modification, are
76
+ permitted provided that the following conditions are met:
77
+
78
+ 1. Redistributions of source code must retain the above copyright notice, this list of
79
+ conditions and the following disclaimer.
80
+
81
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
82
+ of conditions and the following disclaimer in the documentation and/or other materials
83
+ provided with the distribution.
84
+
85
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
86
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
87
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
88
+ COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
89
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
90
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
91
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
92
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
93
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
94
+
95
+ ## Rubame
96
+
97
+ (The MIT License)
98
+
99
+ Copyright © 2013 Mark Saward
100
+
101
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
102
+
103
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
104
+
105
+ THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
106
+
107
+ ## Twemoji
108
+
109
+ ### Twemoji Artwork
110
+
111
+ As an open source project, attribution is critical from a legal, practical and motivational perspective in our opinion. The graphics are licensed under the CC-BY 4.0 which has a pretty good guide on best practices for attribution.
112
+
113
+ However, we consider the guide a bit onerous and as a project, will accept a mention in a project README or an 'About' section or footer on a website. In mobile applications, a common place would be in the Settings/About section (for example, see the mobile Twitter application Settings->About->Legal section). We would consider a mention in the HTML/JS source sufficient also.
114
+
115
+ ### Twemoji Non-Artwork
116
+
117
+ Copyright (c) 2018 Twitter, Inc and other contributors
118
+
119
+ Permission is hereby granted, free of charge, to any person obtaining a copy
120
+ of this software and associated documentation files (the "Software"), to deal
121
+ in the Software without restriction, including without limitation the rights
122
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
123
+ copies of the Software, and to permit persons to whom the Software is
124
+ furnished to do so, subject to the following conditions:
125
+
126
+ The above copyright notice and this permission notice shall be included in
127
+ all copies or substantial portions of the Software.
128
+
129
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
130
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
132
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
133
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
134
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
135
+ THE SOFTWARE.
136
+
137
+ ## Emoji One Non-Artwork
138
+
139
+ * Applies to the Javascript, JSON, PHP, CSS, HTML files, and everything else not covered under the artwork license above.
140
+ * License: MIT
141
+ * Complete Legal Terms: http://opensource.org/licenses/MIT
142
+
143
+ ## Plotly
144
+
145
+ The MIT License (MIT)
146
+
147
+ Copyright (c) 2016 Plotly, Inc
148
+
149
+ Permission is hereby granted, free of charge, to any person obtaining a copy
150
+ of this software and associated documentation files (the "Software"), to deal
151
+ in the Software without restriction, including without limitation the rights
152
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
153
+ copies of the Software, and to permit persons to whom the Software is
154
+ furnished to do so, subject to the following conditions:
155
+
156
+ The above copyright notice and this permission notice shall be included in
157
+ all copies or substantial portions of the Software.
158
+
159
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
160
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
161
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
162
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
163
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
164
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
165
+ THE SOFTWARE.
data/Readme.md CHANGED
@@ -1,196 +1,197 @@
1
- # Flammarion GUI Toolkit
2
-
3
- [![Gem Version](https://badge.fury.io/rb/flammarion.svg)](https://badge.fury.io/rb/flammarion)
4
-
5
- * [Source](https://github.com/zach-capalbo/flammarion)
6
- * [Documentation](http://zach-capalbo.github.io/flammarion/doc/Flammarion.html)
7
-
8
- ## Overview
9
-
10
- Flammarion is an easy-to-use library for displaying information that you might
11
- normally display to the command line in a slightly easier-to-access way.
12
-
13
- It is not intended to be a full fledged application development toolkit. It is
14
- intended instead for small scripts where you just want to show some information
15
- or buttons without going through too much trouble.
16
-
17
- ## Installation
18
-
19
- First, you need to install [electron](http://electron.atom.io/) or [chrome](http://www.google.com/chrome)
20
- and make sure it's in your path. (*Note:* On Windows, currently only chrome
21
- works, but you don't need to worry about putting it in your path.)
22
-
23
- Then you can install the gem:
24
-
25
- ```
26
- gem install flammarion
27
- ```
28
-
29
- or add it to your Gemfile.
30
-
31
- ## Tutorial
32
-
33
- The easiest way to use Flammarion, is similar to how you might use STDOUT:
34
-
35
- _(Note: these examples are intended to be run from an interactive session such as IRB or [pry](http://pryrepl.org/). If you wish to use them as part of a script, you should use `f.wait_until_closed` at the end, in order to block termination of the script.)_
36
-
37
- ```ruby
38
- require 'flammarion'
39
- f = Flammarion::Engraving.new
40
- f.puts "Hello World!"
41
- ```
42
-
43
- It can even support standard console color codes (Thanks to [ansi_up](http://github.com/drudru/ansi_up)!) and emoji / icons (Thanks to [emojione](http://emojione.com/) and [font awesome](https://fortawesome.github.io/Font-Awesome/))
44
-
45
- ```ruby
46
- require 'colorized'
47
- f.puts "This line will be red!".red
48
- f.puts "This #{"word".colorize(:green)} will not be blue."
49
- f.puts "This line will have cows :cow: :cow2:", escape_icons: true
50
- ```
51
-
52
- However, you can also do more advanced things. Say you want to show a table. Easy!
53
-
54
- ```ruby
55
- f.table(
56
- [%w[Number Squared Sqrt].map{|h| h.light_magenta}] + # Make the header a different color
57
- 10.times.collect{|x| [x, x * x, Math.sqrt(x)]})
58
- ```
59
-
60
- Now, instead of a table, you decide you want a plot. No problem.
61
-
62
- ```ruby
63
- x = 10.times.to_a
64
- f.plot([{x:x, y:x}, {x: x, y: x.map{|i| i*i}}, {x: x, y: x.map{|i| Math.sqrt(i)}}])
65
- ```
66
-
67
- Or maybe you want to know where something is:
68
-
69
- ```ruby
70
- f.map("Boston, MA")
71
- ```
72
-
73
- Maybe you even want to see both of those things *at the same time*!
74
-
75
- ```ruby
76
- f.pane("numberstuff").table([%w[Number Squared Sqrt].map{|h| h.light_magenta}] +
77
- 10.times.collect{|x| [x, x * x, Math.sqrt(x)]})
78
- f.pane("mapstuff").map("Big Ben")
79
- ```
80
-
81
- If you need feedback, there's a simple callback mechanism for buttons and text
82
- boxes:
83
-
84
- ```ruby
85
- f.button("Click Here!!!") {f.puts "You clicked the button!"}
86
- f.input("Placeholder > ") {|msg| f.puts "You wrote: #{msg['text'].light_magenta}"}
87
- ```
88
-
89
- The [api documentation](http://zach-capalbo.github.io/flammarion/doc/Flammarion.html)
90
- is available at <http://zach-capalbo.github.io/flammarion/doc/Flammarion.html>.
91
-
92
- ## Screenshots / Samples
93
-
94
- ### Message Composer with Address Book
95
-
96
- ```ruby
97
- f = Flammarion::Engraving.new
98
- f.orientation = :horizontal
99
- recipient = f.subpane("number").input("Phone Number")
100
- text = f.input("Body", multiline:true)
101
- f.button("Send") { send_message(recipient.to_s, text.to_s); f.status("Message Sent!")}
102
- f.pane("contacts").puts("Contacts", replace:true)
103
- icons = %w[thumbs-up meh-o bicycle gears star-o star cow cat cactus] + [nil] * 5
104
- 30.times do |i|
105
- name = Faker::Name.name
106
- f.pane("contacts").button(name, right_icon:icons.sample, left_icon:icons.sample) do
107
- recipient = name
108
- f.subpane("number").replace(name)
109
- end
110
- end
111
- ```
112
-
113
- ![Message Sample](http://zach-capalbo.github.io/flammarion/img/message_sender_with_contacts.png)
114
-
115
- ### Rake Task Runner
116
-
117
- ```ruby
118
- f = Flammarion::Engraving.new(exit_on_disconnect:true)
119
- f.title "frake #{Dir.pwd}"
120
-
121
- def run(task)
122
- f2 = Flammarion::Engraving.new
123
- f2.title task
124
- f2.puts "Running #{task.light_magenta}"
125
- Open3.popen3(task) do |i,o,e,t|
126
- Thread.new {e.each_line{|l| f2.print l.red}}
127
- o.each_line {|l| f2.print l}
128
- f2.status t.value.success? ? "Done!".light_green : "Failed!".light_red
129
- end
130
- end
131
-
132
- f.markdown "# Rake Tasks: "
133
- `rake -T`.each_line do |l|
134
- f.break
135
- parts = l.split("#")
136
- task = parts[0]
137
- desc = parts[1]
138
- f.puts desc
139
- f.button(task) do
140
- run(task)
141
- end
142
- end
143
-
144
- f.wait_until_closed
145
- ```
146
-
147
- ![Frake](http://zach-capalbo.github.io/flammarion/img/frake.png)
148
-
149
- ### Tables
150
-
151
- ```ruby
152
- f = Flammarion::Engraving.new
153
- f.orientation = :horizontal
154
- f.table([["Id", "Name", "Address"].map{|h| h.light_magenta}] + 20.times.map do |i|
155
- [i, Faker::Name.name, Faker::Address.street_address]
156
- end)
157
- f.pane("sidebar").pane("side1").puts Faker::Hipster.paragraph.red
158
- f.pane("sidebar").pane("side2").puts Faker::Hipster.paragraph.green
159
-
160
- 3.times { f.status(Faker::Hipster.sentence.light_green)}
161
- ```
162
-
163
- ![Table Sample](http://zach-capalbo.github.io/flammarion/img/table.png)
164
-
165
- ```ruby
166
- f = Flammarion::Engraving.new
167
- f.plot(5.times.map{|t| {y:100.times.map{rand * t}}})
168
- ```
169
-
170
- ![Plot Sample](http://zach-capalbo.github.io/flammarion/img/plot.png)
171
-
172
- ## Examples
173
-
174
- There are a number of useful examples in the [examples directory.](https://github.com/zach-capalbo/flammarion/tree/master/examples)
175
-
176
- Some of these examples can be quite handy in their own right. If you wish to
177
- install these as executables, you can install the `flammarion-utils` gem with
178
- the command
179
-
180
- ```bash
181
- gem install flammarion-utils
182
- ```
183
-
184
- # Bundled Packages
185
-
186
- Flammarion is distributed with a bunch of useful tools to make everyone's life easier.
187
- They are:
188
-
189
- * [ansi up](https://github.com/drudru/ansi_up)
190
- * [highlight.js](https://highlightjs.org/)
191
- * [jquery](https://jquery.com/)
192
- * [jquery transit](http://ricostacruz.com/jquery.transit/)
193
- * [leaflet](http://leafletjs.com/)
194
- * [font awesome](https://fortawesome.github.io/Font-Awesome/)
195
- * [emojione](http://emojione.com/)
196
- * [Plotly](https://plot.ly/)
1
+ # Flammarion GUI Toolkit
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/flammarion.svg)](https://badge.fury.io/rb/flammarion)
4
+
5
+ * [Source](https://github.com/zach-capalbo/flammarion)
6
+ * [Documentation](http://zach-capalbo.github.io/flammarion/doc/Flammarion.html)
7
+
8
+ ## Overview
9
+
10
+ Flammarion is an easy-to-use library for displaying information that you might
11
+ normally display to the command line in a slightly easier-to-access way.
12
+
13
+ It is not intended to be a full fledged application development toolkit. It is
14
+ intended instead for small scripts where you just want to show some information
15
+ or buttons without going through too much trouble.
16
+
17
+ ## Installation
18
+
19
+ First, you need to install [electron](http://electron.atom.io/) or [chrome](http://www.google.com/chrome)
20
+ and make sure it's in your path. (*Note:* On Windows, currently only chrome
21
+ works, but you don't need to worry about putting it in your path.)
22
+
23
+ Then you can install the gem:
24
+
25
+ ```
26
+ gem install flammarion
27
+ ```
28
+
29
+ or add it to your Gemfile.
30
+
31
+ ## Tutorial
32
+
33
+ The easiest way to use Flammarion, is similar to how you might use STDOUT:
34
+
35
+ _(Note: these examples are intended to be run from an interactive session such as IRB or [pry](http://pryrepl.org/). If you wish to use them as part of a script, you should use `f.wait_until_closed` at the end, in order to block termination of the script.)_
36
+
37
+ ```ruby
38
+ require 'flammarion'
39
+ f = Flammarion::Engraving.new
40
+ f.puts "Hello World!"
41
+ ```
42
+
43
+ It can even support standard console color codes (Thanks to [ansi_up](http://github.com/drudru/ansi_up)!) and emoji / icons (Thanks to [tweomji](https://github.com/twitter/twemoji) and [font awesome](https://fortawesome.github.io/Font-Awesome/))
44
+
45
+ ```ruby
46
+ require 'colorized'
47
+ f.puts "This line will be red!".red
48
+ f.puts "This #{"word".colorize(:green)} will not be blue."
49
+ f.puts "This line will have cows :cow: :cow2:", escape_icons: true
50
+ ```
51
+
52
+ However, you can also do more advanced things. Say you want to show a table. Easy!
53
+
54
+ ```ruby
55
+ f.table(
56
+ [%w[Number Squared Sqrt].map{|h| h.light_magenta}] + # Make the header a different color
57
+ 10.times.collect{|x| [x, x * x, Math.sqrt(x)]})
58
+ ```
59
+
60
+ Now, instead of a table, you decide you want a plot. No problem.
61
+
62
+ ```ruby
63
+ x = 10.times.to_a
64
+ f.plot([{x:x, y:x}, {x: x, y: x.map{|i| i*i}}, {x: x, y: x.map{|i| Math.sqrt(i)}}])
65
+ ```
66
+
67
+ Or maybe you want to know where something is:
68
+
69
+ ```ruby
70
+ f.map("Boston, MA")
71
+ ```
72
+
73
+ Maybe you even want to see both of those things *at the same time*!
74
+
75
+ ```ruby
76
+ f.pane("numberstuff").table([%w[Number Squared Sqrt].map{|h| h.light_magenta}] +
77
+ 10.times.collect{|x| [x, x * x, Math.sqrt(x)]})
78
+ f.pane("mapstuff").map("Big Ben")
79
+ ```
80
+
81
+ If you need feedback, there's a simple callback mechanism for buttons and text
82
+ boxes:
83
+
84
+ ```ruby
85
+ f.button("Click Here!!!") {f.puts "You clicked the button!"}
86
+ f.input("Placeholder > ") {|msg| f.puts "You wrote: #{msg['text'].light_magenta}"}
87
+ ```
88
+
89
+ The [api documentation](http://zach-capalbo.github.io/flammarion/doc/Flammarion.html)
90
+ is available at <http://zach-capalbo.github.io/flammarion/doc/Flammarion.html>.
91
+
92
+ ## Screenshots / Samples
93
+
94
+ ### Message Composer with Address Book
95
+
96
+ ```ruby
97
+ f = Flammarion::Engraving.new
98
+ f.orientation = :horizontal
99
+ recipient = f.subpane("number").input("Phone Number")
100
+ text = f.input("Body", multiline:true)
101
+ f.button("Send") { send_message(recipient.to_s, text.to_s); f.status("Message Sent!")}
102
+ f.pane("contacts").puts("Contacts", replace:true)
103
+ icons = %w[thumbs-up meh-o bicycle gears star-o star cow cat cactus] + [nil] * 5
104
+ 30.times do |i|
105
+ name = Faker::Name.name
106
+ f.pane("contacts").button(name, right_icon:icons.sample, left_icon:icons.sample) do
107
+ recipient = name
108
+ f.subpane("number").replace(name)
109
+ end
110
+ end
111
+ ```
112
+
113
+ ![Message Sample](http://zach-capalbo.github.io/flammarion/img/message_sender_with_contacts.png)
114
+
115
+ ### Rake Task Runner
116
+
117
+ ```ruby
118
+ f = Flammarion::Engraving.new(exit_on_disconnect:true)
119
+ f.title "frake #{Dir.pwd}"
120
+
121
+ def run(task)
122
+ f2 = Flammarion::Engraving.new
123
+ f2.title task
124
+ f2.puts "Running #{task.light_magenta}"
125
+ Open3.popen3(task) do |i,o,e,t|
126
+ Thread.new {e.each_line{|l| f2.print l.red}}
127
+ o.each_line {|l| f2.print l}
128
+ f2.status t.value.success? ? "Done!".light_green : "Failed!".light_red
129
+ end
130
+ end
131
+
132
+ f.markdown "# Rake Tasks: "
133
+ `rake -T`.each_line do |l|
134
+ f.break
135
+ parts = l.split("#")
136
+ task = parts[0]
137
+ desc = parts[1]
138
+ f.puts desc
139
+ f.button(task) do
140
+ run(task)
141
+ end
142
+ end
143
+
144
+ f.wait_until_closed
145
+ ```
146
+
147
+ ![Frake](http://zach-capalbo.github.io/flammarion/img/frake.png)
148
+
149
+ ### Tables
150
+
151
+ ```ruby
152
+ f = Flammarion::Engraving.new
153
+ f.orientation = :horizontal
154
+ f.table([["Id", "Name", "Address"].map{|h| h.light_magenta}] + 20.times.map do |i|
155
+ [i, Faker::Name.name, Faker::Address.street_address]
156
+ end)
157
+ f.pane("sidebar").pane("side1").puts Faker::Hipster.paragraph.red
158
+ f.pane("sidebar").pane("side2").puts Faker::Hipster.paragraph.green
159
+
160
+ 3.times { f.status(Faker::Hipster.sentence.light_green)}
161
+ ```
162
+
163
+ ![Table Sample](http://zach-capalbo.github.io/flammarion/img/table.png)
164
+
165
+ ```ruby
166
+ f = Flammarion::Engraving.new
167
+ f.plot(5.times.map{|t| {y:100.times.map{rand * t}}})
168
+ ```
169
+
170
+ ![Plot Sample](http://zach-capalbo.github.io/flammarion/img/plot.png)
171
+
172
+ ## Examples
173
+
174
+ There are a number of useful examples in the [examples directory.](https://github.com/zach-capalbo/flammarion/tree/master/examples)
175
+
176
+ Some of these examples can be quite handy in their own right. If you wish to
177
+ install these as executables, you can install the `flammarion-utils` gem with
178
+ the command
179
+
180
+ ```bash
181
+ gem install flammarion-utils
182
+ ```
183
+
184
+ # Bundled Packages
185
+
186
+ Flammarion is distributed with a bunch of useful tools to make everyone's life easier.
187
+ They are:
188
+
189
+ * [ansi up](https://github.com/drudru/ansi_up)
190
+ * [highlight.js](https://highlightjs.org/)
191
+ * [jquery](https://jquery.com/)
192
+ * [jquery transit](http://ricostacruz.com/jquery.transit/)
193
+ * [leaflet](http://leafletjs.com/)
194
+ * [font awesome](https://fortawesome.github.io/Font-Awesome/)
195
+ * [twemoji](https://github.com/twitter/twemoji)
196
+ * [emojione v2](https://github.com/emojione/emojione/releases/tag/v2.2.7)
197
+ * [Plotly](https://plot.ly/)