making a installer in rails - ruby-on-rails

I have been working on this, very, small photo cms lately. And now i ready for setting it up to Github. So i will love to have some kind of installer, just as much for leaning it, I'm thinking something like you type a command and then it starts by copy all the files to the rails app, and then asking you for what your flickr_id is etc..
So i have to store all this information and call it down.. i.e if i should show some pictures, i have to use the flickr_id.
Hope you understood my question..

You can start by using rails-app-installer, it's not maintain completly but can works. It's use on the Typo project

Related

/usr/bin/ruby file just contains gibberish and the word 'ELF'; safe to delete this/is this the file I really need?

I'm trying to install the Ruby gem foreverb, to keep my server process running when SSH disconnects, and also for improved understanding of the people visiting my site.
On following this guide:
https://github.com/DAddYE/foreverb
It mentioned to write some code in /usr/bin/ruby so I dutifully opened the file and looked inside. Instead of what I expected (either a blank file or something that looks like Ruby code) I was instead greeted with this:
^?ELF^B^A^A^#^#^#^#^#^#^#^#^#^C^#>^#^A^#^#^#à^H^#^#^#^#^#^##^#^#^#^#^#^#^#^P^Q^#^#^#^#^#^#^#^#^#^##^#8^# ^##^#^[^#^Z^#^F^#^#^#^E^#^#^##^#^#^#^#^#^#^##^#^#^#^#^#^#^##^#^#^#^#^#^#^#ø^A^#^#^#^#^#^#ø^A^#^#^#^#^#^#^H^#^#^#^#^#^#^#^C^#^#^#^D^#^#^#8^B^#^#^#^#^#^#8^B^#^#^#^#^#^#8^B^#^#^#^#^#^#^\^#^#^#^#^#^#^#^\^#^#^#^#^#^#^#^A^#^#^#^#^#^#^#^A^#^#^#^E^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#¼^K^#^#^#^#^#^#¼^K^#^#^#^#^#^#^#^# ^#^#^#^#^#^A^#^#^#^F^#^#^# ^M^#^#^#^#^#^# ^M ^#^#^#^#^# ^M ^#^#^#^#^#p^B^#^#^#^#^#^#x^B^#^#^#^#^#^#^#^# ^#^#^#^#^#^B^#^#^#^F^#^#^#¸^M^#^#^#^#^#^#¸^M ^#^#^#^#^#¸^M ^#^#^#^#^#Ð^A^#^#^#^#^#^#Ð^A^#^#^#^#^#^#^H^#^#^#^#^#^#^#^D^#^#^#^D^#^#^#T^B^#^#^#^#^#^#T^B^#^#^#^#^#^#T^B^#^#^#^#^#^#D^#^#^#^#^#^#^#D^#^#^#^#^#^#^#^D^#^#^#^#^#^#^#Påtd^D^#^#^#<98>
^#^#^#^#^#^#<98>
^#^#^#^#^#^#<98>
Not entirely sure what it is, but pretty sure it shouldn't be there. Is it file corruption, as it doesn't look like what I'd generally consider to be file corruption? While I assume it's probably not doing anything useful at the moment, does the presence of semi-arbirary strings in this file represent a problem with my Ruby installation which I need to fix? Is there perhaps another location or set of locations where the right file might be, and perhaps this one isn't being used?
I notice I have a lot of problems with my server, and often find I have to randomly reinstall gems which seem to disappear from my system, usually after the SSH disconnects. Could this file be something to do with that?
It seems odd to me that if this is the location of an important Ruby system file that my Ruby installation should work at all, but it does seem to... Might it be left over from a previously broken installation? I'm only just progressing out of the beginner stages with Ruby, so any insight into what the file does, why it's important and, particularly, how I should progress would be extremely helpful. Also, any suggestions for further reading on Ruby framework eco system which might help me better understand the inner working of stuff like this would hopefully save me from having to take up people's time here with similar questions in the future, though I understand that's a little outside the usual remit for the site.

Issue with Rails Generator Building a Plugin

