Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X Workflow Updates #59

Merged
merged 5 commits into from
Jan 28, 2019

Conversation

NotMyself
Copy link

@NotMyself NotMyself commented Jan 27, 2019

Fixes #42

Hey, this is Auth0Bobby from Twitch! I took some time today to try to get this building under OS X. The post-build bash script had a few issues that were perplexing and fun to track down.

First, it seemed as if the file might have been created on windows, this led to the file encoding being all b0rked and ? being added to some strings.

Next, the .editorconfig was forcing end_of_line to crlf on files. So editing the file in VSCode was inserting bad line endings for OS X. I updated the editor config to set it to lf for all .sh files.

[*.sh]
end_of_line = lf

Next, the fact that the plugins directory is located in ~/Library/Application Support/... was causing some commands to break. These commands were seeing the space as a separator and b0rking. Also, the script has a dependency on jq, but does not handle the case where jq is missing. I rewrote the entire script to simplify it and make it work as expected. Here is a brief explanation of what it all does.

echo 'Killing the Stream Deck process'
pkill 'Stream Deck'

 # use sed to get the uuid
uuid=$(sed -n 's/.*"UUID": "\(.*\)"/\1/p' manifest.json)
 # use parameter expansion to trip the suffix off the uuid to get the pluginname
pluginName=${uuid%.*}
# set a variable to the plugin directory so we don't have to type it over and over
pluginsDir="$HOME/Library/Application Support/com.elgato.StreamDeck/Plugins"
# set a variable to the current working directory
projectDir=$(PWD)


echo "Installing the $pluginName plugin to $pluginsDir"

# push the plugin directory on to the working directory stack
pushd "$pluginsDir"
# check of the plugin directory exists and nuke it if it does
[ -d "$pluginName.sdPlugin" ] && rm -r $pluginName.sdPlugin
# create the plugin directory
mkdir $pluginName.sdPlugin
# copy recursively the build output from the project directory tot he plugin directory
cp -R "$projectDir/bin/Debug/netcoreapp2.2/osx-x64/." $pluginName.sdPlugin
# pop the current directory off the working directory stack
popd

echo "Done installing ${pluginName}"

open /Applications/Stream\ Deck.app &

exit

Finally, the manifest.json had the CodePathMac value pointing to something that did not exist. I set it to the correct executable name.

{
    "CodePathWin": "SamplePlugin.exe",
    "CodePathMac":  "SamplePlugin"
}

Here is a short gif showing the build working on my machine. 😁

build

@csharpfritz
Copy link
Collaborator

This looks really promising. Adding @bradygaster to review on Mac

@hugodahl
Copy link
Contributor

