Hey guys,
I've been tinkering with MivaScript quite a bit lately. And I thought I'd share some things that I've been doing to increase productivity. If you want, add your own, or feel free to improve/critique.
I'll kick it off with Git:
I use Git all the time. We all know that Miva Merchant has a built in revision control system, however that doesn't extend to MivaScript. For me, Git takes care of documenting what I've done, along with allowing for me save at specific points along the process.
If you haven't used it, it's simple. You can check out a site like bitbucket.org, where you can have as many private Git repositories as possible.
Once you get a repo set up, to get BASIC functionality up in running a couple of minutes it's a simple process.
1 - Save your files
2 - "Add" them to the staging area:
3 - "Commit" the changes:
4 - "Push" the change to the repo.
Pretty simple stuff. That tracks the changes that you've done, at the time you did them, and gives you a point to revert back to.
If you want to get enhance your "Git environment" you can use the .gitignore file and configure that. For me, I don't want my MVC files to be uploaded. So my .gitignore file looks like:
That way, when I:
It won't upload my compiled files to the repository, which is nice because they don't need to be there, and it just takes up time.
You can also set up a global .gitignore file, so you don't have to add it to every repo that you create:
So, in addition to that, I also use the cURL library to help keep things running smooth.
I wrote a couple scripts that I use to help keep things smooth for me.
If any of you guys are unfamiliar with cURL, it's basically a URL framework written in C. It uses lots of different TCP/IP protocols, SMTP, FTP and more. In this instance, I use it for the FTP functionality.
So, for my FTP functionality, I take advantage of the Git directory structure, which ignores the .git directory it creates after a
So, here are my two files:
upload.sh
ftp.dat
ftp.dat goes in the .git directory of the repo you are working with.
upload.sh goes anywhere in your $PATH variable.
I just threw mine in my /MSC/BIN/ directory. That way I knew it would work.
So, since I'm literally the only person who uses my computer, and since all of the password files are stored locally, I don't really see a security risk. However, if you want to get really clever, you can do a few other things..
For example, if you're using FileZilla, and you're using the Site Manager, you can query the XML file (for Windows, C:\Users\USERNAME\AppData\Roaming\FileZilla\sitema nager.xml) that contains all of the username and password information, to get the proper credentials, without retyping them, or having to change files when a specific FTP account password gets changed. From there, you can query the servers, and pull out the pertinent data. Haven't gotten that working yet, but if you have, post them up.
So, my typical workflow goes something to the tune of:
1 - code, code, code..
2 - mvc file.mv
3 - upload.sh file.mvc
4 - Do I like the results?
5 - If yes:
5a - git add .
5b - git commit -m "Added new functionality to file.mvc"
5c - git push
6 - rinse and repeat
So, some obvious areas of improvement are:
A) a more dynamic upload.sh script
B) query the sitemanager.xml file, and create a "setup" script to generate / regenerate username:password
C) Look at creating a "compile_upload" script to combine steps 1 & 2 in the process
D) Get Git integrated with Vim
What are your tips?
I've been tinkering with MivaScript quite a bit lately. And I thought I'd share some things that I've been doing to increase productivity. If you want, add your own, or feel free to improve/critique.
I'll kick it off with Git:
I use Git all the time. We all know that Miva Merchant has a built in revision control system, however that doesn't extend to MivaScript. For me, Git takes care of documenting what I've done, along with allowing for me save at specific points along the process.
If you haven't used it, it's simple. You can check out a site like bitbucket.org, where you can have as many private Git repositories as possible.
Once you get a repo set up, to get BASIC functionality up in running a couple of minutes it's a simple process.
1 - Save your files
2 - "Add" them to the staging area:
Code:
git add .
Code:
git commit -m "Added getRSAFromAttr() function"
Code:
git push
If you want to get enhance your "Git environment" you can use the .gitignore file and configure that. For me, I don't want my MVC files to be uploaded. So my .gitignore file looks like:
Code:
*.mvc
Code:
git add .
You can also set up a global .gitignore file, so you don't have to add it to every repo that you create:
Code:
touch ~/.gitignore_global echo "# Global Git Ignore File" >> ~/.gitignore_global echo "*.mvc" >> ~/.gitignore_global echo "*.so" >> ~/.gitignore_global echo "*.tar" >> ~/.gitignore_global # and so on for whatever you don't want to include.. echo "temp_*.*" >> ~/.gitignore_global #For any files I just want to temporarily create, dummy data files, etc. git config --global core.excludesfile ~/.gitignore_global
I wrote a couple scripts that I use to help keep things smooth for me.
If any of you guys are unfamiliar with cURL, it's basically a URL framework written in C. It uses lots of different TCP/IP protocols, SMTP, FTP and more. In this instance, I use it for the FTP functionality.
So, for my FTP functionality, I take advantage of the Git directory structure, which ignores the .git directory it creates after a
Code:
git init
upload.sh
Code:
#!/bin/bash # Add ftp data from .git folder of current working directory . .git/ftp/dat curl -T $1 ftp://$OPT_1/ --user $OPT_2:$OPT_3
Code:
# This is the username and password for the FTP of this particular site. # For OPT_1, remember, we DON'T include the trailing slash!!!! # OPT_1 is the location on the server that we're going to be uploading to # OPT_2 is the username for the FTP access # OPT_3 is the password for the FTP access DOMAIN='ftp.example.com' #OPT_1 uses the mm5/5.00/modules/component as an example, use whatever directory you want to upload to OPT_1="$DOMAIN/httpdocs/mm5/5.00/modules/component" OPT_2='USERNAME' OPT_3='PASSWORD'
upload.sh goes anywhere in your $PATH variable.
I just threw mine in my /MSC/BIN/ directory. That way I knew it would work.
So, since I'm literally the only person who uses my computer, and since all of the password files are stored locally, I don't really see a security risk. However, if you want to get really clever, you can do a few other things..
For example, if you're using FileZilla, and you're using the Site Manager, you can query the XML file (for Windows, C:\Users\USERNAME\AppData\Roaming\FileZilla\sitema nager.xml) that contains all of the username and password information, to get the proper credentials, without retyping them, or having to change files when a specific FTP account password gets changed. From there, you can query the servers, and pull out the pertinent data. Haven't gotten that working yet, but if you have, post them up.
So, my typical workflow goes something to the tune of:
1 - code, code, code..
2 - mvc file.mv
3 - upload.sh file.mvc
4 - Do I like the results?
5 - If yes:
5a - git add .
5b - git commit -m "Added new functionality to file.mvc"
5c - git push
6 - rinse and repeat
So, some obvious areas of improvement are:
A) a more dynamic upload.sh script
B) query the sitemanager.xml file, and create a "setup" script to generate / regenerate username:password
C) Look at creating a "compile_upload" script to combine steps 1 & 2 in the process
D) Get Git integrated with Vim
What are your tips?
Comment