For anyone else finding it annoying that .sscript files are compressed and don't work well with version control applications (like Git), you might be manually unzipping your .sscript files and including them in your repositories.
An example of this would be: https://github.com/dominickp/SwitchAWS. You can see I have a Packed and Unpacked directory and if you browse through the commit history in an Unpacked file (https://github.com/dominickp/SwitchAWS/ ... ownload.js) you can see line by line changes, which is nice.
I've made a simple Git pre-commit "hook" which, once set up, will automatically scan through any .sscript files in your repo and unpack them whenever you make a new commit. It's pretty handy and can be found here: https://gist.github.com/dominickp/97496d6cb8921ddc9d4a
Switch scripting .sscript inflating pre-commit hook
Switch scripting .sscript inflating pre-commit hook
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Re: Switch scripting .sscript inflating pre-commit hook
nice. Do you have to add and commit again to get the Unpacked in repository?
Re: Switch scripting .sscript inflating pre-commit hook
Yeah, you do. So you commit once, then immediately do another. Not sure what hook I could use that would prevent needing to do thatdkelly wrote:nice. Do you have to add and commit again to get the Unpacked in repository?

Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Re: Switch scripting .sscript inflating pre-commit hook
A little-known fact is that Switch Scripter can actually work with unpacked sscript files. When you unzip an sscript, you get a folder with, among others, another sscript (of 0 bytes) inside it. If you open this second sscript in Switch Scripter you can edit the script as normal, and when you save it will save the unpacked script, perfect for source control! When you are ready to use or test the script in Switch simply use File - Save as..., which will create a packed sscript. Be careful not to overwrite the 0 byte sscript of course.
The normal way of working with sourcecontrol is to regard the packed sscript as output, and not commit it to the repository. In git you can add it to the .gitignore file.
The normal way of working with sourcecontrol is to regard the packed sscript as output, and not commit it to the repository. In git you can add it to the .gitignore file.
Re: Switch scripting .sscript inflating pre-commit hook
That's really good to know. But the one benefit I've found with adding the packed sscript file to your repo is that you can very easily update the production machine to master. I'll make a few updates on my development machine, merge the branch to master, then walk over to my production server and run a git pull on the repo and I'm done. I can now go into each flow and "reload" the script package and I've just updated each script. Keeping the packed file in the repo also makes it easy for people who might not be familiar with SwitchScripter to use your code.bens wrote:A little-known fact is that Switch Scripter can actually work with unpacked sscript files. When you unzip an sscript, you get a folder with, among others, another sscript (of 0 bytes) inside it. If you open this second sscript in Switch Scripter you can edit the script as normal, and when you save it will save the unpacked script, perfect for source control! When you are ready to use or test the script in Switch simply use File - Save as..., which will create a packed sscript. Be careful not to overwrite the 0 byte sscript of course.
The normal way of working with sourcecontrol is to regard the packed sscript as output, and not commit it to the repository. In git you can add it to the .gitignore file.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Re: Switch scripting .sscript inflating pre-commit hook
Updated this so it now goes into subdirectories of a project: https://gist.github.com/dominickp/97496d6cb8921ddc9d4a
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Re: Switch scripting .sscript inflating pre-commit hook
If you have trouble getting the hook to execute, try running this command from the repository directory:
Code: Select all
chmod +x .git/hooks/pre-commit
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Re: Switch scripting .sscript inflating pre-commit hook
this is by the way amazing! Thank you for doing this!
Re: Switch scripting .sscript inflating pre-commit hook
for the record: this stopped working in Switch 13 update 1, the unpacked scripts are now unreadable
Re: Switch scripting .sscript inflating pre-commit hook
Yeah. It's a huge annoyance. I've been copying a pasting my source code out into other files with every script revision because of it.tz8 wrote:for the record: this stopped working in Switch 13 update 1, the unpacked scripts are now unreadable
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Re: Switch scripting .sscript inflating pre-commit hook
Solution according to Enfocus is to keep developing in an old SwitchScripter 13 version. They implemented the encryption because of the introduction of the appstore.
I disagree to that solution. Your hacky solution is working but it just stays... hacky. Adding another step to the hackiness of the solution to get Switch scripts into GIT is just messy. Enfocus should implement one of the below:
- 'save as... encrypted script package'
- 'save as... raw code package'
- a flag in the preferences to also save as raw code in a directory next to the script
And i personally prefer Option 3, in our GIT solution we could then just ignore the .sscript and .sficture files and voilà we'd all be happy...
I disagree to that solution. Your hacky solution is working but it just stays... hacky. Adding another step to the hackiness of the solution to get Switch scripts into GIT is just messy. Enfocus should implement one of the below:
- 'save as... encrypted script package'
- 'save as... raw code package'
- a flag in the preferences to also save as raw code in a directory next to the script
And i personally prefer Option 3, in our GIT solution we could then just ignore the .sscript and .sficture files and voilà we'd all be happy...