Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to do in-memory editing #16

Open
cmouse opened this issue Jan 6, 2014 · 5 comments
Open

Ability to do in-memory editing #16

cmouse opened this issue Jan 6, 2014 · 5 comments

Comments

@cmouse
Copy link

cmouse commented Jan 6, 2014

I would love to integrate ruco into an app I am making, but my major challenge is that ruco has been structured to require an actual file at all times. I could not find simple way to modify code via inheritance to provide the data directly. Is there a way you could consider extending your code to allow in-memory data instead of file?

@cmouse
Copy link
Author

cmouse commented Jan 7, 2014

Actually, found a way. But it's not so pretty as I'd like, so if you can come up with something, it would be appreciated.

@grosser
Copy link
Owner

grosser commented Jan 7, 2014

how about:

result = Tempfile.open('foo') do |f|
  ... open file in ruco ...
  File.read(f.path)
end

@cmouse
Copy link
Author

cmouse commented Jan 7, 2014

@grosser yes, except that this is information that I would rather not write into disk at all. Using tempfiles is not a solution :(

@cmouse
Copy link
Author

cmouse commented Jan 7, 2014

@grosser it did not seem very hard to modify the code by rewriting Ruco::Application and Ruco::Editor with minute changes. perhaps this could be done in the application api? The project is https://github.com/cmouse/pwkeep if you are interested.

@grosser
Copy link
Owner

grosser commented Jan 7, 2014

The whole curses bootstrap thingy is in bin/ruco, so this would have to be
moved over so it's accessible via a ruby interface.
Then the editor has to know it's a string and not a file, so it has to read
and write it differently etc.

Sounds like a lot of work to me, using files and doing being ... ensure ...
delete file end sounds like the simpler solution to me,
and you can use whatever ENV["EDITOR"] the user has chosen too

On Tue, Jan 7, 2014 at 12:26 PM, Aki Tuomi [email protected] wrote:

@grosser https://github.com/grosser it did not seem very hard to modify
the code by rewriting Ruco::Application and Ruco::Editor with minute
changes. perhaps this could be done in the application api? The project is
https://github.com/cmouse/pwkeep if you are interested.


Reply to this email directly or view it on GitHubhttps://github.com//issues/16#issuecomment-31775823
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants