Skip to content

Commit

Permalink
Windows to Unix line ending conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ringods committed Aug 27, 2024
1 parent 4f5fce1 commit 3d030c3
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 128 deletions.
126 changes: 63 additions & 63 deletions provider/cmd/pulumi-resource-acme/generate.go
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
// Copyright 2016-2020, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build ignore

package main

import (
"encoding/json"
"errors"
"io/fs"
"io/ioutil"
"log"
"os"

"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
)

func main() {
version, found := os.LookupEnv("VERSION")
if !found {
log.Fatal("version not found")
}

schemaContents, err := ioutil.ReadFile("./schema.json")
if err != nil {
log.Fatal(err)
}

var packageSpec schema.PackageSpec
err = json.Unmarshal(schemaContents, &packageSpec)
if err != nil {
log.Fatalf("cannot deserialize schema: %v", err)
}

packageSpec.Version = version
versionedContents, err := json.Marshal(packageSpec)
if err != nil {
log.Fatalf("cannot reserialize schema: %v", err)
}

// Clean up schema.go as it may be present & gitignored and tolerate an error if the file isn't present.
err = os.Remove("./schema.go")
if err != nil && !errors.Is(err, fs.ErrNotExist) {
log.Fatal(err)
}

err = ioutil.WriteFile("./schema-embed.json", versionedContents, 0600)
if err != nil {
log.Fatal(err)
}
}
// Copyright 2016-2020, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build ignore

package main

import (
"encoding/json"
"errors"
"io/fs"
"io/ioutil"
"log"
"os"

"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
)

func main() {
version, found := os.LookupEnv("VERSION")
if !found {
log.Fatal("version not found")
}

schemaContents, err := ioutil.ReadFile("./schema.json")
if err != nil {
log.Fatal(err)
}

var packageSpec schema.PackageSpec
err = json.Unmarshal(schemaContents, &packageSpec)
if err != nil {
log.Fatalf("cannot deserialize schema: %v", err)
}

packageSpec.Version = version
versionedContents, err := json.Marshal(packageSpec)
if err != nil {
log.Fatalf("cannot reserialize schema: %v", err)
}

// Clean up schema.go as it may be present & gitignored and tolerate an error if the file isn't present.
err = os.Remove("./schema.go")
if err != nil && !errors.Is(err, fs.ErrNotExist) {
log.Fatal(err)
}

err = ioutil.WriteFile("./schema-embed.json", versionedContents, 0600)
if err != nil {
log.Fatal(err)
}
}
78 changes: 39 additions & 39 deletions provider/cmd/pulumi-resource-acme/main.go
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate go run ./generate.go

package main

import (
_ "embed"
"os"

"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
acme "github.com/pulumiverse/pulumi-acme/provider"
"github.com/pulumiverse/pulumi-acme/provider/pkg/version"
"github.com/vancluever/terraform-provider-acme/v2/acme/dnsplugin"
)

//go:embed schema-embed.json
var pulumiSchema []byte

func main() {
if len(os.Args) == 2 && os.Args[1] == dnsplugin.PluginArg {
// Start the plugin here
dnsplugin.Serve()
} else {
tfbridge.Main("acme", version.Version, acme.Provider(), pulumiSchema)
}
}
// Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate go run ./generate.go

package main

import (
_ "embed"
"os"

"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
acme "github.com/pulumiverse/pulumi-acme/provider"
"github.com/pulumiverse/pulumi-acme/provider/pkg/version"
"github.com/vancluever/terraform-provider-acme/v2/acme/dnsplugin"
)

//go:embed schema-embed.json
var pulumiSchema []byte

func main() {
if len(os.Args) == 2 && os.Args[1] == dnsplugin.PluginArg {
// Start the plugin here
dnsplugin.Serve()
} else {
tfbridge.Main("acme", version.Version, acme.Provider(), pulumiSchema)
}
}
52 changes: 26 additions & 26 deletions provider/cmd/pulumi-tfgen-acme/main.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen"
acme "github.com/pulumiverse/pulumi-acme/provider"
"github.com/pulumiverse/pulumi-acme/provider/pkg/version"
)

func main() {
// Modify the path to point to the new provider
tfgen.Main("acme", version.Version, acme.Provider())
}
// Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen"
acme "github.com/pulumiverse/pulumi-acme/provider"
"github.com/pulumiverse/pulumi-acme/provider/pkg/version"
)

func main() {
// Modify the path to point to the new provider
tfgen.Main("acme", version.Version, acme.Provider())
}

0 comments on commit 3d030c3

Please sign in to comment.