Duplicate assets after deployment of app in Heroku - ruby-on-rails-3

I'm very new with rails development and deployment using Heroku.
So recently I found that some JavaScript files that seems to be duplicated. For example I made a javascript function in one file (sample.js), then I erased this file, and I put the function inside of application.js.
Under my test development, it works perfect. But then when I commit the changes to heroku, I end up having the same function twice!
The javascript files are under the folder /app/assets/javascripts/
So how can I tell heroku to remove the duplicate files?
Am I missing some step before sending new version of my app to heroku?
Any help will be greatly appreciated
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
Rails 3.1.0

You're only deleting files from the repo when you use the git rm command. Even if you delete the actual file, it's still in the repo, and won't be changed by the git add -f * command (which only adds changed files).
You should be able to remove the file from heroku by running these commands:
$ git rm app/assets/javascripts/sample.js
$ git commit -m 'your commit message'
$ git push heroku master

Related

Incorrect path for Pods-testAppTests/Pods-testAppTests.debug.xcconfig: unable to open file

So I recently uploaded my react-native project on GitHub, then cloned it back to see how it will build(did it for first time... yeah). And on react-native run-ios I got a repetitive error: "react-native-app/ios/Pods/Target Support Files/Pods-testAppTests/Pods-testAppTests.debug.xcconfig: unable to open file (in target "testAppTests" in project "testApp") (in target 'testAppTests' from project 'testApp')
I found a solution, where this:
cd ios
pod deintegrate
pod install
helped me as the project then built and ran correctly.
So my question is, how to upload it to GitHub in a way so it builds always correctly after cloning it?
Update
Checking and editing .gitignore solved this problem.
Maybe this is linked to files which have been added/committed, while they should have been ignored, private and local only (not uploaded to GitHub)
Check your .gitignore: here is one for ReactNative, as explained in "Creating a .gitignore for a Clean React Repository", blog post written by Parker Johansen.
Then, assuming you don't have any pending changes/work in progress, you can, as explained here, apply your new .gitignore to your existing repository:
cd /path/to/local/cloned/repo
# create your .gitignore
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
git push
Finally, clone it again, and see if it compiles better.
The OP adds in the comments:
I found that folder 'Pods' doesn't exist on GitHub, that's why this error occurs, how can I add it to my /ios folder on Github correctly
I advise to check if there is a .gitignore rule which would ignore said folder:
git check-ignore -v Pods/aFile_inside_Pods

The --deployment flag requires a Gemfile.lock

