Facebooker-rails3 installation problem? - ruby-on-rails

I am trying to install facebooker-rails3 plugin like this
rails plugin install git://github.com/kulbirsaini/facebooker-rails3.git
it does install in it vendor directory but it doesnt create facebooker.yml
should it create it all?
if not thn where should i configure facebook settings?
Thanks

The plugin adds some useful tasks to rake.
you should run the rake task command on the console on the rails project directory:
rake facebooker:setup
After that the facebooker.yml is created and is pretty straight forward to complete.
Hope you find it useful.
Greetings!

Related

Spree -4.4 - Fresh install gives sprocket error re: spree-dashboard.js

Im facing missing 'spree-dashboard.js' file not found on fresh spree 4.4. Its not fixed by runing yarn install.
running the following command worked for me
yarn build
If you are setting up spree without docker then you need to compile assets
running rails assets:precompile will resolve the issue
Check if you have one at app/javascript and copy it to app/assets/javascripts and see if it resolves.
I found the file and just dropped it in one of the paths it was looking into.
Install gem 'turbo-rails' instead of turbolinks
For Further Help Follow the link: How To Migrating From Turbolinks To Turbo
https://www.honeybadger.io/blog/hb-turbolinks-to-turbo/
I faced the same issue and found the solution.
The Spree documentation guides us to install esbuild.
But the documentation never explains how to actually use esbuild to build our JS.
You normally have jsbundling-rails added in your Gemfile.lock. You can find more info about that gem here: https://github.com/rails/jsbundling-rails
To start a new Spree project, it is best to generate the rails project using esbuild, thanks to this command:
rails new myapp -j esbuild
That way the app will already be using esbuild which is the tech used by spree.
Otherwise, you would have to migrate from webpacker to esbuild. I found a nice tuto here: https://dev.to/thomasvanholder/how-to-migrate-from-webpacker-to-jsbundling-rails-esbuild-5f2
And finally, to build JS with esbuild, you can add this line to your "scripts" in package.json:
"build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds"
It is normally printed in the terminal when you install esbuild, but you may easily miss it.
And when you run yarn build this command will generate the proper spree-dashboard.js file within app/assets/builds.
Also, the esbuild install command adds a line in Procfile.dev with a "watch" option. You'll eventually want to start the project using ./bin/dev which starts a Foreman process that handles what's in Procfile.dev.
Finally, as a bonus, I also followed this nice tutorial: https://noelrappin.com/blog/2021/12/typescript-and-jsbundling-and-rails-7/
Which helps you set up esbuild + jsbundling-rails + typescript. If you like typescript, this is an easy way to use it with esbuild in a Rails project.
I faced the same issue, webpack was looking for "#spree/dashboard".
The installation of that package solved the issue
yarn add #spree/dashboard

How to execute "bin/setup" in rails on Windows?

As far as I know bin/setup is for easy set up for every project in rails e.g installing required gems, preparing database etc. But how to do this in Windows environment?
You'll need ruby installed first.
Open a command prompt in the relevant folder and run:
ruby bin/setup

How to have Rails migrations run automatically on Heroku

I have more than 10 different Ruby on Rails apps where I have to deploy the same code. I have connected the git repo to my Heroku apps, so whenever I push new changes it deploys on all of them.
The issue is with the database migration step. I want to run migrations automatically after each deployment. None of custom build pack is working. Can someone please help me? I am using rails 4 and spree.
So far, I have tried:
https://github.com/heroku/heroku-buildpack-ruby.git
https://github.com/gunpowderlabs/buildpack-ruby-db-migrate.git
This solution is not working.
Is there any other solution to run Rails migrations on Heroku automatically?
No need to use gems or write scripts.
Heroku have a 'release' phase features (https://devcenter.heroku.com/articles/release-phase).
Thank to this, you just have to add to your Procfile some code to automatically run rake db:migrate to all your push :
Procfile (root app)
release: rake db:migrate
You can use Travis-ci. Pretty simple to setup and provides the desired functionality
Add gem 'iconv', '~> 1.0.3' to your gemfile and then try it will work as worked for me!
I take this as a duplicate of this answer
If you are looking for alternative then you can write a deploy script in .sh file and run it everytime like bash script.

Files added to my Ruby Project when using RBENV

After installing RBEnv and rebuilding my ROR project, I now seem to have added many, many files to my project. They are in /vendor/local, and appear to duplicate what you would normally find in /Library/Ruby/Gems.
My project will not run without these files present (I get the message Could not find rake-0.9.2.2 in any of the sources.
I had difficulties with my RBEnv installation. I have what I suspect are other issues (like I have to bundle exec rails instead of just running rails). I suspect that I have done something wrong and should not have these files in my project. What I'd like to know is:
1) Should these files be there?
2) How best to fix this (if this is not how it is supposed to work)?
3) If the best approach is to start over and reinstall rbenv, how do I clear it all out?
It is true that using RBENV will end up putting copies of your gems in the project's /vendor/local folder. This is to remove any dependencies on your base gem set. These files need not be part of your source repository, as long as your 'gemfile' and your '.rbenv-version' file are included in the repository.
Another price you pay for using rbenv is that you must bundle exec rails <command> and bundle exec rake <command> from here on in.

When I download a Rails open source project, how can I know which version of Rails or gems is needed?

When I download an open source Rails project, how can I know which version of Rails or gems is needed?
For example, I want to build a blog. Then I do this:
~$ git clone git://github.com/mojombo/jekyll.git
That is a free open blog project. When the clone is 100% done.
~$ cd jekyll
~$ rake db:create
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'db:create'
So what's wrong in my Rails or Gem or any other? Is there a problem of version?
Jekyll is not a Rails project. There is no db:create Rake task.
I'd suggest taking a look # the documentation to figure out how to use it.
Jekyll is not a rails app, however...
I would always start with the project's Gemfile (if they are using bundler), if the developer has specified versions for the gems, this should give you a good look at the specific version requirements.
As Brian and Nate have said, read the documentation about it.
I personally have a Jekyll-powered site that you could use as an example if you're stuck. The documentation contains pretty good examples as well.
But to get you started: Jekyll doesn't really have any database backing to it. You must create the directory structure--as outlined in the Usage guide--yourself.
For generating new posts, I have a script called new.rb in my repository. Simply because I can't be bothered remembering what the Wordpress ID was for the previous post (I imported from Wordpress).
Once you've got a post written, install the jekyll gem:
gem install jekyll
Then run jekyll --server. This will parse the post into beautiful HTML which you can view at http://localhost:4000. Once you're satisfied with it, put it online somewhere with Apache or Nginx serving it as it would any other static HTML site.
Finally, if you're ever looking for an alternative, I've heard good things about nanoc.

Resources