I need to create a gem, for my own use, that substitutes the current 'libnotify' gem as I find it unusable to have my testing notifications queued one after the other. I'll use dbus-send to create the notifications, and get their ID. Now I need some way of storing this ID between each code run so that I can retrieve it when a new notification is created and replace the notification instead of queuing a new one.
So how and where do I store this temporary data with my gem? All it needs is a simple scratch file, but it's not one I can delete after use. What would the best practise be for this?
One common idiom is to use an hidden folder in your home directory.
~/.mygem/data
Related
I want to use in my project ckeditor with active storage, but when I generate to install ckeditor using orm active record and active storage, it create an initializer but not create any migration file.
Running via Spring preloader in process 23128
create config/initializers/ckeditor.rb
route mount Ckeditor::Engine => '/ckeditor'
Could not find "active_record/active_storage/ckeditor/asset.rb" in
any of your source paths. Your current source paths are:
/home/arif/Development/Test
Project/cable_test/lib/templates/ckeditor/install
/home/arif/.rvm/gems/ruby-2.4.2/gems/ckeditor-
4.1.3/lib/generators/ckeditor/templates
So I ran into this as well, and after poking around the code I figured I'd just run the generator without the flags like the docs. If you run into this problem just run the generator with no flags rails g ckeditor:install. Also, you'll need to look at these files and make sure your models match.
https://github.com/galetahub/ckeditor/tree/master/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor
EDIT: It looks like active_storage is only available on the master branch as of this post.
Is it possible for extensions access the containing-app's container directory?
For iOS5-based app, i don't want to move all my old data into shared-contatiner, i wish that main-app can remain the same, and the extension just read & write the old data directly, that will be perfect!~
Your widget may never access the containing app's data directly, only if the containing app puts that data into a shared container using app groups. The documentation (including the WWDC videos) is pretty clear about this.
There's a high chance that your iOS-5-based app needs major changes anyway to work nicely on iOS 8.
I'm trying to make a game in Ruby, and my latest addition is to save files, however, I'm having a major problem with encrypting them.
I already got the saving and loading methods set up, but I don't want to save them in plain-text, because that's begging for cheating. No matter what, the methods I use to try and store them encrypted, compressed, etc., all seem to spring some error on me.
What's the best method for saving text in a file? The only important thing is that the file can't be opened and edited.
You can use crypt gem to encrypt/decrypt your file.
But keep in mind that if your users can view your Ruby script, there's basically no way to hide your data, since any encryptions requires some kind of keys.
I'm migrating a sinatra app I have that acts as a backend UI for our DNS database. I've already got the DM configs in the sinatra app but want to migrate it to padrino so I can make it cleaner and easier to read, but also because I want to play around to padrino. If I just generate a new model, can I perform the datamapper mapping in that model, including specifying the db application and get away with doing that instead of using a generator?
What do I need to do to be able to access models on a different database, ideally without damaging that data base (read only)
Right so you actually can do this I found out with a bit of trial and error. Specify the datamapper database source in the config/boot.rb there's a section labelled Padrino.after_load, you'll want to add in your new DataMapper source here
DataMapper.setup(:myalternatedatasource, "MY_ALTERNATE_DB_URL
Then in your model file you'll want to specify
def self.default_repository_name
:myalternatedatasource
end
And it'll all work as intended!
I'm using spree and created a new payment gateway extension. The problem is, my newly created payment gateway gets created first before the core payment gateway of spree. Here's the error message.
doesn't exist: SHOW FIELDS FROM gateway_options
I've had the same problem. Basically, there's a way to define the order in which extensions are loaded but not when their migrations are ran.
config.extensions = [:all, :site]
More info here.
The way I do it, is simply by renaming the "db" folder of the extensions' migrations needing to be ran later. When the others have ran, I rename it back to its original name and run the migrations again. Dirty, but it works.
There could probably be a way to make a rake task and automate this.