How can I beautify ruby code? Is there a ruby plugin which I don't see?
see also: http://stackoverflow.com/questions/14000510/
thanks,
Thufir
Hi Thufir,
On Sat, 2012-12-22 at 21:57 +0000, thufir wrote:
How can I beautify ruby code? Is there a ruby plugin which I don't see?
Geany allows external tools like astyle or similar to handle this Job. Go to Edit->Format->Send Selection to->Set custom commands to set this up.
Hope this helps you.
Best Regards, Dominic
On Sun, Dec 23, 2012 at 9:24 AM, Dominic Hopf dmaphy@googlemail.com wrote:
Hi Thufir,
On Sat, 2012-12-22 at 21:57 +0000, thufir wrote:
How can I beautify ruby code? Is there a ruby plugin which I don't see?
Geany allows external tools like astyle or similar to handle this Job. Go to Edit->Format->Send Selection to->Set custom commands to set this up.
Hope this helps you.
Best Regards, Dominic
-- Dominic Hopf http://dominichopf.de/
Key Fingerprint: A7DF C4FC 07AE 4DDC 5CA0 BD93 AAB0 6019 CA7D 868D
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
I usually set up my pep8 checkers, pylint and perl tidy into my build commands
Build -> Set Build Commands
Sayth
On Sun, 23 Dec 2012 13:43:33 +1100, Sayth Renshaw wrote:
I usually set up my pep8 checkers, pylint and perl tidy into my build commands
Build -> Set Build Commands
I set compile (and execute) to:
/home/thufir/.rvm/rubies/default/bin/ruby "%f"
and right below that set "beautify" to:
/home/thufir/.rbeautify.rb "%f"
Pressing F8 runs the ruby script fine (thanks for the help) but F9 for beautify results in:
/home/thufir/.rbeautify.rb "mail.rb" (in directory: /home/thufir/ruby) Compilation failed. /bin/sh: 1: /home/thufir/.rbeautify.rb: not found
The script is at:
thufir@dur:~$ thufir@dur:~$ ls -al .rbeautify.rb -rwxrwxr-x 1 thufir thufir 6880 Dec 22 22:16 .rbeautify.rb thufir@dur:~$ thufir@dur:~$ head .rbeautify.rb -n 6 #!/usr/bin/ruby -w
=begin / *************************************************************************** * Copyright (C) 2008, Paul Lutus * thufir@dur:~$
Somehow I have the path or variable wrong?
thanks,
Thufir
On Sunday, December 23, 2012, thufir wrote:
On Sun, 23 Dec 2012 13:43:33 +1100, Sayth Renshaw wrote:
I usually set up my pep8 checkers, pylint and perl tidy into my build commands
Build -> Set Build Commands
I set compile (and execute) to:
/home/thufir/.rvm/rubies/default/bin/ruby "%f"
and right below that set "beautify" to:
/home/thufir/.rbeautify.rb "%f"
Pressing F8 runs the ruby script fine (thanks for the help) but F9 for beautify results in:
/home/thufir/.rbeautify.rb "mail.rb" (in directory: /home/thufir/ruby) Compilation failed. /bin/sh: 1: /home/thufir/.rbeautify.rb: not found
The script is at:
thufir@dur:~$ thufir@dur:~$ ls -al .rbeautify.rb -rwxrwxr-x 1 thufir thufir 6880 Dec 22 22:16 .rbeautify.rb thufir@dur:~$ thufir@dur:~$ head .rbeautify.rb -n 6 #!/usr/bin/ruby -w
=begin /
- Copyright (C) 2008, Paul Lutus
thufir@dur:~$
Somehow I have the path or variable wrong?
thanks,
Thufir
Users mailing list Users@lists.geany.org javascript:; https://lists.geany.org/cgi-bin/mailman/listinfo/users
Well you shouldn't need to specify full path, you may want to swap the rubies when using rvm.
So it's definitely a path problem. Can you run rbeautify from terminal without changing to be in your rvm directory ? Did you set rvm to --use default otherwise you will go back to system default ruby.
Sayth
On Sun, 23 Dec 2012 17:50:47 +1100, Sayth Renshaw wrote:
Well you shouldn't need to specify full path, you may want to swap the rubies when using rvm.
So it's definitely a path problem. Can you run rbeautify from terminal without changing to be in your rvm directory ?
I don't understand what you mean. There are three settings I'm now using 'Set Build Commands'. The first two are Ruby commands:
compile /home/thufir/.rvm/rubies/default/bin/ruby "%f" beautify /home/thufir/.rbeautify.rb "%f"
The third is under Execute commands:
execute /home/thufir/.rvm/rubies/default/bin/ruby "%f"
In so far as swapping rubies, wouldn't I do so from rvm and just have Geany use the default?
The only build command which fails is beautify.
Why shouldn't you specify the full path? Do you mean that a relative path should be used?
thanks,
Thufir
On Monday, December 24, 2012, thufir wrote:
On Sun, 23 Dec 2012 17:50:47 +1100, Sayth Renshaw wrote:
Well you shouldn't need to specify full path, you may want to swap the rubies when using rvm.
So it's definitely a path problem. Can you run rbeautify from terminal without changing to be in your rvm directory ?
I don't understand what you mean. There are three settings I'm now using 'Set Build Commands'. The first two are Ruby commands:
compile /home/thufir/.rvm/rubies/default/bin/ruby "%f" beautify /home/thufir/.rbeautify.rb "%f"
The third is under Execute commands:
execute /home/thufir/.rvm/rubies/default/bin/ruby "%f"
In so far as swapping rubies, wouldn't I do so from rvm and just have Geany use the default?
The only build command which fails is beautify.
Why shouldn't you specify the full path? Do you mean that a relative path should be used?
thanks,
Thufir
Users mailing list Users@lists.geany.org javascript:; https://lists.geany.org/cgi-bin/mailman/listinfo/users
Your compile command should be just "ruby %f" . You shouldn't be specifying full paths.
Say you create another ruby so that your path is
/home/thufir/.rvm/rubies/a_new_ruby/bin/ruby "%f"
You would then have to change your compile commands. That defeats the point of using rvm.
All your commands should not specify a full path. When you switch rubies in rvm as long as you have beautify installed calling it should work.
Sayth
On Mon, 24 Dec 2012 07:50:19 +1100, Sayth Renshaw wrote:
Your compile command should be just "ruby %f" . You shouldn't be specifying full paths.
Ok, I set it so that compile is "ruby %f" and beautify is "rbeautify % f". Output from the rbeautify gem is to the console in Geany, which I suppose I can copy/paste.
thanks,
Thufir
Hi,
Disclaimer: I don't know Ruby.
Le 23/12/2012 07:34, thufir a écrit :
[...] I set compile (and execute) to:
/home/thufir/.rvm/rubies/default/bin/ruby "%f"
and right below that set "beautify" to:
/home/thufir/.rbeautify.rb "%f"
[...] thufir@dur:~$ head .rbeautify.rb -n 6 #!/usr/bin/ruby -w
[...]
Your .rbeautify.rb script seems to use /usr/bin/ruby, while you specify a specific Ruby paths for the compile/execute, is that normal?
Anyway, try specifying the Ruby path:
/home/thufir/.rvm/rubies/default/bin/ruby -w /home/thufir/.rbeautify.rb "%f"
Cheers, Colomban
On Sun, 23 Dec 2012 20:30:19 +0100, Colomban Wendling wrote:
Your .rbeautify.rb script seems to use /usr/bin/ruby, while you specify a specific Ruby paths for the compile/execute, is that normal?
Ohhh, I see. In any event I was using the wrong script. Here's the correct usage as so:
thufir@dur:~/ruby$ thufir@dur:~/ruby$ cat mail.rb require 'yaml' require 'net/imap' require 'mail'
2.times do puts 'hello world' end
thufir@dur:~/ruby$ thufir@dur:~/ruby$ rbeautify mail.rb require 'yaml' require 'net/imap' require 'mail'
2.times do puts 'hello world' end
thufir@dur:~/ruby$
However, it doesn't change the underlying file, you have to pipe to the file (I presume). Reading the doc's.
https://rubygems.org/gems/ruby-beautify
-Thufir
Le 23/12/2012 21:26, thufir a écrit :
On Sun, 23 Dec 2012 20:30:19 +0100, Colomban Wendling wrote:
Your .rbeautify.rb script seems to use /usr/bin/ruby, while you specify a specific Ruby paths for the compile/execute, is that normal?
Ohhh, I see. In any event I was using the wrong script. Here's the correct usage as so:
thufir@dur:~/ruby$ thufir@dur:~/ruby$ cat mail.rb require 'yaml' require 'net/imap' require 'mail'
2.times do puts 'hello world' end
thufir@dur:~/ruby$ thufir@dur:~/ruby$ rbeautify mail.rb require 'yaml' require 'net/imap' require 'mail'
2.times do puts 'hello world' end
thufir@dur:~/ruby$
However, it doesn't change the underlying file, you have to pipe to the file (I presume). Reading the doc's.
Tip: use the Custom Commands, not the Build Commands.
https://rubygems.org/gems/ruby-beautify
-Thufir
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 24 December 2012 16:04, thufir hawat.thufir@gmail.com wrote:
On Sun, 23 Dec 2012 22:20:27 +0100, Colomban Wendling wrote:
Tip: use the Custom Commands, not the Build Commands.
Build -> Make Custom Target?
No, read the fine manual http://www.geany.org/manual/current/index.html#sending-text-through-custom-c... :)
Cheers Lex
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On Mon, 24 Dec 2012 18:15:46 +1100, Lex Trotman wrote:
On 24 December 2012 16:04, thufir hawat.thufir@gmail.com wrote:
On Sun, 23 Dec 2012 22:20:27 +0100, Colomban Wendling wrote:
Tip: use the Custom Commands, not the Build Commands.
Build -> Make Custom Target?
No, read the fine manual http://www.geany.org/manual/current/index.html#sending-text-through-
custom-commands
:)
Cheers Lex
That is very cool, I just put "rbeautify" in there and it ran the gem against selected text :)
Merry Christmas,
Thufir