I am building a Rails plugin for an application at work.
I want to extract logic that was used in multiple locations, but implemented slightly differently, and add new features needed without doing it 2-3 times over.
I've never build a gem, but according to what I was reading it is possible to use rails generate.
However this has not been the case for me.
Running rails g model Something stuff:type:
First interesting thing is that it is generating mini test stuff when I explicitly told the plugin not to use mini test (using Rspec).
Then looking in my folder structure for the plugin, no db/ folder, nothing added to app/models/, and no test/ folder:
Running the command a second time reveals to me that the files are indeed created:
My questions are:
Where is this stuff going? Can I even find out?
Has anyone encountered something similar? Is it due to a misconfiguration, or bug? Essentially, what's happening?
I would truly appreciate any advice or suggestions!
EDIT #1
Forgot to mention that I checked within the spec/dummy application in case things were being created there, and it is still empty as I left it.
EDIT #2
So I found where the files were by using the find command:
And yeah it added the files to my home folder...
At least now I can just paste them in the right location, but obviously this is bizarre and I'd like to get this resolved, figure out what is going on.
Okay so turns out that yes you may use Rails Generators when building a gem. Also, the generated files will not be placed inside the dummy application unless you are in that directory.
Everything is working as expected on a different computer.
That stuff is going into dummy app that is usually located in test/dummy. In your case, it seems to be located in specs/dummy.
Yeap and nope. That's not misconfiguration.

RoR Copy Devise Using Old Regex

I'm not too savvy with Ruby on Rails, but I know enough that I was able to copy my app into a slightly altered duplicate. Almost everything is going fine with the new copy except that my user email regex is still using the older copy's user email regex.
I'm trying to figure out which part calls devise.rb in the initializers, but so far I have had no luck. I've also had a hard time finding if others have had this problem and solved it.
EDIT - I solved my own problem and answered it below.
Looks like I found the answer to my question. The problem is that copying the app meant that I didn't give the application its own application name. This caused the program to refer to the application with the old application name. All I did was rename it and now it functions the way I want.
I used the following post to help me rename: How to change a Ruby on Rails application name?

Convert a rails engine to an app

I would like to take the community_engine source code and change it so that it can be run as a its own application. The reason I would like to do this is because community_engine contains basically all of the code that my app will use, however much of it needs to be changed or overridden.
I figure that it doesn't make much sense for the app directories sole purpose being either to override a ton of stuff in the engine or to project the engine source that I have modified locally.
I also really want to do this so I will be able to easily see all of the code being used in the app in one place which will make things easier to understand and change.
Heres the community_engine repo: https://github.com/bborn/communityengine
I've asked similar questions as this one in the past but people always seem to think that I just want a to copy the source code to my machine to use locally so hopefully I was better at explaining myself this time:
using devise WITHOUT the gem, can I simply copy the files?
How to convert a large gem to standalone rails app
You could copy the engine in to app_root/engines/community_engine and point the Gemfile to the local path.
gem 'community_engine`, path: 'engines/community_engine'
The engine code can then be editted directly.

Ruby on Rails offline programming

I am going to be away from the internet for a few weeks and would still like to get a project done. What steps should I take to make sure I have access to the things I need (ruby and ROR) while I will be disconnected?
when offline, the following are hard to get:
gems
docs
rails expert blogs
stackoverflow ;-)
so,
gem install as much as you can
download all the railscasts
keep one or two rails book around
and find a place with internet wifi
and most importantly:
un-plug yourself 2 days before the real offline, that's called staging ;-)
If you use version control, make sure you can work offline. DVCS do this well, I've heard SVN can work offline if you have a local SVN server.
Running the Rails app on localhost will allow you to access it with your browser locally.
Apart from this it would also be nice to have documentation offline too. Download everything you can think of: Rails, Ruby, Shell, libs etc. Or use books.
Make sure you have local copies of any documentation you need (railsapi.com lets you download the Rails docs)
Make sure you have all the gems/plugins you need
This may not affect you, but it's bitten me before.
If you are using a javascript library such as jQuery, and are linking to Google's Hosted Libraries rather than a local one, you may find jQuery stops working when you are offline.
Download and link to a local copy before you go.
Get your app (in its current state) up and running on your laptop. Then shut off wireless and make sure it still goes. Don't just guess at what gems and things you'll need - make sure you see it actually run. Don't forget things like database engines and queuing servers. Then start guessing about other gems and items you might need.
Make sure that
gem server
will start up a webserver and let you browse the docs for all your installed gems.
Download every Ruby gem. All of them!
You never know when you'll need to extract EXIF data, or something.

Resources