Skip to content

Commit

Permalink
justfile runner (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejressel authored Mar 30, 2024
1 parent 7e429f4 commit 8c78e12
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 83 deletions.
7 changes: 6 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# Getting started
# Getting started

## Requirements

- [Rust](https://rustup.rs/)
- [just](https://github.com/casey/just)
8 changes: 8 additions & 0 deletions examples/simple/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set windows-shell := ["pwsh.exe", "-c"]

build:
cargo run -p cargo-pulumi

run:
just build
cargo run -p pulumi_wasm_runner -- run --wasm ../../target/wasm32-wasi/debug/composed.wasm
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ regenerate-providers:

test:
cargo test --all

docs:
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
5 changes: 2 additions & 3 deletions pulumi-language-wasm/executors/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ type wasmExecutorFactory interface {

func NewWasmExecutor(opts WasmExecutorOptions) (*WasmExecutor, error) {
e, err := combineWasmExecutorFactories(
&windows{},
&unix{},
&justfile{},
).NewWasmExecutor(opts)
if err != nil {
return nil, err
}
if e == nil {
return nil, fmt.Errorf("failed to configure executor, tried: entrypoint.bat, entrypoint.sh")
return nil, fmt.Errorf("failed to configure executor, tried: justfile")
}
return e, nil
}
Expand Down
33 changes: 33 additions & 0 deletions pulumi-language-wasm/executors/executor_justfile_os.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2022, Pulumi Corporation. All rights reserved.

package executors

import (
"github.com/andrzejressel/pulumi-wasm/pulumi-language-wasm/fsys"
)

type justfile struct{}

var _ wasmExecutorFactory = &justfile{}

func (s justfile) NewWasmExecutor(opts WasmExecutorOptions) (*WasmExecutor, error) {
exists, err := fsys.FileExists(opts.WD, "justfile")
if err != nil {
return nil, err
}
if !exists {
return nil, nil
}
return s.newWasmCliExecutor()
}

func (justfile) newWasmCliExecutor() (*WasmExecutor, error) {
return &WasmExecutor{
Name: "just",
Cmd: "just",
BuildArgs: []string{"build"},
RunArgs: []string{"run"},
PluginArgs: []string{"plugin"},
VersionArgs: []string{"version"},
}, nil
}
38 changes: 0 additions & 38 deletions pulumi-language-wasm/executors/executor_unix_os.go

This file was deleted.

38 changes: 0 additions & 38 deletions pulumi-language-wasm/executors/executor_windows_os.go

This file was deleted.

1 change: 0 additions & 1 deletion scripts/README.md

This file was deleted.

1 change: 0 additions & 1 deletion scripts/docs.ps1

This file was deleted.

1 change: 0 additions & 1 deletion scripts/docs.sh

This file was deleted.

0 comments on commit 8c78e12

Please sign in to comment.