trmnl_preview 0.8.2 → 0.8.3

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
  SHA256:
3
- metadata.gz: 236a5502b02ab161fffc5330fc712c329810f877038c71baadc86b376e607157
4
- data.tar.gz: 41400bbbe0b54639311ae928280277ee1717f58f1de74bd71ab92f213bbe92db
3
+ metadata.gz: c021076f55f8b5d150e65e2202c5bc978e8709684ee4d9bf27c0b7ec8e0b59b8
4
+ data.tar.gz: daa5e5734d9b1e3d755b789b0081916e53ce6c0a3cdd6d75e5276335ad2dae83
5
5
  SHA512:
6
- metadata.gz: 604a7f74231c2e738dbf61995469a64e488cc1d69fa9eb84076fb9badfb2d83fd8c490fa261154471852e7c7effb6071e458d40e748bc70de7ea27455d5a8485
7
- data.tar.gz: c4396159f68882180618578725f2e386e703a9d992a195a5ce2de463d8dab407d9b0a30655495963e0b1af35ee2ab0813fae75ed77633d616312fa64246ef753
6
+ metadata.gz: d422c11366ba16381be6765dfb36a25e2a662db4e9da3f3b08b780bbabbd94338d65f0f75bf6cbb82a0aa51fee8660886e5cd14203ccfbd2145539a617823559
7
+ data.tar.gz: 87b5bb57b023748ecc9412e13059801a755e6d0d03c82f27aaacc2077c119ed4386e28fba8a3a4f62ee47b783d4c92e49905d1a47fb29e2f8a93da7caddc563d
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
 
2
2
  # Changelog
3
3
 
4
+ ## 0.8.3
5
+
6
+ - `trmnlp init` and `trmnlp clone` now scaffold a `.github/workflows/trmnl.yml` CI workflow and a `.gitignore`, and run `git init -b main`, so a cloned plugin is ready to push to GitHub and deploy on every commit to `main`
7
+ - Added `--skip-git` to `trmnlp init` and `trmnlp clone` for projects that manage Git themselves
8
+ - The Docker image now ships `git` so the `docker run trmnl/trmnlp clone` flow leaves a ready-to-push project on the host
9
+ - View templates now ship canonical `layout` + `title_bar` markup that passes `trmnlp lint`
10
+
4
11
  ## 0.8.2
5
12
 