I have spent couple of hours but unable to solve this problem.
When I try to deploy my local rails app to production server using capistrano I get the below error:
The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying.
Any idea on how to solve this?
My rails application folder is under version control using Git. I have pushed the local git repo to github and the Gemfile.lock is there on github. So it is under version control. However capistrano continues to give the same error.
Deploy.rb file: https://gist.github.com/brahmadpk/4748991
Remove BUNDLE_FROZEN: "true" from .bundle/config file and run bundle again.
Make sure there is nothing in the releases folder that is not a release. See this comment on a bundler issue for more details.
This blogpost titled Capistrano Deployment Trouble explains the same issue.
EDIT TO INCLUDE CONCLUSION FROM DISCUSSION IN COMMENTS
The deploy_to param was not set to an absolute path; hence capistrano wasn't able to find the folder to deploy, causing this error message.
I solve this with:
set :bundle_gemfile, "your_app_name/Gemfile"
in the deploy.rb
Run bundle and add your Gemfile.lock to your version control.
I had the same problem, even though I had no files or folders in the releases folder. Turned out it was a silly little thing: the gemfile.lock file in my repo was in lowercase for some reason, while capistrano needs Gemfile.lock with a capital G.
This is how I solved it:
Delete gemfile.lock
Delete gemfile.lock from you repo (git rm ...)
run bundle install
add the new Gemfile.lock file to your repo: git add Gemfile.lock
remove the folders from the server (don't know if this is really needed, did it anyway)
deploy
After adding bundle config unset deployment this line in the terminal, bundle install started working again for me.
I am getting exactly the same problem.
There is nothing in my releases folder (at all - my deploy cold keeps rolling back).
My gemfile.lock is checked in to Subversion.
I get:
** [out :: localhost] The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying.
Is there any way to stop the rollback so that I can see what the releases folder looks like at the time it tries to run
cd /var/qlarity/releases/20130222003607 && bundle install --gemfile /var/qlarity/releases/20130222003607/Gemfile --path /var/qlarity/shared/bundle --deployment --quiet --without development test
Later....
I found that I could prevent the rollback by commenting out the code as shown from
gems\capistrano-2.14.1\lib\capistrano\recipes\deploy.rb
task :update_code, :except => { :no_release => true } do
# on_rollback { run "rm -rf #{release_path}; true" }
strategy.deploy!
finalize_update
end
This enabled me to examine my releases folder and sure enough, there was no Gemfile.lock in it. Turns out I have ended up with an unnecessary folder in my Rails project file structure so that instead of
myapp/trunk/app
myapp/trunk/config
...
myapp/trunk/Gemfile
I had
myapp/trunk/myapp/app
myapp/trunk/myapp/config
...
myapp/trunk/myapp/Gemfile
This meant I ended up with a folder containing my Gemfile
releases/nnnn/myapp
and bundle was looking for Gemfile in
releases/nnnn
When I changed my Capistrano config from
deploy.rb
set :repository, "file:///D:/_SVN//myapp/trunk"
to
deploy.rb
set :repository, "file:///D:/_SVN//myapp/trunk/myapp"
now all is good. Really should look at fixing the folder structure next!

Restart Git repo Xcode 4.3.2

For different changes I made in my project, I need to restart Git repo and start with a new fresh version with the current project. How can I achieve this?
Many thanks
fire up your terminal:
go to project
cd myPath/MyProject
delete the current repo on your disk - your git repo = RIP
rm -Rf .git
init a new repo
git init
add your project to the new git repo
git add .
commit
git commit -a -m "init Project XY"
check if the repo is o.k
git status
What you want to do is create a new empty branch without any history. That way you start fresh but still have the option to return to your previous content. Inside the git repository, enter these commands:
git symbolic-ref HEAD refs/heads/<branchname>
rm .git/index
git clean -fdx
After that you are in the same situation as with an empty repository (i.e. start adding and commiting files) except that the history still exists in your old branches.
Note that all files you don't have in your old version will be permanently removed.

Shell Script Invocation Error

I am using open ssl in my project. I was running this project successfully in xcode 4.0.2. Recently I updated to XCode 4.2. But its showing build errors. here is the error log
Make[1]:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2: No
such file or directory
Could someone help please?
Thanks
Zach,
Are you using the openssl-xcode project that we (Zetetic) published for use with SQLCipher? If so, you should be able to solve this problem by updating to the latest versions of openssl-xcode and sqlcipher from Github. If you used git to clone them, this should update them without a problem:
$ cd your_project/openssl-xcode
$ git pull origin master
$ cd your_project/sqlcipher
$ git pull origin master
The build scripts were updated for use with Xcode 4.2 and LLVM, should work without a hitch. We've updated the tutorial for Xcode 4.2 as well.

getting started (not) with Heroku: App not found

This should be simple, and I swear it was working an hour ago. I can log in to Heroku, but can't run any useful commands:
$ heroku login
Enter your Heroku credentials.
Email: xxx#whatever.com
Password:
$ heroku stack
App not found
$ heroku config
App not found
Perhaps this is the source of the problem?
$ git remote show heroku
! No such app as empty-samurai-345
fatal: The remote end hung up unexpectedly
empty-samuri-345 was an app I deleted earlier. All I really want to do is upload a new app using the bamboo-mri-1.9.2 stack.
Thanks in advance for suggestions...
You need to remove the heroku remote in git using this command:
git remote rm heroku
Then you can add a new remote using this one:
git remote add heroku git#heroku.com:your-app.git
Then try running your heroku commands.
Run the following
git config -l
The config key is easy to spot, remote.heroku.url.
Now if your comfortable editing the config directly, just:
git config -e
If not:
# Confirm you've got the right key
git config remote.heroku.url
# Substitute your_app_name appropriately
git config remote.heroku.url git#heroku.com:your_app_name.git
My answer is based off fearless_fool's comment, which lacks much detail.
FYI: The config file is located in /your_git_repo/.git/config
I just ran into this same problem by renaming my app from heroku online dashboard.
Then I tried running some command in cli from my local machine and it gave 'App not found'. I guess Cli doesn't know the change that I renamed my app.
So I again logged into heroku website and renamed the app with old name.
Then All commands worked from cli.
So Don't use online dashboard to rename your app, use CLI.
I hope it helps someone..!!