trmnl_preview 0.4.0 → 0.5.1
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +43 -25
- data/lib/trmnlp/api_client.rb +11 -1
- data/lib/trmnlp/cli.rb +22 -7
- data/lib/trmnlp/commands/base.rb +21 -4
- data/lib/trmnlp/commands/build.rb +2 -3
- data/lib/trmnlp/commands/clone.rb +30 -0
- data/lib/trmnlp/commands/init.rb +55 -0
- data/lib/trmnlp/commands/login.rb +4 -5
- data/lib/trmnlp/commands/pull.rb +4 -6
- data/lib/trmnlp/commands/push.rb +29 -11
- data/lib/trmnlp/config/app.rb +6 -2
- data/lib/trmnlp/paths.rb +6 -0
- data/lib/trmnlp/version.rb +1 -1
- data/lib/trmnlp.rb +3 -2
- data/templates/init/.trmnlp.yml +14 -0
- data/templates/init/bin/dev +25 -0
- data/templates/init/src/full.liquid +1 -0
- data/templates/init/src/half_horizontal.liquid +1 -0
- data/templates/init/src/half_vertical.liquid +1 -0
- data/templates/init/src/quadrant.liquid +1 -0
- data/templates/init/src/settings.yml +15 -0
- data/trmnl_preview.gemspec +3 -1
- metadata +25 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cee09b6deb0fc063e5358d6d636536513dc31cba86f0fe4e71ee4d2e1d3a7a5
|
4
|
+
data.tar.gz: 7b421d7ae1ace73b2e7370191e853946a857278f4f17332ace859bcf9581822a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d97a1e0f9c461796aa141b88d7c4c2826e2693764c5cdba9013260162b9dad16220b47bd49b36b2f8cbbaeb2c985d1851f3780b33326bd9f518f1d9604774eb
|
7
|
+
data.tar.gz: 16a38e4c92c20db294e80e6c729a3e7f12cdf5667785d80baabeb4ab93720a56b02a3346cb6efdae01d5d715b1919eab1d7fb4f34f40ffee2c7e96ce80158a69
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.5.1
|
4
|
+
|
5
|
+
- Fixed `trmnl init`
|
6
|
+
|
7
|
+
## 0.5.0
|
8
|
+
|
9
|
+
- Added `trmlnp init` command
|
10
|
+
- Added `trmnlp clone` command
|
11
|
+
- Improved `trmnlp push` to create remote plugin on first publish
|
12
|
+
- Changed syntax of `trmnlp push` and `trmnlp pull` commands
|
13
|
+
- Added `oj` gem for JSON parsing (#32)
|
14
|
+
|
3
15
|
## 0.4.0
|
4
16
|
|
5
17
|
### Plugin Migration Strategy
|
data/README.md
CHANGED
@@ -8,38 +8,50 @@ The server watches the filesystem for changes to the Liquid templates, seamlessl
|
|
8
8
|
|
9
9
|

|
10
10
|
|
11
|
-
##
|
11
|
+
## Project Structure
|
12
12
|
|
13
|
-
This is the structure of a plugin project
|
13
|
+
This is the structure of a plugin project:
|
14
14
|
|
15
15
|
```
|
16
|
-
.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
.
|
17
|
+
├── .trmnlp.yml
|
18
|
+
├── bin
|
19
|
+
│ └── dev
|
20
|
+
└── src
|
21
|
+
├── full.liquid
|
22
|
+
├── half_horizontal.liquid
|
23
|
+
├── half_vertical.liquid
|
24
|
+
├── quadrant.liquid
|
25
|
+
└── settings.yml
|
23
26
|
```
|
24
27
|
|
25
|
-
##
|
28
|
+
## Creating a New Plugin
|
29
|
+
|
30
|
+
You can start building a plugin locally, then `push` it to the TRMNL server for display on your device.
|
26
31
|
|
27
32
|
```sh
|
28
|
-
|
29
|
-
|
30
|
-
|
33
|
+
trmnlp init my_plugin # generate
|
34
|
+
cd my_plugin
|
35
|
+
trmnlp serve # develop locally
|
36
|
+
trmnlp login # authenticate
|
37
|
+
trmnlp push # upload
|
31
38
|
```
|
32
39
|
|
33
|
-
##
|
40
|
+
## Modifying an Existing Plugin
|
41
|
+
|
42
|
+
If you have built a plugin with the web-based editor, you can `clone` it, work on it locally, and `push` changes back to the server.
|
34
43
|
|
35
44
|
```sh
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
45
|
+
trmnlp login # authenticate
|
46
|
+
trmnlp clone my_plugin [id] # first download
|
47
|
+
cd my_plugin
|
48
|
+
trmnlp serve # develop locally
|
49
|
+
trmnlp push # upload
|
40
50
|
```
|
41
51
|
|
42
|
-
## Running
|
52
|
+
## Running trmnlp
|
53
|
+
|
54
|
+
### Via RubyGems
|
43
55
|
|
44
56
|
Prerequisites:
|
45
57
|
|
@@ -48,14 +60,21 @@ Prerequisites:
|
|
48
60
|
- Firefox
|
49
61
|
- ImageMagick
|
50
62
|
|
51
|
-
In the plugin project:
|
52
|
-
|
53
63
|
```sh
|
54
64
|
gem install trmnl_preview
|
55
65
|
trmnlp serve
|
56
66
|
```
|
57
67
|
|
58
|
-
|
68
|
+
### Via Docker (`trmnlp serve` only)
|
69
|
+
|
70
|
+
```sh
|
71
|
+
docker run \
|
72
|
+
-p 4567:4567 \
|
73
|
+
-v /path/to/plugin/on/host:/plugin \
|
74
|
+
trmnl/trmnlp
|
75
|
+
```
|
76
|
+
|
77
|
+
## `.trmnlp.yml` Reference - Project Config
|
59
78
|
|
60
79
|
The `.trmnlp.yml` file lives in the root of the plugin project, and is for configuring the local dev server.
|
61
80
|
|
@@ -65,7 +84,6 @@ supply plugin secrets, like API keys.
|
|
65
84
|
All fields are optional.
|
66
85
|
|
67
86
|
```yaml
|
68
|
-
# {{ env.VARIABLE }} interpolation is available here
|
69
87
|
---
|
70
88
|
# auto-reload when files change (`watch: false` to disable)
|
71
89
|
watch:
|
@@ -74,7 +92,7 @@ watch:
|
|
74
92
|
|
75
93
|
# values of custom fields (defined in src/settings.yml)
|
76
94
|
custom_fields:
|
77
|
-
station: "{{ env.ICAO }}"
|
95
|
+
station: "{{ env.ICAO }}" # interpolate $IACO environment variable
|
78
96
|
|
79
97
|
# override variables
|
80
98
|
variables:
|
@@ -86,7 +104,7 @@ variables:
|
|
86
104
|
|
87
105
|
```
|
88
106
|
|
89
|
-
##
|
107
|
+
## `src/settings.yml` Reference (Plugin Config)
|
90
108
|
|
91
109
|
The `settings.yml` file is part of the plugin definition.
|
92
110
|
|
data/lib/trmnlp/api_client.rb
CHANGED
@@ -33,12 +33,22 @@ module TRMNLP
|
|
33
33
|
response = conn.post("plugin_settings/#{id}/archive", payload)
|
34
34
|
|
35
35
|
if response.status == 200
|
36
|
-
|
36
|
+
JSON.parse(response.body)
|
37
37
|
else
|
38
38
|
raise Error, "failed to upload plugin settings archive: #{response.status} #{response.body}"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
def post_plugin_setting(params)
|
43
|
+
response = conn.post("plugin_settings", params.to_json, content_type: 'application/json')
|
44
|
+
|
45
|
+
if response.status == 200
|
46
|
+
JSON.parse(response.body)
|
47
|
+
else
|
48
|
+
raise Error, "failed to create plugin setting: #{response.status} #{response.body}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
42
52
|
private
|
43
53
|
|
44
54
|
attr_reader :config
|
data/lib/trmnlp/cli.rb
CHANGED
@@ -8,7 +8,9 @@ module TRMNLP
|
|
8
8
|
package_name 'trmnlp'
|
9
9
|
|
10
10
|
class_option :dir, type: :string, default: Dir.pwd, aliases: '-d',
|
11
|
-
desc: 'Plugin directory'
|
11
|
+
desc: 'Plugin project directory'
|
12
|
+
|
13
|
+
class_option :quiet, type: :boolean, default: false, desc: 'Suppress output', aliases: '-q'
|
12
14
|
|
13
15
|
def self.exit_on_failure? = true
|
14
16
|
|
@@ -22,18 +24,31 @@ module TRMNLP
|
|
22
24
|
Commands::Login.new(options).call
|
23
25
|
end
|
24
26
|
|
25
|
-
desc '
|
27
|
+
desc 'init NAME', 'Start a new plugin project'
|
28
|
+
method_option :skip_liquid, type: :boolean, default: false, desc: 'Skip generating liquid templates'
|
29
|
+
def init(name)
|
30
|
+
Commands::Init.new(options).call(name)
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'clone NAME ID', 'Copy a plugin project from TRMNL server'
|
34
|
+
def clone(name, id)
|
35
|
+
Commands::Clone.new(options).call(name, id)
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'pull', 'Download latest plugin settings from TRMNL server'
|
26
39
|
method_option :force, type: :boolean, default: false, aliases: '-f',
|
27
40
|
desc: 'Skip confirmation prompts'
|
28
|
-
|
29
|
-
|
41
|
+
method_option :id, type: :string, aliases: '-i', desc: 'Plugin settings ID'
|
42
|
+
def pull
|
43
|
+
Commands::Pull.new(options).call
|
30
44
|
end
|
31
45
|
|
32
|
-
desc 'push
|
46
|
+
desc 'push', 'Upload latest plugin settings to TRMNL server'
|
33
47
|
method_option :force, type: :boolean, default: false, aliases: '-f',
|
34
48
|
desc: 'Skip confirmation prompts'
|
35
|
-
|
36
|
-
|
49
|
+
method_option :id, type: :string, aliases: '-i', desc: 'Plugin settings ID'
|
50
|
+
def push
|
51
|
+
Commands::Push.new(options).call
|
37
52
|
end
|
38
53
|
|
39
54
|
desc 'serve', 'Start a local dev server'
|
data/lib/trmnlp/commands/base.rb
CHANGED
@@ -1,23 +1,40 @@
|
|
1
|
+
require 'thor/core_ext/hash_with_indifferent_access'
|
2
|
+
|
1
3
|
require_relative '../context'
|
2
4
|
|
3
5
|
module TRMNLP
|
4
6
|
module Commands
|
5
7
|
class Base
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
include Thor::CoreExt
|
9
|
+
|
10
|
+
def initialize(options = HashWithIndifferentAccess.new)
|
11
|
+
@options = HashWithIndifferentAccess.new(options)
|
12
|
+
@context = Context.new(@options.dir)
|
9
13
|
end
|
10
14
|
|
11
15
|
def call
|
12
16
|
raise NotImplementedError
|
13
17
|
end
|
14
18
|
|
15
|
-
|
19
|
+
protected
|
16
20
|
|
17
21
|
attr_accessor :options, :context
|
18
22
|
|
19
23
|
def config = context.config
|
20
24
|
def paths = context.paths
|
25
|
+
|
26
|
+
def authenticate!
|
27
|
+
raise Error, "please run `trmnlp login`" unless config.app.logged_in?
|
28
|
+
end
|
29
|
+
|
30
|
+
def output(message)
|
31
|
+
puts(message) unless options.quiet?
|
32
|
+
end
|
33
|
+
|
34
|
+
def prompt(message)
|
35
|
+
print message
|
36
|
+
$stdin.gets.chomp
|
37
|
+
end
|
21
38
|
end
|
22
39
|
end
|
23
40
|
end
|
@@ -4,18 +4,17 @@ module TRMNLP
|
|
4
4
|
module Commands
|
5
5
|
class Build < Base
|
6
6
|
def call
|
7
|
-
context = Context.new(options.dir)
|
8
7
|
context.validate!
|
9
8
|
context.poll_data
|
10
9
|
context.paths.create_build_dir
|
11
10
|
|
12
11
|
VIEWS.each do |view|
|
13
12
|
output_path = context.paths.build_dir.join("#{view}.html")
|
14
|
-
|
13
|
+
output "Writing #{output_path}..."
|
15
14
|
output_path.write(context.render_full_page(view))
|
16
15
|
end
|
17
16
|
|
18
|
-
|
17
|
+
output "Done!"
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
require_relative 'pull'
|
3
|
+
|
4
|
+
module TRMNLP
|
5
|
+
module Commands
|
6
|
+
class Clone < Base
|
7
|
+
def call(directory_name, id)
|
8
|
+
authenticate!
|
9
|
+
|
10
|
+
destination_path = Pathname.new(options.dir).join(directory_name)
|
11
|
+
raise Error, "directory #{destination_path} already exists, aborting" if destination_path.exist?
|
12
|
+
|
13
|
+
Init.new(dir: options.dir, skip_liquid: true, quiet: true).call(directory_name)
|
14
|
+
|
15
|
+
Pull.new(dir: destination_path.to_s, force: true, id: id).call
|
16
|
+
|
17
|
+
output <<~HEREDOC
|
18
|
+
|
19
|
+
To start the local server:
|
20
|
+
|
21
|
+
cd #{Pathname.new(destination_path).relative_path_from(Dir.pwd)} && trmnlp serve
|
22
|
+
HEREDOC
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def template_dir = paths.templates_dir.join('init')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
module TRMNLP
|
6
|
+
module Commands
|
7
|
+
class Init < Base
|
8
|
+
def call(name)
|
9
|
+
destination_dir = Pathname.new(options.dir).join(name)
|
10
|
+
|
11
|
+
unless destination_dir.exist?
|
12
|
+
output "Creating #{destination_dir}"
|
13
|
+
destination_dir.mkpath
|
14
|
+
end
|
15
|
+
|
16
|
+
template_dir.glob('**/{*,.*}').each do |source_pathname|
|
17
|
+
next if source_pathname.directory?
|
18
|
+
next if options.skip_liquid && source_pathname.extname == '.liquid'
|
19
|
+
|
20
|
+
relative_pathname = source_pathname.relative_path_from(template_dir)
|
21
|
+
destination_pathname = destination_dir.join(relative_pathname)
|
22
|
+
destination_pathname.dirname.mkpath
|
23
|
+
|
24
|
+
if destination_pathname.exist?
|
25
|
+
answer = prompt("#{destination_pathname} already exists. Overwrite? (y/n): ").downcase
|
26
|
+
if answer != 'y'
|
27
|
+
output "Skipping #{destination_pathname}"
|
28
|
+
next
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
output "Creating #{destination_pathname}"
|
33
|
+
FileUtils.cp(source_pathname, destination_pathname)
|
34
|
+
end
|
35
|
+
|
36
|
+
output <<~HEREDOC
|
37
|
+
|
38
|
+
To start the local server:
|
39
|
+
|
40
|
+
cd #{Pathname.new(destination_dir).relative_path_from(Dir.pwd)}
|
41
|
+
trmnlp serve
|
42
|
+
|
43
|
+
To publish the plugin:
|
44
|
+
|
45
|
+
trmnlp login
|
46
|
+
trmnlp push
|
47
|
+
HEREDOC
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def template_dir = paths.templates_dir.join('init')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -6,19 +6,18 @@ module TRMNLP
|
|
6
6
|
def call
|
7
7
|
if config.app.logged_in?
|
8
8
|
anonymous_key = config.app.api_key[0..10] + '*' * (config.app.api_key.length - 11)
|
9
|
-
|
9
|
+
output "Currently authenticated as: #{anonymous_key}"
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
output "Please visit #{config.app.account_uri} to grab your API key, then paste it here."
|
13
13
|
|
14
|
-
|
15
|
-
api_key = STDIN.gets.chomp
|
14
|
+
api_key = prompt("API Key: ")
|
16
15
|
raise Error, "API key cannot be empty" if api_key.empty?
|
17
16
|
|
18
17
|
config.app.api_key = api_key
|
19
18
|
config.app.save
|
20
19
|
|
21
|
-
|
20
|
+
output "Saved changes to #{paths.app_config}"
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
data/lib/trmnlp/commands/pull.rb
CHANGED
@@ -6,17 +6,15 @@ require_relative '../api_client'
|
|
6
6
|
module TRMNLP
|
7
7
|
module Commands
|
8
8
|
class Pull < Base
|
9
|
-
def call
|
9
|
+
def call
|
10
10
|
context.validate!
|
11
|
-
|
12
|
-
raise Error, "please run `trmnlp login`" unless config.app.logged_in?
|
11
|
+
authenticate!
|
13
12
|
|
14
|
-
plugin_settings_id
|
13
|
+
plugin_settings_id = options.id || config.plugin.id
|
15
14
|
raise Error, 'plugin ID must be specified' if plugin_settings_id.nil?
|
16
15
|
|
17
16
|
unless options.force
|
18
|
-
|
19
|
-
answer = $stdin.gets.chomp.downcase
|
17
|
+
answer = prompt("Local plugin files will be overwritten. Are you sure? (y/n) ").downcase
|
20
18
|
raise Error, 'aborting' unless answer == 'y' || answer == 'yes'
|
21
19
|
end
|
22
20
|
|
data/lib/trmnlp/commands/push.rb
CHANGED
@@ -6,21 +6,27 @@ require_relative '../api_client'
|
|
6
6
|
module TRMNLP
|
7
7
|
module Commands
|
8
8
|
class Push < Base
|
9
|
-
def call
|
9
|
+
def call
|
10
10
|
context.validate!
|
11
|
-
|
12
|
-
|
11
|
+
authenticate!
|
12
|
+
|
13
|
+
is_new = false
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
api = APIClient.new(config)
|
16
|
+
|
17
|
+
plugin_settings_id = options.id || config.plugin.id
|
18
|
+
if plugin_settings_id.nil?
|
19
|
+
output 'Creating a new plugin on the server...'
|
20
|
+
response = api.post_plugin_setting(name: 'New TRMNLP Plugin', plugin_id: 37) # hardcoded id for private_plugin
|
21
|
+
plugin_settings_id = response.dig('data', 'id')
|
22
|
+
is_new = true
|
23
|
+
end
|
16
24
|
|
17
|
-
unless options.force
|
18
|
-
|
19
|
-
answer = $stdin.gets.chomp.downcase
|
25
|
+
unless is_new || options.force
|
26
|
+
answer = prompt("Plugin settings on the server will be overwritten. Are you sure? (y/n) ").downcase
|
20
27
|
raise Error, 'aborting' unless answer == 'y' || answer == 'yes'
|
21
28
|
end
|
22
29
|
|
23
|
-
api = APIClient.new(config)
|
24
30
|
size = 0
|
25
31
|
|
26
32
|
Tempfile.create(binmode: true) do |temp_file|
|
@@ -30,13 +36,25 @@ module TRMNLP
|
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
33
|
-
api.post_plugin_setting_archive(plugin_settings_id, temp_file.path)
|
39
|
+
response = api.post_plugin_setting_archive(plugin_settings_id, temp_file.path)
|
40
|
+
paths.plugin_config.write(response.dig('data', 'settings_yaml'))
|
34
41
|
|
35
42
|
size = File.size(temp_file.path)
|
36
43
|
end
|
37
44
|
|
45
|
+
output <<~HEREDOC
|
46
|
+
Uploaded plugin (#{size} bytes)
|
47
|
+
Dashboard: #{config.app.edit_plugin_settings_uri(plugin_settings_id)}
|
48
|
+
HEREDOC
|
49
|
+
|
50
|
+
if is_new
|
51
|
+
output <<~HEREDOC
|
38
52
|
|
39
|
-
|
53
|
+
IMPORTANT! Don't forget to add it to your device playlist!
|
54
|
+
|
55
|
+
#{config.app.playlists_uri}
|
56
|
+
HEREDOC
|
57
|
+
end
|
40
58
|
end
|
41
59
|
end
|
42
60
|
end
|
data/lib/trmnlp/config/app.rb
CHANGED
@@ -25,9 +25,13 @@ module TRMNLP
|
|
25
25
|
|
26
26
|
def base_uri = URI.parse(@config['base_url'] || 'https://usetrmnl.com')
|
27
27
|
|
28
|
-
def api_uri = URI.join(base_uri, 'api')
|
28
|
+
def api_uri = URI.join(base_uri, '/api')
|
29
29
|
|
30
|
-
def account_uri = URI.join(base_uri, 'account')
|
30
|
+
def account_uri = URI.join(base_uri, '/account')
|
31
|
+
|
32
|
+
def edit_plugin_settings_uri(id) = URI.join(base_uri, "/plugin_settings/#{id.to_s}/edit")
|
33
|
+
|
34
|
+
def playlists_uri = URI.join(base_uri, '/playlists')
|
31
35
|
|
32
36
|
private
|
33
37
|
|
data/lib/trmnlp/paths.rb
CHANGED
@@ -8,6 +8,12 @@ module TRMNLP
|
|
8
8
|
@root_dir = Pathname.new(root_dir)
|
9
9
|
@xdg = XDG.new
|
10
10
|
end
|
11
|
+
|
12
|
+
# --- trmnlp library ---
|
13
|
+
|
14
|
+
def gem_dir = Pathname.new(__dir__).join('..', '..').expand_path
|
15
|
+
|
16
|
+
def templates_dir = gem_dir.join('templates')
|
11
17
|
|
12
18
|
# --- directories ---
|
13
19
|
|
data/lib/trmnlp/version.rb
CHANGED
data/lib/trmnlp.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module TRMNLP; end
|
4
|
-
|
4
|
+
require 'oj'
|
5
|
+
Oj.mimic_JSON()
|
5
6
|
require_relative "trmnlp/config"
|
6
7
|
require_relative "trmnlp/context"
|
7
8
|
require_relative "trmnlp/version"
|
@@ -10,4 +11,4 @@ module TRMNLP
|
|
10
11
|
VIEWS = %w{full half_horizontal half_vertical quadrant}
|
11
12
|
|
12
13
|
class Error < StandardError; end
|
13
|
-
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# TRMNLP configuration
|
2
|
+
# {{ env.VARIABLE }} interpolation is available here
|
3
|
+
---
|
4
|
+
# auto-reload when files change (`watch: false` to disable)
|
5
|
+
watch:
|
6
|
+
- .trmnlp.yml
|
7
|
+
- src
|
8
|
+
|
9
|
+
# values of custom fields (defined in src/settings.yml)
|
10
|
+
custom_fields: {}
|
11
|
+
|
12
|
+
# override variables
|
13
|
+
variables:
|
14
|
+
trmnl: {}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#! /bin/bash
|
2
|
+
|
3
|
+
if command -v trmnlp &> /dev/null
|
4
|
+
then
|
5
|
+
echo "Starting trmnlp..."
|
6
|
+
trmnlp serve
|
7
|
+
exit
|
8
|
+
fi
|
9
|
+
|
10
|
+
if command -v docker &> /dev/null
|
11
|
+
then
|
12
|
+
echo "Running trmnl/trmnlp container..."
|
13
|
+
docker run -p 4567:4567 -v .:/plugin trmnl/trmnlp
|
14
|
+
exit
|
15
|
+
fi
|
16
|
+
|
17
|
+
echo "Install the trmnl_preview gem:
|
18
|
+
|
19
|
+
gem install trmnl_preview
|
20
|
+
|
21
|
+
Or install Docker:
|
22
|
+
|
23
|
+
https://docs.docker.com/get-docker/"
|
24
|
+
|
25
|
+
exit 1
|
@@ -0,0 +1 @@
|
|
1
|
+
full!
|
@@ -0,0 +1 @@
|
|
1
|
+
half horizontal!
|
@@ -0,0 +1 @@
|
|
1
|
+
half vertical!
|
@@ -0,0 +1 @@
|
|
1
|
+
quadrant!
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#
|
2
|
+
# Changes to this file will be overwritten by `trmnlp pull`.
|
3
|
+
#
|
4
|
+
# Docs: https://help.usetrmnl.com/en/articles/10542599-importing-and-exporting-private-plugins#h_581fb988f0
|
5
|
+
#
|
6
|
+
---
|
7
|
+
strategy: polling
|
8
|
+
no_screen_padding: 'no'
|
9
|
+
dark_mode: 'no'
|
10
|
+
static_data: ''
|
11
|
+
polling_verb: get
|
12
|
+
polling_url: ''
|
13
|
+
polling_headers: ''
|
14
|
+
name: My Plugin
|
15
|
+
refresh_interval: 1440
|
data/trmnl_preview.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
[
|
24
24
|
'bin/**/*',
|
25
25
|
'lib/**/*',
|
26
|
+
'templates/**/{*,.*}',
|
26
27
|
'web/**/*',
|
27
28
|
'CHANGELOG.md',
|
28
29
|
'LICENSE.txt',
|
@@ -44,7 +45,7 @@ Gem::Specification.new do |spec|
|
|
44
45
|
# HTML rendering
|
45
46
|
spec.add_dependency "liquid", "~> 5.6"
|
46
47
|
spec.add_dependency "activesupport", "~> 8.0"
|
47
|
-
|
48
|
+
|
48
49
|
# BMP rendering
|
49
50
|
spec.add_dependency "ferrum", "~> 0.16"
|
50
51
|
spec.add_dependency 'puppeteer-ruby', '~> 0.45.6'
|
@@ -57,6 +58,7 @@ Gem::Specification.new do |spec|
|
|
57
58
|
spec.add_dependency "xdg", "~> 9.1"
|
58
59
|
spec.add_dependency "rubyzip", "~> 2.3.0"
|
59
60
|
spec.add_dependency "thor", "~> 1.3"
|
61
|
+
spec.add_dependency "oj", "~> 3.16.9"
|
60
62
|
|
61
63
|
# For more information and examples about making a new gem, check out our
|
62
64
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trmnl_preview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rockwell Schrock
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-17 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: sinatra
|
@@ -219,6 +219,20 @@ dependencies:
|
|
219
219
|
- - "~>"
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '1.3'
|
222
|
+
- !ruby/object:Gem::Dependency
|
223
|
+
name: oj
|
224
|
+
requirement: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - "~>"
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 3.16.9
|
229
|
+
type: :runtime
|
230
|
+
prerelease: false
|
231
|
+
version_requirements: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - "~>"
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: 3.16.9
|
222
236
|
description: Automatically rebuild and preview TRNML plugins in multiple views
|
223
237
|
email:
|
224
238
|
- rockwell@schrock.me
|
@@ -238,6 +252,8 @@ files:
|
|
238
252
|
- lib/trmnlp/commands.rb
|
239
253
|
- lib/trmnlp/commands/base.rb
|
240
254
|
- lib/trmnlp/commands/build.rb
|
255
|
+
- lib/trmnlp/commands/clone.rb
|
256
|
+
- lib/trmnlp/commands/init.rb
|
241
257
|
- lib/trmnlp/commands/login.rb
|
242
258
|
- lib/trmnlp/commands/pull.rb
|
243
259
|
- lib/trmnlp/commands/push.rb
|
@@ -251,6 +267,13 @@ files:
|
|
251
267
|
- lib/trmnlp/paths.rb
|
252
268
|
- lib/trmnlp/screen_generator.rb
|
253
269
|
- lib/trmnlp/version.rb
|
270
|
+
- templates/init/.trmnlp.yml
|
271
|
+
- templates/init/bin/dev
|
272
|
+
- templates/init/src/full.liquid
|
273
|
+
- templates/init/src/half_horizontal.liquid
|
274
|
+
- templates/init/src/half_vertical.liquid
|
275
|
+
- templates/init/src/quadrant.liquid
|
276
|
+
- templates/init/src/settings.yml
|
254
277
|
- trmnl_preview.gemspec
|
255
278
|
- web/public/black-case.jpg
|
256
279
|
- web/public/clear-case.jpg
|