Dumb question about character in hobo_simple_color gemspec

10 views
Skip to first unread message

Ignacio Huerta

unread,
Oct 16, 2012, 1:25:06 AM10/16/12
to hob...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm starting to package hobo-metasearch into a gem, and I have seen
something interesting inside the hobo_simple_color gemspec. The line
that starts with "s.files" can't be parsed correctly by some apps
(Gedit, Firefox, Github syntax highlight):

This is what it looks like in gedit and github:
s.files = `git ls-files -z`.split('')

In vim:
s.files = `git ls-files -z`.split('^@')

In firefox
(https://raw.github.com/Hobo/hobo_simple_color/master/hobo_simple_color.gemspec):
s.files = `git ls-files -z`.split('?')


I've looked for examples elsewhere and I've found different approaches:

s.files = `git ls-files`.split("\n")
s.files = `git ls-files -x #{name}/* -z`.split("\0")

- From the rubygems documentation
(http://docs.rubygems.org/read/chapter/20#files), it looks like this
line just sets an array of all files in the gem. As hobo_simple_color
is the main example for creating hobo plugin/gems, should I follow any
particular approach?

Regards,
Ignacio

- --
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlB877IACgkQBPlUJ6RHaOS2uwCfbMANR4TLGMmBnrKBBGUPvxc2
CPYAoP5UlQbOTDi2wRwWMavMPVvsaMMq
=Ze/2
-----END PGP SIGNATURE-----

Bryan Larsen

unread,
Oct 16, 2012, 9:20:01 AM10/16/12
to hob...@googlegroups.com
Including a \0 literally into a text file is probably the worst
character we could do that with. Beside the problem you noted, it's
probably going to mess with the automatic character set detection that
many editors do.

So let's replace

> s.files = `git ls-files -z`.split('^@')

with

> s.files = `git ls-files -z`.split("\0")

wherever it exists.

thanks,
Bryan
> Teléfono: 0034 645 70 77 35
> Email realizado con software libre
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iEYEARECAAYFAlB877IACgkQBPlUJ6RHaOS2uwCfbMANR4TLGMmBnrKBBGUPvxc2
> CPYAoP5UlQbOTDi2wRwWMavMPVvsaMMq
> =Ze/2
> -----END PGP SIGNATURE-----
>
> --
> You received this message because you are subscribed to the Google Groups "Hobo Dev" group.
> To post to this group, send email to hob...@googlegroups.com.
> To unsubscribe from this group, send email to hobodev+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hobodev?hl=en.
>

Ignacio Huerta

unread,
Oct 17, 2012, 4:36:17 PM10/17/12
to hob...@googlegroups.com
Ok, understood, "\0" it is. Thanks!

El 16/10/12 15:20, Bryan Larsen escribi�:
> Including a \0 literally into a text file is probably the worst
> character we could do that with. Beside the problem you noted,
> it's probably going to mess with the automatic character set
> detection that many editors do.
>
> So let's replace
>
>> s.files = `git ls-files -z`.split('^@')
>
> with
>
>> s.files = `git ls-files -z`.split("\0")
>
> wherever it exists.
>
> thanks, Bryan
>
>
> On Tue, Oct 16, 2012 at 1:25 AM, Ignacio Huerta
> <ign...@ihuerta.net> wrote: Hi,
>
> I'm starting to package hobo-metasearch into a gem, and I have
> seen something interesting inside the hobo_simple_color gemspec.
> The line that starts with "s.files" can't be parsed correctly by
> some apps (Gedit, Firefox, Github syntax highlight):
>
> This is what it looks like in gedit and github: s.files = `git
> ls-files -z`.split('')
>
> In vim: s.files = `git ls-files -z`.split('^@')
>
> In firefox
> (https://raw.github.com/Hobo/hobo_simple_color/master/hobo_simple_color.gemspec):
>
>
s.files = `git ls-files -z`.split('?')
>
>
> I've looked for examples elsewhere and I've found different
> approaches:
>
> s.files = `git ls-files`.split("\n") s.files = `git
> ls-files -x #{name}/* -z`.split("\0")
>
> From the rubygems documentation
> (http://docs.rubygems.org/read/chapter/20#files), it looks like
> this line just sets an array of all files in the gem. As
> hobo_simple_color is the main example for creating hobo
> plugin/gems, should I follow any particular approach?
>
> Regards, Ignacio
>
>>
>> -- You received this message because you are subscribed to the
>> Google Groups "Hobo Dev" group. To post to this group, send email
>> to hob...@googlegroups.com. To unsubscribe from this group, send
>> email to hobodev+u...@googlegroups.com. For more options,
>> visit this group at
>> http://groups.google.com/group/hobodev?hl=en.
>>
>

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Reply all
Reply to author
Forward
0 new messages