Monserrat Foster
2013-Nov-06 13:21 UTC
Is it possible with Rails to interact with SVN Server and/or the server''s shell?
Hello! I''m fairly new to Ruby and Rails, and currently I don''t have any knowledge on interacting with the server''s shell or a SVN server, but now I have to develop an app where admins allow/restrict access to files and folders from the app and some sort of version control of the files is need so I thought, to install a SVN server also and from the app allow users to access files they''ve been authorized to. I''ve been searching about this but I can''t seem to find a concrete answer. Could some please tell me if this is possible and if so, point me in the right direction, what sort of stuff should i look into first? Thank you. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c192c4de-0beb-48b5-93be-199476dca5b5%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Walter Lee Davis
2013-Nov-06 13:54 UTC
Re: Is it possible with Rails to interact with SVN Server and/or the server''s shell?
On Nov 6, 2013, at 8:21 AM, Monserrat Foster wrote:> Hello! I''m fairly new to Ruby and Rails, and currently I don''t have any knowledge on interacting with the server''s shell or a SVN server, but now I have to develop an app where admins allow/restrict access to files and folders from the app and some sort of version control of the files is need so I thought, to install a SVN server also and from the app allow users to access files they''ve been authorized to. I''ve been searching about this but I can''t seem to find a concrete answer. Could some please tell me if this is possible and if so, point me in the right direction, what sort of stuff should i look into first? > > Thank you.I built something vaguely similar to this a number of years ago, and while I didn''t go down the SVN path, what I did was this: 1. User authentication with Devise, authorization with CanCan. 2. Files stored with Paperclip (in this case they were all PDF) with text scraped from each file into a keywords field on the parent model. 3. Files versioned with vestal_version, which provided forward/back in time navigation. (I did have to hack Paperclip to never delete an attachment, and to rename each attached file to include the version info.) I''m not sure if SVN would have been a saner choice here, I did end up reinventing the wheel. The benefit for me was that everything was in one (Rails) mental model, so I didn''t have to create a bridge back and forth between my user management and file management. Walter> > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c192c4de-0beb-48b5-93be-199476dca5b5%40googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/D17FEF7F-D9F9-4689-A7E5-AF16581153DE%40wdstudio.com. For more options, visit https://groups.google.com/groups/opt_out.
Robert Walker
2013-Nov-06 14:05 UTC
Re: Is it possible with Rails to interact with SVN Server and/or the server''s shell?
Monserrat Foster wrote in post #1126580:> Hello! I''m fairly new to Ruby and Rails, and currently I don''t have any > knowledge on interacting with the server''s shell or a SVN server, but > now I > have to develop an app where admins allow/restrict access to files and > folders from the app and some sort of version control of the files is > need > so I thought, to install a SVN server also and from the app allow users > to > access files they''ve been authorized to. I''ve been searching about this > but > I can''t seem to find a concrete answer. Could some please tell me if > this > is possible and if so, point me in the right direction, what sort of > stuff > should i look into first?Issuing system commands is as simple as: system svn <command> Or when you want to capture the command''s standard output into a string: out = `svn <command>` # These are back tics And, if you decide to use a SCM as a backed to store your files what not choose a SCM that isn''t a steaming pile of sh*t. Like git (http://git-scm.com). Just saying... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/29025eac8521b1bff79a115985c0a4c9%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Robert Walker
2013-Nov-06 14:07 UTC
Re: Is it possible with Rails to interact with SVN Server and/or the server''s shell?
Robert Walker wrote in post #1126590:> > Issuing system commands is as simple as: > > system svn <command>My apologies, but you need to quote the command part: system ''svn <command>'' -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c2dce19ddeb7f94b3dbfda6fbac8fa01%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Monserrat Foster
2013-Nov-06 14:18 UTC
Re: Is it possible with Rails to interact with SVN Server and/or the server''s shell?
Hello all, thanks for replying. Explaining a little further what I need is to set the permissions to determined users from the app, however, the files aren''t in the same server as the app and it should be relatively easy to the users to access the files, and the admin wants to be able to see what files and exactly what was modified by that user on that file and when, etc,etc (That''s why I thought of an SVN server or something similar) . My idea was adding the permissions to a folder via the app so, the user in whatever SVN client he has, is able to download the lastest file and modify it and at the same time, the admin would be able to view who, what and when the files were modified. The app would only keep a record filled by the user but that wouldn''t be 100% accurate due to users (because they can pretty much write whatever they want). On Wednesday, November 6, 2013 9:37:08 AM UTC-4:30, Ruby-Forum.com User wrote:> > Robert Walker wrote in post #1126590: > > > > Issuing system commands is as simple as: > > > > system svn <command> > > My apologies, but you need to quote the command part: > > system ''svn <command>'' > > -- > Posted via http://www.ruby-forum.com/. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/79bed319-fac5-4dc9-bc79-76964cf75770%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Robert Walker
2013-Nov-06 21:40 UTC
Re: Is it possible with Rails to interact with SVN Server and/or the server''s shell?
Monserrat Foster wrote in post #1126594:> Explaining a little further what I need is to set the permissions to > determined users from the app, however, the files aren''t in the same > serverKeeping in mind that what I''m about to say is completely off the top of my head... Given that your documents are stored on a separate server from the app thing get a little more tricky. For sake of reference let''s call them "Doc Server" and "App Server". Assuming you have enough control of the Doc Server that you could install a service application that''s probably the approach I would take. I would hide all access to the files behind a service application with some sort of HTTP interface. It would be REST based if I were to build it returning JSON responses. It would also provide secured access to the requested files. So we have JSON for the file metadata and HTTP access to the file data. The service app would have a multi-part form upload used to receive incoming files from a user. The service app would need to know the name and email of the user, the path in the local git working tree along with the file data. git add --all Used to add any new (untracked) files to the git repository. git commit --author="John Doe <john-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org>" -m "Changing a test file." This would commit all change setting the commit author to "John Doe <john-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org>". git log --author="John Doe <john-LezKZOMPA8NBDgjK7y7TUQ@public.gmane.org>" This would filter the log output to just John''s commits. git log --author="John Doe <john-LezKZOMPA8NBDgjK7y7TUQ@public.gmane.org>" --name-status This would also include a list of files changes and the status code for the type of change. All of this power would be available to the service application via the Ruby system command (or back tic): ------------------------- #!/usr/bin/env ruby git_user = "John Doe <john-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" out = `git log --no-color --author="#{git_user}" --pretty=full` puts out ------------------------- $ ./main.rb commit 58359794f4443985279cdd1627cdf944fd140d24 (HEAD, master) Author: John Doe <john-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org> Commit: Robert Walker <robert-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org> Changing test file. M test.txt Notice I used --pretty-full in this example to illustrate the difference in the author vs. the committer of the change. The committer would always be the service app, or whatever is configured in your git config. The author is provided by the service application. Now it''s just a matter of writing a Ruby class to parse the git output and create the JSON metadata that the service application would return to the application running on the App Server. Secure the whole this with some sort of basic single sign-on or API token. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d6a57e2d5d36f7af40c9b43b216a39a6%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Apparently Analagous Threads
- is there any way to convert .xlsx to .xls
- Consuming a web service created with Rails, ETL vs Rest?
- What's the best way to approach reading and parse large XLSX files?
- Getting rspec error: Net::SMTPServerBusy: Relay access denied
- When overriding the registration controller from devise, is it possible to access the newly created