Rubyonrails cloud9 to bitbucket to heroku update - ruby-on-rails

How do I edit my web page using cloud9 bitbucket after it is launched on heroku?
I have already saved changes on cloud9 and posted a git commit and am in bitbucket.
Do i create a new repository? or how to add to the existing one?
Could someone explain each step?

Assuming you have a bitbucket repository set up and reflecting your production code, you should generally be doing the following:
git checkout -b new-feature # create repository branch `new-feature` to do more work
... make a bunch of changes and test them ...
git add -A # add all of your changed files
git commit -am "Meaningful comment" # comment which goes with your commit describing what you did
git checkout master # get back to master
git merge new-feature # ... and merge your changes into it
git push # push all of your changes to bitbucket
git push heroku # deploy to production with Heroku
Hopefully, many of these commands are familiar already... otherwise, take a look at the docs to make sure you understand first.
Hope this helps.

Related

how to upload project folder on github branch

Well I'm working on rails project. Well I want o upload updated version of whole application on github branch name "dev_Bee". So can you tell me the step wise procedure how to upload my application on a specific branch. Well I'm working on ubuntu so please try to give commands for ubuntu.
Since you are using rails I'll assume your project has already git initiated.
First, you need to stage all the changes and commit
git add .
git commit -m 'Your Commit Message Here'
Then checkout to a new branch of your desired name
git checkout -b dev_Bee
Set your remote repository
git remote set-url origin https://github.com/<gitusernamehere>/<git-repo-name-here>.git
And finally push the changes to remote
git push -u origin dev_Bee

How to set up heroku for a non-master branch as test and then merge it into master?

Why
I'm fairly new to rails and this particular project is the first where I'm working collaboratively on a rails app.
Therefore I wanted to test-deploy the existing app on heroku and when it's working merge into master. This is because I don't want to mess with master until I know what I'm doing (read: heroku works).
The problems I can foresee
Heroku is fairly attached to work with master only, unless specified. This SO question documents how to deploy a non-master branch but does not go into detail what happens when this branch is then merged into master.
Does it mess up the configuration or will it work just fine and accept master as the new deployed branch? If not, what do I have to change once I merge into master?
The process should be:
Create a new branch:
git branch test
git checkout test
Make changes, commit
git commit -a -m 'added a new test feature'
Push test branch to heroku
git push heroku-dev test:master
If everything works, merge the test branch
git checkout master
git merge test
Push master
git push heroku-dev master
I do this all the time and nothing wrong happens.

How to auto-upgrade a gem in travis?

I help to maintain an open source project, Hyrax, which is a rails engine. In order to do QA on new development, we maintain an application that is specifically for QA, Nurax, which should always be updated with the latest master of the rails engine. I have specified the master branch of Hyrax in the Gemfile for Nurax, and if I run bundle update hyrax it will indeed get the latest master version and update the Gemfile.lock accordingly. I can also get Nurax to deploy automatically via Travis. However, that auto-deploy does not automatically update to the latest master of Hyrax before deploying, which is what I really want to happen.
What is the best way to set this up? Should I have travis run a bundle update hyrax and commit that change to Nurax master as part of its build? I've found a few topics about committing from a travis build (e.g., this one). Would it be better to make a new Nurax branch for each PR and deploy that branch? Is there an established pattern for this that I could be following?
Any advice greatly appreciated.
I ended up solving this with a cron job. I checked out a local copy of the code on the server in question, in the home directory of my ubuntu user. I then added the ubuntu user's ssh key to my own github account, and to the account used for capistrano deploy. Then, I set this up to run daily:
#!/usr/local/bin/ruby
# Get the latest nurax master
# Make a branch with today's date and update hyrax
# Push and deploy that branch
today = Time.now.strftime('%Y-%m-%e-%H-%M')
`cd /home/ubuntu/nurax; git checkout master; git pull; git checkout -b "#{today}"`
`cd /home/ubuntu/nurax; bundle update hyrax`
`cd /home/ubuntu/nurax; git commit -a -m 'Daily update for "#{today}"'; git push --set-upstream origin #{today}`
`cd /home/ubuntu/nurax; BRANCH_NAME="#{today}" cap nurax-dev deploy`
`cd /home/ubuntu/nurax; git checkout master; git branch -d "#{today}"; git push origin --delete "#{today}"`

how do I continue my app after deploy

So I have deployed my rails app on a VPS with Ubuntu Server and Apache,
following this tutorial . Everything is working perfectly except that I'm not sure on how to continue to develop my app, bitbucket is configured and working but I don't want to commit and push every time since I make a lot of try and errors. So I'm looking for an easy way to continue to develop and test.
I will appreciate any answers and recommendations , thank you.
You can keep building your into local machine.
Create a branch git checkout -b branch_name
You can make changes and test this branch.
git add -A
git commit -m "Suitable message"
git checkout master
git pull origin master
git merge branch_name
git push origin master
P.S : You can continue your development in master branch too.

Why can't I see my remote git repositery?

Here is what I did:
Created a Ruby on Rails app.
Initialized empty git rep
Made changes to my app and saved them (git add -A and git commit -m "blahblah")
Deployed to Heroku.
But when I visit git hub it shows zero repos?
What did I do wrong?
I think you confound github and heroku.
It's two differents repository.
Deploying to heroku with something like this:
git push heroku master
does not affect your github account.
You can have several repository for the same project.
To add a repository:
git remote add NAME_OF_YOUR_REPO URL_OF_YOUR_REPO
(you can create a project in github, and they will git you a URL_OF_YOUR_REPO)
example:
git remote add origin https://github.com/user/repo.git
after you can do:
git push origin master
and you will see your commits on github.

Resources