I managed to find where it was originally updated to using sed. @derekforeman made the change to use basic macOS/*nix commands in commit 4809fbb

I'm thinking it would probably be easier on the consumer of the template if we reduce the number of external dependencies to be installed if possible, or automate their retrieval and installation as much as possible.

@NotMyself
Copy link
Author

@hugodahl are you referring to the use of jq?

@NotMyself
Copy link
Author

Yeah OK, I found the line you were referring to and removed the dependency on jq in favor of sed.

@hugodahl
Copy link
Contributor

Cool. I do think, jq would be much easier and cleaner, just like XPath would be if it were XML. That's one thing that thr npm platform does well. Having a package that does lpad and can break the world is not so great tho. You take the good, you take the bad, you take them both, and something something... ;)

@csharpfritz
Copy link
Collaborator

csharpfritz commented Jan 27, 2019 via email

@NotMyself
Copy link
Author

Maybe. At this point going down that road just to use jq on a single line of a single script seems like overkill to me.

@hugodahl
Copy link
Contributor

I agree, at some point there may be the need to be a set of prerequisites, however, with multiple platforms, the complexity increases.

For example, do we want to maintain parity between platform specific scripts? Do we want to use equivalent utilities across platforms? Does each platform require a validator/maintainer?

Given those questions, there's also the option of requiring specific dev environment requirements. Perhaps require PowerShell core when that time comes, to potentially have a single script (Thursday's stream may shed some light on this option), with access to the package ecosystem and [relative] ease of writing our own extensions.

I'm not making a point or argument for or against any option. Just mentioning pain points of previous experiences to help ensure we have necessary information for the discussion.

@csharpfritz
Copy link
Collaborator

csharpfritz commented Jan 27, 2019 via email

@derekforeman
Copy link
Contributor

I think we have doubled up, #54. Odd about the line endings, I’m on a Mac. Happy to see have t move forward.

@hugodahl
Copy link
Contributor

Agreed @derekforeman. I think that now makes 4 of us on macOS? You, @bradygaster, @NotMyself (aka Auth0Bobby) and me.

@bradygaster
Copy link
Collaborator

I wholly agree with this - less dependencies == good stuff.

I'm thinking it would probably be easier on the consumer of the template if we reduce the number of external dependencies to be installed if possible, or automate their retrieval and installation as much as possible.

@bradygaster
Copy link
Collaborator

Agreed @derekforeman. I think that now makes 4 of us on macOS? You, @bradygaster, @NotMyself (aka Auth0Bobby) and me.

It's good to know I'm not the only one trying to do this.

Copy link
Collaborator

@bradygaster bradygaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to everyone who contributed to enabling this on the Mac. It is great for @csharpfritz and I to have your support and knowledge in this space to get this going!

@NotMyself
Copy link
Author

Happy to help @bradygaster @csharpfritz. I am not just a contributor, I am a user.

hair-club-for-men-1

@csharpfritz csharpfritz merged commit 1a40c20 into FritzAndFriends:dev Jan 28, 2019
@csharpfritz
Copy link
Collaborator

Merging as approved by @bradygaster

csharpfritz added a commit that referenced this pull request Jan 29, 2019
* Fixing dev (#43)

* Implemented the rest of the events the StreamDeck App can send our plugin

* Revert "Implement StreamDeck Events Received"

* almost finished with mac script

* finalized mac inner loop

* Added vscode workspace stub to build upon (#41)

* now it will compile (#44)

* started working on fixing the dotnet new experience for mac

* fixed compilation

* added debug capability, not quite there yet

* register plugin tidy up

- Added liberal comments
- Removed jq, it is great, but not on a system with a standard installation. The sed solution #workedonmymachine
- Added #shebang

* update .ignore

ignore platform specific files.

* standardize Bash language features

surround variables with {}
pull constants to top of script
notify user script is finished.

* got the inner loop better

* added win10 directory to bindir in powershell, re-added the win10 runtime indentifier in csproj (#55)

* Readme (#52)

* Basic Usage defined in README

- Outline of template installation
- Brief overview of new’upping a project.

* typo found.

* Corrected capitalization of NuGet

* Basic project stub setup for unit tests (#46)

* Added vscode workspace stub to build upon

* Test project setup and intial test to check things work

* #15: Added code coverage support

* #15: Encapsulated overload of Initialize not called outside StreamDeckLib

* #15: Made BaseStreamDeckPlugin abstract to reduce test scenario count

* Update README.md

Updated links on badges

* Updated layout of the badges + click-through

* Added Intellicode Model

* Added tests badge

* Choose default RID based on the build platform (#57)

* Choose default RID based on the build platform

Only applied for "Debug" configuration. Release will/should require the target RID(s) to be specified.

* Update src/SamplePlugin/SamplePlugin.csproj

Only include the `RuntimeSpecifiers` (plural) when building in `Release` configuration.

Co-Authored-By: hugodahl <[email protected]>

* Refactored to an Proxy interface to address #47 (#58)

* Add license file for the project (#60)

* Add license file (MIT)

The license is referenced in the .nuspec file for the template, but did not exist in the repository.

The source of the text is https://opensource.org/licenses/MIT, for which I've set the year of copyright only (not the holder).

* Change the name of the copyright holder to Jeff for now

* Add information and pre-requisite info (Issue #62) (#63)

* Add some information about pre-requisites for the template

* Fix details and grammar

* Added remaining Events Sent to ConfigurationManager (#64)

* Refactored to an Proxy interface to address #47

* Added remaining EventsSent to ConfigurationManager

* OS X Workflow Updates (#59)

* updating editor config to use lf end of line for bash scripts

* updated Register Plugin bash script to correctly deploy plugin

* corrected the CodePathMac setting in the manifest.json to point at the executable

* adding a pre run validation of the jq dependency

* removed the use of jq using sed instead

* Update LICENSE (#65)

Update the contents and layout of the [`LICENSE`](https://github.com/FritzAndFriends/StreamDeckEmulator/blob/master/LICENSE) file from the [FritzAndFriends/StreamDeckEmulator](https://github.com/FritzAndFriends/StreamDeckEmulator/) repository for readability and consistency.

* Documentation/update template packaging contents (#66)

* Update URL to repository and repository-based assets

* Start of a 'What next' document after running the template

* Add details about project files.
Specify function for the main code files.
Start image specification details. Plugin icon done.

* Update README with sections outlines for additional icons

* Finish first draft of 'What's next' for template consumer

* Move images to separate image directory

Do for both SamplePlugin and Template to maintain symmetry.

* Update manifest with new path to images

* Minor changes and edits to README
Include a note about cross-platform paths
csharpfritz added a commit that referenced this pull request Jan 29, 2019
* Fixing dev (#43)

* Implemented the rest of the events the StreamDeck App can send our plugin

* Revert "Implement StreamDeck Events Received"

* almost finished with mac script

* finalized mac inner loop

* Added vscode workspace stub to build upon (#41)

* now it will compile (#44)

* started working on fixing the dotnet new experience for mac

* fixed compilation

* added debug capability, not quite there yet

* register plugin tidy up

- Added liberal comments
- Removed jq, it is great, but not on a system with a standard installation. The sed solution #workedonmymachine
- Added #shebang

* update .ignore

ignore platform specific files.

* standardize Bash language features

surround variables with {}
pull constants to top of script
notify user script is finished.

* got the inner loop better

* added win10 directory to bindir in powershell, re-added the win10 runtime indentifier in csproj (#55)

* Readme (#52)

* Basic Usage defined in README

- Outline of template installation
- Brief overview of new’upping a project.

* typo found.

* Corrected capitalization of NuGet

* Basic project stub setup for unit tests (#46)

* Added vscode workspace stub to build upon

* Test project setup and intial test to check things work

* #15: Added code coverage support

* #15: Encapsulated overload of Initialize not called outside StreamDeckLib

* #15: Made BaseStreamDeckPlugin abstract to reduce test scenario count

* Update README.md

Updated links on badges

* Updated layout of the badges + click-through

* Added Intellicode Model

* Added tests badge

* Choose default RID based on the build platform (#57)

* Choose default RID based on the build platform

Only applied for "Debug" configuration. Release will/should require the target RID(s) to be specified.

* Update src/SamplePlugin/SamplePlugin.csproj

Only include the `RuntimeSpecifiers` (plural) when building in `Release` configuration.

Co-Authored-By: hugodahl <[email protected]>

* Refactored to an Proxy interface to address #47 (#58)

* Add license file for the project (#60)

* Add license file (MIT)

The license is referenced in the .nuspec file for the template, but did not exist in the repository.

The source of the text is https://opensource.org/licenses/MIT, for which I've set the year of copyright only (not the holder).

* Change the name of the copyright holder to Jeff for now

* Add information and pre-requisite info (Issue #62) (#63)

* Add some information about pre-requisites for the template

* Fix details and grammar

* Added remaining Events Sent to ConfigurationManager (#64)

* Refactored to an Proxy interface to address #47

* Added remaining EventsSent to ConfigurationManager

* OS X Workflow Updates (#59)

* updating editor config to use lf end of line for bash scripts

* updated Register Plugin bash script to correctly deploy plugin

* corrected the CodePathMac setting in the manifest.json to point at the executable

* adding a pre run validation of the jq dependency

* removed the use of jq using sed instead

* Update LICENSE (#65)

Update the contents and layout of the [`LICENSE`](https://github.com/FritzAndFriends/StreamDeckEmulator/blob/master/LICENSE) file from the [FritzAndFriends/StreamDeckEmulator](https://github.com/FritzAndFriends/StreamDeckEmulator/) repository for readability and consistency.

* Documentation/update template packaging contents (#66)

* Update URL to repository and repository-based assets

* Start of a 'What next' document after running the template

* Add details about project files.
Specify function for the main code files.
Start image specification details. Plugin icon done.

* Update README with sections outlines for additional icons

* Finish first draft of 'What's next' for template consumer

* Move images to separate image directory

Do for both SamplePlugin and Template to maintain symmetry.

* Update manifest with new path to images

* Minor changes and edits to README
Include a note about cross-platform paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable mac users in the template
5 participants