FreeRIDE 0.5.0rc1: patch to allow per-user properties 
Author Message
 FreeRIDE 0.5.0rc1: patch to allow per-user properties

This is quite a hack, but it is transparent to the system and fixes the
issues I experienced.

Comments?

====
--- freeride-0.5.0rc1.orig/freebase/readers.rb

     def self.load_libraries
       require 'yaml'
     end
-
+
+    def self.local_name(name)
+      filespec = $1 if name =~ %r{(config/.*)}
+      filespec = $1 if name =~ %r{(plugins/.*)}
+      "#{ENV['HOME']}/.freeride/#{filespec}"
+    end
+
+    class << self
+      private :local_name
+    end
+
     def self.save(base_slot, filespec, name, version)
-      file = File.new(filespec,  "w+")
+      begin
+        file = File.new(filespec,  "w+")
+      rescue Errno::EACCES
+        filespec = local_name(filespec)
+        dir = "/"
+        File.dirname(filespec[1..-1]).split("/").each do |d|
+          dir += "#{d}/"
+          Dir.mkdir(dir) rescue nil
+        end
+        file = File.new(filespec, "w+")
+      end
       file.puts "#### Properties: #{name} - Version: #{version}"
       file.puts gather_data(base_slot).to_yaml(:SortKeys=>true)

     end

     def self.load(base_slot, filespec)
+      filespec2 = local_name(filespec)
+      if File.exist?(filespec2)
+        data = nil
+        File.open(filespec2) {|file| file.binmode; data = file.read}
+        read_slot(base_slot, YAML.load(data))
+      end
       return unless File.exist?(filespec)
       data = nil
       File.open(filespec) {|file| file.binmode; data = file.read}
======

--
 _           _                            
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
        Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

* JHM wonders what Joey did to earn "I'd just like to say, for the record,
  that Joey rules."
        -- Seen on #Debian



Fri, 17 Jun 2005 20:35:23 GMT  
 FreeRIDE 0.5.0rc1: patch to allow per-user properties

Quote:

> This is quite a hack, but it is transparent to the system and fixes the
> issues I experienced.

> Comments?

I am an idiot.

Quote:
>      def self.load(base_slot, filespec)
> +      filespec2 = local_name(filespec)
> +      if File.exist?(filespec2)
> +        data = nil
> +        File.open(filespec2) {|file| file.binmode; data = file.read}
> +        read_slot(base_slot, YAML.load(data))

        return

Quote:
> +      end
>        return unless File.exist?(filespec)
>        data = nil
>        File.open(filespec) {|file| file.binmode; data = file.read}

--
 _           _                            
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
        Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Because I don't need to worry about finances I can ignore Microsoft
and take over the (computing) world from the grassroots.
        -- Linus Torvalds



Fri, 17 Jun 2005 20:38:56 GMT  
 FreeRIDE 0.5.0rc1: patch to allow per-user properties

Quote:

> Sent: Monday, December 30, 2002 4:39 AM
> To: ruby-talk ML
> Subject: Re: FreeRIDE 0.5.0rc1: patch to allow per-user properties


> > This is quite a hack, but it is transparent to the system and fixes the
> > issues I experienced.

Thanks, but Laurent Julliard already made the real changes to fix this
problem and committed them to our CVS repository.

Curt



Sat, 18 Jun 2005 04:59:46 GMT  
 FreeRIDE 0.5.0rc1: patch to allow per-user properties

Quote:


> > Sent: Monday, December 30, 2002 4:39 AM
> > To: ruby-talk ML
> > Subject: Re: FreeRIDE 0.5.0rc1: patch to allow per-user properties


> > > This is quite a hack, but it is transparent to the system and fixes the
> > > issues I experienced.

> Thanks, but Laurent Julliard already made the real changes to fix this
> problem and committed them to our CVS repository.

Much better :) Mine is only a hack to get my packages running.
Is it then OK if I get a snapshot of the CVS and package it?

--
 _           _                            
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
        Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Software is like sex; it's better when it's free.
        -- Linus Torvalds



Sat, 18 Jun 2005 06:30:50 GMT  
 FreeRIDE 0.5.0rc1: patch to allow per-user properties

Quote:



>>> Sent: Monday, December 30, 2002 4:39 AM
>>> To: ruby-talk ML
>>> Subject: Re: FreeRIDE 0.5.0rc1: patch to allow per-user properties


>>>> This is quite a hack, but it is transparent to the system and fixes
>>>> the
>>>> issues I experienced.

>> Thanks, but Laurent Julliard already made the real changes to fix this
>> problem and committed them to our CVS repository.

> Much better :) Mine is only a hack to get my packages running.
> Is it then OK if I get a snapshot of the CVS and package it?

It *should* be OK, although that is the way RC1 was released...so your
builds will not quite be RC1...we should have a release soon though
that will include this and other bug fixes.  Thanks so much for your
efforts!

-rich



Sat, 18 Jun 2005 10:35:06 GMT  
 FreeRIDE 0.5.0rc1: patch to allow per-user properties

Quote:

> >>Thanks, but Laurent Julliard already made the real changes to fix this
> >>problem and committed them to our CVS repository.

> >Much better :) Mine is only a hack to get my packages running.
> >Is it then OK if I get a snapshot of the CVS and package it?

> It *should* be OK, although that is the way RC1 was released...so your
> builds will not quite be RC1...we should have a release soon though
> that will include this and other bug fixes.  Thanks so much for your
> efforts!

Done it. I've made a new package for this: freeride-cvs. I'm setting up
the "infrastructure" (scripts and such) that will soon allow me to track
the CVS as close as I want, perhaps even with automatic "builds" and
releases.

--
 _           _                            
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
        Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

'Ooohh.. "FreeBSD is faster over loopback, when compared to Linux
over the wire". Film at 11.'
        -- Linus Torvalds



Sun, 19 Jun 2005 19:14:33 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. FreeRIDE 0.5.0rc1: issues while packaging

2. C4: Changing properties of Text-fields per line

3. Nuova patch per Clipper Tools da CA

4. patch to allow dump/load to work on DATA objects

5. Patch allowing filechooser to select multiple files

6. ANN: experimental patch to allow importing from file-like objects

7. experimental patch to allow importing from file-like objects

8. Patch to Tk 3.6 listbox to allow non-contiguous selections

9. Tcl8.0b1 patch to allow widget creation in namespaces

10. Allowing the user to drag objects in a window

11. New template to allow users to change screen layouts

12. allowing a filter to get user input

 

 
Powered by phpBB® Forum Software