Morning guys,
I am writing a small Ruby CLI app for myself, and I have run into a small issue that I hope you guys can help with. Apologies if this is a stupid question, I am very new to Ruby.
I am using https://github.com/davetron5000/gli as a foundation to build my my app since they make it easy to have all my commands and whatnot.
Question is, while I develop the app, I can run it using bundle exec bin/konstruct, but that only works from the folder where the code lies.
I want to run the app from a test folder so I can see whether the code I'm adding is doing what it should (make files, remove files, see if directory is empty, etc).
When I played around with NodeJS, I could link the app, and it would work anywhere. Is there something like that for Ruby apps that are still in development?
Two simple way:
1. Make bin/konstruct executable. So you can run it without bundle exec. Then link it in any directory in your $PATH with ln -s. (For Unix based systems)
2. Create a alias in your shell. something like this:
alias konstruct="bundle exec /FULL/PATH/TO/bin/konstruct"
(Also for Unix based systems)
Related
I am really not sure what I am doing. I have no idea what is coding , and I never used the terminal on my Mac. I am trying to set up a Course Builder on Google App Engine, and the instructions are telling to to follow these steps:
Deploy from Mac and Linux:
Open a command prompt and get to your coursebuilder directory. Type the following command:
bash ./scripts/deploy.sh <your_project_id>
If your deployment was successful, you can visit your new site.
That is what I am getting:
elena$ bash ./scripts/deploy.sh on-point-learning
bash: ./scripts/deploy.sh: No such file or directory
I am completely lost, is there anyone who can help me? And please in English, I speak no Computer, even using the Terminal makes my hands sweaty and my heartbeat unstable.
p.s.: I do apologize and maybe this questions was answered before but I understand nothing in the questions/answers I read.
First, you need to have downloaded and installed the Google App Engine SDK. Follow all the steps documented by Google here. You need to follow all the steps so that all the files are installed/copied and the necessary shortcuts created
Your course builder will be in a folder (directory)
a) Open command line and change directory to your project folder i.e. something like cd <path_to_project_folder>
b) Type gcloud app deploy
Note: Google's documentation says - Use the install script to add Cloud SDK tools to your PATH. You need to make sure you do that so that typing commands in your command line will work
If you do not want to tinker with your command line or you want to make things very very simple, then you can try using a GUI, for example our App, NoCommandLine
a) Select File > Add Existing Application
b) Navigate to your Course Builder Folder and select the file named app.yaml
c) Select your programming language and the framework (if neccessary), click on Add.
d) To run your project (on your local machine) or deploy it to Production, you just select it from the UI, and click the run or deploy icon.
I've been playing around with Ruby for a while now and wanted to write my own gem. I wanted to write something simple but useful. My idea was to create a simple console gem that would alert a user when a new post was created in a certain subreddit. Right now it's hardcoded to one subreddit, and I'm using Mac's say command to notify me when there's a new post. My first question is, is this even gem-worthy? I could turn this into a simple Rails app, which might make things logistically easier. But I really wanna write up a gem.
If I do decide to carry on with the project as a gem, there are a few obstacles I have to get past. Right now I'm using whenever to run that runs my script every minute. To update your cron jobs, you have to run whenever --update-crontab in the directory of the project in order to set the cron job. This has become an issue for me, because I would like to be able to make the gem usable on installation without having a user do anything. So instead of having to run the command above, I'd like a user to just be able to download the gem and then, eventually, choose what subreddits and the frequency of the cron job (via a console menu).
Sorry for the length of the post, just looking for some input.
My first question is, is this even gem-worthy?
Yes.
I would like to be able to make the gem usable on installation without having a user do anything.
Use a ./bin directory that contains an executable script, that uses a sleep method.
My advice is don't alter the user's cron. Instead, include README help that explains how to cronify your bin executable.
I'm running a Ruby file on Windows 8.
My computer doesn't know which program to run my Ruby file with. I have Ruby installed, but it won't let me open it without an IDE. My team members run it regularly from the command prompt and don't want us using IDEs.
Any thoughts on how to get it to run? Or should I ask my team members?
Ruby files aren't really "opened" as much as executed. Basically, the workflow is not to double click on a .rb file but rather to run it in the command line. Let's say you have a file called
hello.rb
To run this file you'd do:
$ ruby hello.rb
Now, as far as being sure you have ruby installed. Make sure that when you type
$ ruby --version
You get back a version number. Otherwise, it may not be installed. If that's the case, take a look here: http://rubyinstaller.org/
Also, if you want to edit a ruby file I'd recommend you use a text editor. On windows even notepad will do. Just right click on the file and select "Open with notepad" (I think). I've heard good things about http://notepad-plus-plus.org/
Please note, I haven't used Windows in years so I may be a tad off on some points.
I'm having a problem getting started with compass/sass. I eventually managed to install compass, although I had to google around because the instructions on the compass website didn't work for me.
Next step was to create a project. I thought this would be simple enough by typing:
$ compass create path/to/project --using blueprint/basic --sass-dir=sass --css-dir=css
Unfortunately, this didn't work. The first thing to fail was that it told me that --using was not a recognised command (even though that is exactly what it tells you to type in the compass installation instructions). So, I tried creating the project taking away all three of the additional options.
This did create a project, although not in the place I specified. Rather than placing it in path/to/project it created the files and directories straight into my home folder ie /Users/me/
I must be doing something wrong, I can't believe that a tool designed to save time and make life easier could be so difficult to get up and running. I'm not great at using the command line, but I am able to follow instructions!
Any pointers would be appreciated!
It sounds like your running compass v0.8, please upgrade to v0.10 and that command will work.
I am thoroughly in love with TextMate. I program everything in it, including ASP.NET for my daily job. However, I have a license for Espresso, and I was looking at it recently and discovered that there is a "Publish" section that I knew about before, but I didn't know that it could compare my FTP directory with my local directory and publish only the changed files.
Over the past week I've been finding myself using Espresso just for that functionality. However, I was hoping there was a way to get this functionality inside TextMate. I know that you could use an AppleScript script with Cyberduck (my FTP client) to upload a file when it changes, but I have never got that working and it also doesn't include the ability to merge files like Espresso does.
Am I plumb out of luck? Am I stuck using two different programs for the forseeable future?
I haven't tried it, but you should be able to set up a simple rsync command in a bundle in TextMate that will use environment variables from your project to synchronise.
See Using rsync to enable the project drawer in TextMate while working on a remote server for an example.