terminal 0.3 → 0.3.2

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
2
  SHA1:
3
- metadata.gz: b7b151475b60fc04b00cc33d7aa7b5248d3b3cbc
4
- data.tar.gz: 9f6f38830a8df2fbd617dac67c18d8c363eb2c35
3
+ metadata.gz: 54b22e3e05336e785b66eaead924b54a341c3938
4
+ data.tar.gz: 0a2f52dd360a0fafeb918ce605ba28c63202aac5
5
5
  SHA512:
6
- metadata.gz: 742af5d46b76221b4555dc0ce42c44bdf68cc35367cd164f682aec455888b19f87a40afe195e1fe7abe310ce8750570646d389ecc44771394abff6dad1c7f7f0
7
- data.tar.gz: e33305bb8f16ffc673e48dcf4c90393727c27fd19e1832e174823573b6b07e15dcb0b58d1b4e64a2cfd2e28ad00ae29df8627e46d71e72eba6c0e97efe8f35cf
6
+ metadata.gz: 65c72b0e4cbba9ff22208bbe619678d362391c22e213143825e9ed2e54ae211e7b3f30b72251408a9ffac04dae4f7484acd938d8d1c7864f87da286a3e90776a
7
+ data.tar.gz: 056609e233229daeb9ee4b6f95c1cd84f76ce4a10591a97413da6370050061807bed57d291dd8f7e7875f054576620c677332d675dd3c667c09a937fb5d19956
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- terminal (0.3)
4
+ terminal (0.3.2)
5
5
  escape_utils (~> 1.0)
6
6
  gemoji (~> 2.0)
7
7
 
data/Readme.md CHANGED
@@ -48,7 +48,7 @@ Then in your `app/assets/application.css` file:
48
48
  Now in your views:
49
49
 
50
50
  ```
51
- <div class="code"><%= Terminal.render(output)</div>
51
+ <div class="term-container"><%= Terminal.render(output) %></div>
52
52
  ```
53
53
 
54
54
  ### Emojis :+1:
@@ -84,21 +84,17 @@ and when the render has finished, it will open in your web browser with a before
84
84
  rspec --color --tty | terminal --preview
85
85
  ```
86
86
 
87
- ![logo](http://buildbox.github.io/terminal/images/preview.png)
87
+ ![preview mode](http://buildbox.github.io/terminal/images/preview.png)
88
88
 
89
89
  ### With the Buildbox API
90
90
 
91
- First install [jq](http://stedolan.github.io/jq/), if you have [Homebrew](http://brew.sh/) installed, you can just `brew install jq`.
92
-
93
- Then, you can:
91
+ You can use the `job_url` returned by the [Builds API](https://buildbox.io/docs/api/builds) to pipe a job's log directly into terminal, for example:
94
92
 
95
93
  ```bash
96
- export JOB_LOG_URL="https://api.buildbox.io/v1/accounts/[account]/projects/[project]/builds/[build]/jobs/[job]/log?api_key=[api-key]"
97
- curl $JOB_LOG_URL -s | jq '.content' -r | terminal
94
+ JOB_LOG_URL="https://api.buildbox.io/v1/accounts/[account]/projects/[project]/builds/[build]/jobs/[job]/log.txt?api_key=[api-key]"
95
+ curl $JOB_LOG_URL | terminal --preview
98
96
  ```
99
97
 
100
- For more information on the Buildbox Builds API, see: https://buildbox.io/docs/api/builds
101
-
102
98
  ## Generating Fixtures
103
99
 
104
100
  To generate a fixture, first create a test case inside the `examples` folder. See the `curl.sh`
@@ -1,3 +1,16 @@
1
+ .term-container {
2
+ background: #171717;
3
+ border-radius: 5px;
4
+ color: white;
5
+ word-break: break-word;
6
+ overflow-wrap: break-word;
7
+ font-family: Monaco, courier;
8
+ font-size: 12px;
9
+ line-height: 20px;
10
+ padding: 14px 18px;
11
+ white-space: pre-wrap;
12
+ }
13
+
1
14
  .term-fg30 { color: #666; } /* black (but we can't use black, so a diff color) */
2
15
  .term-fg31 { color: #e10c02; } /* red */
3
16
  .term-fg32 { color: #00bd02; } /* green */
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'escape_utils'
2
4
  require 'emoji'
3
5
 
@@ -172,6 +174,10 @@ module Terminal
172
174
  end
173
175
  end
174
176
 
177
+ # The Emoji API will be transitioning to a nil-based find API, at the
178
+ # moment it raies exceptions for Emojis that can't be found:
179
+ # https://github.com/github/gemoji/commit/b1736a387c7c1c2af300506fea5603e2e1fb89d8
180
+ # Will support both for now.
175
181
  def emoji_image_from_unicode(unicode)
176
182
  emoji = Emoji.find_by_unicode(unicode)
177
183
 
@@ -183,6 +189,8 @@ module Terminal
183
189
  else
184
190
  unicode
185
191
  end
192
+ rescue
193
+ unicode
186
194
  end
187
195
  end
188
196
  end
@@ -4,20 +4,6 @@
4
4
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
5
5
  <link href="<%= asset_path("stylesheets/terminal.css") %>" media="screen" rel="stylesheet" />
6
6
  <style>
7
- .code {
8
- background: #171717;
9
- border-radius: 5px;
10
- color: white;
11
- word-break: break-word;
12
- overflow-wrap: break-word;
13
- font-family: Monaco, courier;
14
- font-size: 12px;
15
- line-height: 20px;
16
- padding: 14px 18px;
17
- white-space: pre-wrap;
18
- margin-bottom: 15px;
19
- }
20
-
21
7
  body {
22
8
  margin: 0;
23
9
  padding: 20px;
@@ -46,11 +32,11 @@
46
32
  <body>
47
33
  <div id="rendered" class="preview">
48
34
  <div class="controls"><a href="#" onclick="switchViews(); return false">Show Raw Output</a></div>
49
- <div class="code"><%= rendered %></div>
35
+ <div class="term-container"><%= rendered %></div>
50
36
  </div>
51
37
  <div id="raw" class="preview" style="display: none">
52
38
  <div class="controls"><a href="#" onclick="switchViews(); return false">Show Rendered Output</a></div>
53
- <div class="code raw"><%= raw %></div>
39
+ <div class="term-container raw"><%= raw %></div>
54
40
  </div>
55
41
  </body>
56
42
  </html>
@@ -1,3 +1,3 @@
1
1
  module Terminal
2
- VERSION = "0.3"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -200,6 +200,13 @@ describe Terminal::Renderer do
200
200
 
201
201
  expect(render(raw)).to eql(%{this is great <img alt=":+1:" title=":+1:" src="/assets/emojis/unicode/1f44d.png" class="emoji" width="20" height="20" />})
202
202
  end
203
+
204
+ it "returns nothing if the unicode emoji can't be found" do
205
+ expect(Emoji).to receive(:unicodes_index) { {} }
206
+ raw = "this is great 👍"
207
+
208
+ expect(render(raw)).to eql(%{this is great 👍})
209
+ end
203
210
  end
204
211
 
205
212
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Pitt