6
13
  - Fixed `framework_version: latest` rendering against the auto-upgrading `/latest/` asset path instead of the current concrete release, matching the hosted service (#99)
data/README.md CHANGED
@@ -28,6 +28,10 @@ This is the structure of a plugin project:
28
28
 
29
29
  ```
30
30
  .
31
+ ├── .github
32
+ │ └── workflows
33
+ │ └── trmnl.yml
34
+ ├── .gitignore
31
35
  ├── .trmnlp.yml
32
36
  ├── bin
33
37
  │ └── trmnlp
@@ -42,6 +46,8 @@ This is the structure of a plugin project:
42
46
 
43
47
  | File | Purpose |
44
48
  |---|---|
49
+ | `.github/workflows/trmnl.yml` | GitHub Actions workflow — lints every PR, deploys to TRMNL on `main` |
50
+ | `.gitignore` | Keeps `trmnlp build` output out of version control |
45
51
  | `.trmnlp.yml` | Local dev-server config — not uploaded to TRMNL |
46
52
  | `src/full.liquid` | Markup for the full screen |
47
53
  | `src/half_horizontal.liquid` | Top or bottom half of a stacked mashup |
@@ -123,9 +129,12 @@ If an environment variable is more convenient (for example in a CI/CD pipeline),
123
129
 
124
130
  ## Continuous Integration
125
131
 
126
- `trmnlp` runs in GitHub Actions without `trmnlp login` set the `TRMNL_API_KEY`
127
- environment variable and it's used in place of the saved config. Add it as a
128
- repository secret, then drop this into `.github/workflows/trmnl.yml`:
132
+ `trmnlp init` and `trmnlp clone` scaffold a `.github/workflows/trmnl.yml`
133
+ workflow and initialize a Git repository, so a fresh project is ready to push
134
+ to GitHub. The workflow runs in GitHub Actions without `trmnlp login` — set the
135
+ `TRMNL_API_KEY` environment variable and it's used in place of the saved
136
+ config. Add it as a repository secret to activate the workflow; it looks like
137
+ this:
129
138
 
130
139
  ```yaml
131
140
  name: TRMNL
data/lib/trmnlp/cli.rb CHANGED
@@ -34,11 +34,13 @@ module TRMNLP
34
34
 
35
35
  desc 'init NAME', 'Start a new plugin project'
36
36
  method_option :skip_liquid, type: :boolean, default: false, desc: 'Skip generating liquid templates'
37
+ method_option :skip_git, type: :boolean, default: false, desc: 'Skip initializing a git repository'
37
38
  def init(name)
38
39
  Commands::Init.run(options, name)
39
40
  end
40
41
 
41
42
  desc 'clone NAME ID', 'Copy a plugin project from TRMNL server'
43
+ method_option :skip_git, type: :boolean, default: false, desc: 'Skip initializing a git repository'
42
44
  def clone(name, id)
43
45
  Commands::Clone.run(options, name, id)
44
46
  end
@@ -7,7 +7,7 @@ require_relative 'pull'
7
7
  module TRMNLP
8
8
  module Commands
9
9
  class Clone < Base
10
- Options = Data.define(:dir, :quiet)
10
+ Options = Data.define(:dir, :quiet, :skip_git)
11
11
 
12
12
  def call(directory_name, id)
13
13
  authenticate!
@@ -15,7 +15,7 @@ module TRMNLP
15
15
  destination_path = Pathname.new(options.dir).join(directory_name)
16
16
  raise DirectoryExists, "directory #{destination_path} already exists, aborting" if destination_path.exist?
17
17
 
18
- Init.run({ dir: options.dir, skip_liquid: true, quiet: true }, directory_name)
18
+ Init.run({ dir: options.dir, skip_liquid: true, quiet: true, skip_git: options.skip_git }, directory_name)
19
19
 
20
20
  Pull.run({ dir: destination_path.to_s, force: true, id: id })
21
21
 
@@ -7,7 +7,7 @@ require_relative 'base'
7
7
  module TRMNLP
8
8
  module Commands
9
9
  class Init < Base
10
- Options = Data.define(:dir, :quiet, :skip_liquid)
10
+ Options = Data.define(:dir, :quiet, :skip_liquid, :skip_git)
11
11
 
12
12
  def call(name)
13
13
  destination_dir = Pathname.new(options.dir).join(name)
@@ -17,7 +17,9 @@ module TRMNLP
17
17
  destination_dir.mkpath
18
18
  end
19
19
 
20
- template_dir.glob('**/{*,.*}').each do |source_pathname|
20
+ # NOTE: FNM_DOTMATCH so the glob descends into hidden template
21
+ # directories (e.g. .github/); without it those files are skipped.
22
+ template_dir.glob('**/{*,.*}', File::FNM_DOTMATCH).each do |source_pathname|
21
23
  next if source_pathname.directory?
22
24
  next if options.skip_liquid && source_pathname.extname == '.liquid'
23
25
 
@@ -41,6 +43,8 @@ module TRMNLP
41
43
  destination_pathname.chmod(destination_pathname.stat.mode | 0o200)
42
44
  end
43
45
 
46
+ init_git_repo(destination_dir) unless options.skip_git
47
+
44
48
  reporter.info <<~HEREDOC
45
49
 
46
50
  To start the local server:
@@ -58,6 +62,13 @@ module TRMNLP
58
62
  private
59
63
 
60
64
  def template_dir = paths.templates_dir.join('init')
65
+
66
+ # Make the scaffold a Git repository on `main` so it's ready to push
67
+ # to GitHub (the workflow's `branches: [main]` trigger requires it,
68
+ # regardless of the host's init.defaultBranch).
69
+ # Does nothing when git is unavailable — `system` returns nil rather
70
+ # than raising, so the scaffold itself still succeeds.
71
+ def init_git_repo(dir) = system('git', 'init', '-q', '-b', 'main', dir.to_s)
61
72
  end
62
73
  end
63
74
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TRMNLP
4
- VERSION = '0.8.2'
4
+ VERSION = '0.8.3'
5
5
  end
@@ -0,0 +1,30 @@
1
+ name: TRMNL
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ lint:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v6
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: "4.0"
15
+ - run: gem install trmnl_preview
16
+ - run: trmnlp lint
17
+
18
+ push:
19
+ needs: lint
20
+ if: github.ref == 'refs/heads/main'
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v6
24
+ - uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: "4.0"
27
+ - run: gem install trmnl_preview
28
+ - run: trmnlp push --force
29
+ env:
30
+ TRMNL_API_KEY: ${{ secrets.TRMNL_API_KEY }}
@@ -0,0 +1,2 @@
1
+ # trmnlp build output
2
+ _build/
@@ -1 +1,7 @@
1
- full!
1
+ <div class="layout layout--col layout--center">
2
+ <span class="title title--large">Hello, TRMNL!</span>
3
+ </div>
4
+
5
+ <div class="title_bar">
6
+ <span class="title">My Plugin</span>
7
+ </div>
@@ -1 +1,7 @@
1
- half horizontal!
1
+ <div class="layout layout--col layout--center">
2
+ <span class="title title--large">Half horizontal</span>
3
+ </div>
4
+
5
+ <div class="title_bar">
6
+ <span class="title">My Plugin</span>
7
+ </div>
@@ -1 +1,7 @@
1
- half vertical!
1
+ <div class="layout layout--col layout--center">
2
+ <span class="title title--large">Half vertical</span>
3
+ </div>
4
+
5
+ <div class="title_bar">
6
+ <span class="title">My Plugin</span>
7
+ </div>
@@ -1 +1,7 @@
1
- quadrant!
1
+ <div class="layout layout--col layout--center">
2
+ <span class="title title--large">Quadrant</span>
3
+ </div>
4
+
5
+ <div class="title_bar">
6
+ <span class="title">My Plugin</span>
7
+ </div>
@@ -21,17 +21,20 @@ Gem::Specification.new do |spec|
21
21
  spec.metadata['rubygems_mfa_required'] = 'true'
22
22
 
23
23
  spec.files = Dir.chdir(__dir__) do
24
- [
24
+ files = [
25
25
  'bin/**/*',
26
26
  'db/**/*',
27
27
  'lib/**/*',
28
- 'templates/**/{*,.*}',
29
28
  'web/**/*',
30
29
  'CHANGELOG.md',
31
30
  'LICENSE.txt',
32
31
  'README.md',
33
32
  'trmnl_preview.gemspec'
34
33
  ].flat_map { |glob| Dir[glob] }
34
+
35
+ # FNM_DOTMATCH so the glob descends into the templates' hidden directories
36
+ # (e.g. .github/) — a plain Dir[] skips them and drops the file from the gem.
37
+ files + Dir.glob('templates/**/{*,.*}', File::FNM_DOTMATCH)
35
38
  end
36
39
  spec.bindir = 'bin'
37
40
  spec.executables = ['trmnlp']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trmnl_preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rockwell Schrock
@@ -319,6 +319,8 @@ files:
319
319
  - lib/trmnlp/user_data_assembler.rb
320
320
  - lib/trmnlp/version.rb
321
321
  - lib/trmnlp/watcher.rb
322
+ - templates/init/.github/workflows/trmnl.yml
323
+ - templates/init/.gitignore
322
324
  - templates/init/.trmnlp.yml
323
325
  - templates/init/bin/trmnlp
324
326
  - templates/init/src/full.liquid