freightrain 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +14 -2
 - data/Rakefile +1 -1
 - data/bin/ftrain +5 -2
 - data/lib/extensions/gtk/interface_builder.rb +2 -1
 - data/lib/freightrain.rb +3 -1
 - data/lib/freightrain/auto_requirer.rb +7 -8
 - data/lib/freightrain/testhelpers.rb +1 -1
 - data/lib/scaffolding/commands/app.rb +10 -9
 - data/lib/scaffolding/generator.rb +3 -1
 - data/lib/scaffolding/templates/application.ftt +1 -3
 - data/lib/scaffolding/templates/view.ftt +0 -1
 - data/lib/scaffolding/templates/view_model.ftt +0 -3
 - data/lib/scaffolding/templates/view_toplevel.ftt +6 -0
 - data/lib/scaffolding/templates/viewmodel_toplevel.ftt +8 -0
 - metadata +4 -3
 - data/lib/scaffolding/ftrain.rb +0 -23
 
    
        data/README.rdoc
    CHANGED
    
    | 
         @@ -1,4 +1,6 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            = freightrain 
     | 
| 
      
 1 
     | 
    
         
            +
            = freightrain
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            full speed ahead!
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
5 
     | 
    
         
             
            == WHAT IS IT?
         
     | 
| 
       4 
6 
     | 
    
         
             
            Freightrain is a MVVM (model/view/viewmodel) framework for developing desktop applications in ruby
         
     | 
| 
         @@ -9,7 +11,9 @@ Freightrain is a MVVM (model/view/viewmodel) framework for developing desktop ap 
     | 
|
| 
       9 
11 
     | 
    
         
             
            (also make sure you have the latest ruby/gnome2 bindings installed (=> 0.19.3) ) 
         
     | 
| 
       10 
12 
     | 
    
         | 
| 
       11 
13 
     | 
    
         
             
            == HOW DO I USE IT?
         
     | 
| 
       12 
     | 
    
         
            -
            For now, you should take a look at http://github.com/bolthar/rubydraulica 
     | 
| 
      
 14 
     | 
    
         
            +
            For now, you should take a look at http://github.com/bolthar/rubydraulica
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            Note that the project is currently in ALPHA state. Use it in production at your own risk :-) 
         
     | 
| 
       13 
17 
     | 
    
         | 
| 
       14 
18 
     | 
    
         
             
            To get a working stub, install the gem and then:
         
     | 
| 
       15 
19 
     | 
    
         
             
            	ftrain app my_app
         
     | 
| 
         @@ -18,10 +22,18 @@ this will create a new directory 
     | 
|
| 
       18 
22 
     | 
    
         
             
            containing the application stub. To run it, cd into the directory and:
         
     | 
| 
       19 
23 
     | 
    
         
             
            	ruby my_app.rb
         
     | 
| 
       20 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
            'ftrain' command not working? Look here => http://stackoverflow.com/questions/909673/gems-and-ubuntu-9-04
         
     | 
| 
       21 
26 
     | 
    
         | 
| 
       22 
27 
     | 
    
         
             
            Documentation coming soon.
         
     | 
| 
       23 
28 
     | 
    
         | 
| 
       24 
29 
     | 
    
         
             
            == WHERE DO I REPORT BUGS/FEATURE REQUESTS?
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       25 
31 
     | 
    
         
             
            andrea@andreadallera.com
         
     | 
| 
       26 
32 
     | 
    
         | 
| 
      
 33 
     | 
    
         
            +
            Would also be very appreciated:
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            === Reports about installation issues (GTK2, ruby/gnome, ftrain)
         
     | 
| 
      
 36 
     | 
    
         
            +
            === Reports about different platforms (could you install on OSX? Let me know!)
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       27 
39 
     | 
    
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/bin/ftrain
    CHANGED
    
    
| 
         @@ -34,7 +34,8 @@ module Freightrain 
     | 
|
| 
       34 
34 
     | 
    
         
             
                  def connect_to_callback(widget, event_name, method)
         
     | 
| 
       35 
35 
     | 
    
         
             
                    begin
         
     | 
| 
       36 
36 
     | 
    
         
             
                    widget.signal_connect(event_name) do |instance, *args|
         
     | 
| 
       37 
     | 
    
         
            -
                      method. 
     | 
| 
      
 37 
     | 
    
         
            +
                      arguments = [instance, *args].first(method.arity.abs)
         
     | 
| 
      
 38 
     | 
    
         
            +
                      method.call(*arguments)
         
     | 
| 
       38 
39 
     | 
    
         
             
                    end
         
     | 
| 
       39 
40 
     | 
    
         
             
                    rescue Exception => ex
         
     | 
| 
       40 
41 
     | 
    
         
             
                      #TODO:handle this
         
     | 
    
        data/lib/freightrain.rb
    CHANGED
    
    | 
         @@ -5,4 +5,6 @@ require 'needle' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            require 'require_all'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'tmpdir'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
            #HACK!!1!!
         
     | 
| 
      
 9 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__), 'scaffolding', 'scaffolding.rb') if $scaffolding
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_all File.join(File.dirname(__FILE__), 'freightrain')
         
     | 
| 
         @@ -10,15 +10,14 @@ module Freightrain 
     | 
|
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                require_all views_folder
         
     | 
| 
       12 
12 
     | 
    
         
             
                require_all viewmodels_folder
         
     | 
| 
      
 13 
     | 
    
         
            +
                require_all services_folder if self.must_import?(services_folder)
         
     | 
| 
      
 14 
     | 
    
         
            +
                require_all domain_folder   if self.must_import?(domain_folder)
         
     | 
| 
      
 15 
     | 
    
         
            +
              
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
       13 
17 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                 
     | 
| 
       17 
     | 
    
         
            -
                
         
     | 
| 
       18 
     | 
    
         
            -
                if File.directory?(domain_folder) && Dir.entries(domain_folder).length > 2
         
     | 
| 
       19 
     | 
    
         
            -
                  require_all domain_folder
         
     | 
| 
       20 
     | 
    
         
            -
                end
         
     | 
| 
       21 
     | 
    
         
            -
                
         
     | 
| 
      
 18 
     | 
    
         
            +
              private
         
     | 
| 
      
 19 
     | 
    
         
            +
              def self.must_import?(directory)
         
     | 
| 
      
 20 
     | 
    
         
            +
                return File.directory?(directory) && Dir.entries(directory).length > 2
         
     | 
| 
       22 
21 
     | 
    
         
             
              end
         
     | 
| 
       23 
22 
     | 
    
         | 
| 
       24 
23 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,2 +1,2 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
       2 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/testhelpers/container_helpers.rb'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/testhelpers/container_helpers.rb'
         
     | 
| 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            class AppCommand
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
              def initialize(*args)
         
     | 
| 
       5 
     | 
    
         
            -
                raise "name parameter must be specified" if args.length < 1
         
     | 
| 
      
 5 
     | 
    
         
            +
                raise "'name' parameter must be specified" if args.length < 1
         
     | 
| 
       6 
6 
     | 
    
         
             
                @name = args[0]
         
     | 
| 
       7 
7 
     | 
    
         
             
                @dir  = Dir.pwd
         
     | 
| 
       8 
8 
     | 
    
         
             
                @path = File.join(@dir, @name)
         
     | 
| 
         @@ -14,15 +14,16 @@ class AppCommand 
     | 
|
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              def execute
         
     | 
| 
       16 
16 
     | 
    
         
             
                FileUtils.mkdir(@path)
         
     | 
| 
       17 
     | 
    
         
            -
                FileUtils.mkdir(File.join(@path, " 
     | 
| 
       18 
     | 
    
         
            -
                FileUtils.mkdir(File.join(@path, " 
     | 
| 
       19 
     | 
    
         
            -
                FileUtils.mkdir(File.join(@path, " 
     | 
| 
       20 
     | 
    
         
            -
                FileUtils.mkdir(File.join(@path, " 
     | 
| 
      
 17 
     | 
    
         
            +
                FileUtils.mkdir(File.join(@path, "lib"))
         
     | 
| 
      
 18 
     | 
    
         
            +
                FileUtils.mkdir(File.join(@path, "lib", "views"))
         
     | 
| 
      
 19 
     | 
    
         
            +
                FileUtils.mkdir(File.join(@path, "lib", "viewmodels"))
         
     | 
| 
      
 20 
     | 
    
         
            +
                FileUtils.mkdir(File.join(@path, "lib", "services"))
         
     | 
| 
      
 21 
     | 
    
         
            +
                FileUtils.mkdir(File.join(@path, "lib", "domain"))
         
     | 
| 
       21 
22 
     | 
    
         
             
                Generator.create_stub(File.join(@path, "#{@name}.rb"),"application", :name => @name)
         
     | 
| 
       22 
     | 
    
         
            -
                Generator.create_stub(File.join(@path, "views", "#{@name}_view.rb"), " 
     | 
| 
       23 
     | 
    
         
            -
                Generator.create_stub(File.join(@path, "views", "#{@name}_view.glade"), "view_toplevel_glade",:name => @name)
         
     | 
| 
       24 
     | 
    
         
            -
                Generator.create_stub(File.join(@path, "views", "#{@name}_view.bnd.yml"), "view_bnd", :name => @name)
         
     | 
| 
       25 
     | 
    
         
            -
                Generator.create_stub(File.join(@path, "viewmodels", "#{@name}_view_model.rb"), " 
     | 
| 
      
 23 
     | 
    
         
            +
                Generator.create_stub(File.join(@path, "lib", "views", "#{@name}_view.rb"), "view_toplevel", :name => @name.capitalize, :toplevel => @name)
         
     | 
| 
      
 24 
     | 
    
         
            +
                Generator.create_stub(File.join(@path, "lib", "views", "#{@name}_view.glade"), "view_toplevel_glade",:name => @name)
         
     | 
| 
      
 25 
     | 
    
         
            +
                Generator.create_stub(File.join(@path, "lib", "views", "#{@name}_view.bnd.yml"), "view_bnd", :name => @name)
         
     | 
| 
      
 26 
     | 
    
         
            +
                Generator.create_stub(File.join(@path, "lib", "viewmodels", "#{@name}_view_model.rb"), "viewmodel_toplevel", :name => @name.capitalize)
         
     | 
| 
       26 
27 
     | 
    
         
             
                print "Application created in #{@path}\n"
         
     | 
| 
       27 
28 
     | 
    
         
             
              end
         
     | 
| 
       28 
29 
     | 
    
         | 
| 
         @@ -6,7 +6,9 @@ class Generator 
     | 
|
| 
       6 
6 
     | 
    
         
             
                File.open(File.dirname(__FILE__) + "/templates/#{template}.ftt") do |file|
         
     | 
| 
       7 
7 
     | 
    
         
             
                  template_content = file.lines.to_a.join
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                options.keys.each do |param|
         
     | 
| 
      
 10 
     | 
    
         
            +
                  template_content.gsub!("$#{param}".upcase, "#{options[param]}")
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
       10 
12 
     | 
    
         
             
                File.open(filename, 'w+') do |file|
         
     | 
| 
       11 
13 
     | 
    
         
             
                  file << template_content
         
     | 
| 
       12 
14 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,11 +1,9 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #generated by ftrain
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            require 'rubygems'
         
     | 
| 
       4 
2 
     | 
    
         
             
            require 'freightrain'
         
     | 
| 
       5 
3 
     | 
    
         | 
| 
       6 
4 
     | 
    
         
             
            include Freightrain
         
     | 
| 
       7 
5 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            Freightrain.app_path = File.dirname(__FILE__)
         
     | 
| 
      
 6 
     | 
    
         
            +
            Freightrain.app_path = File.join(File.dirname(__FILE__), "lib")
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
       10 
8 
     | 
    
         
             
            Freightrain.toolkit = :gtk
         
     | 
| 
       11 
9 
     | 
    
         
             
            Freightrain.start(:$NAME)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: freightrain
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.6. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.6.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrea Dallera
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2010- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2010-04-05 00:00:00 +02:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -48,12 +48,13 @@ files: 
     | 
|
| 
       48 
48 
     | 
    
         
             
            - lib/scaffolding/scaffolding.rb
         
     | 
| 
       49 
49 
     | 
    
         
             
            - lib/scaffolding/commands/app.rb
         
     | 
| 
       50 
50 
     | 
    
         
             
            - lib/scaffolding/commands/triad.rb
         
     | 
| 
       51 
     | 
    
         
            -
            - lib/scaffolding/ftrain.rb
         
     | 
| 
       52 
51 
     | 
    
         
             
            - lib/scaffolding/templates/view_control_glade.ftt
         
     | 
| 
       53 
52 
     | 
    
         
             
            - lib/scaffolding/templates/view_toplevel_glade.ftt
         
     | 
| 
       54 
53 
     | 
    
         
             
            - lib/scaffolding/templates/view_bnd.ftt
         
     | 
| 
       55 
54 
     | 
    
         
             
            - lib/scaffolding/templates/view.ftt
         
     | 
| 
       56 
55 
     | 
    
         
             
            - lib/scaffolding/templates/application.ftt
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/scaffolding/templates/view_toplevel.ftt
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/scaffolding/templates/viewmodel_toplevel.ftt
         
     | 
| 
       57 
58 
     | 
    
         
             
            - lib/scaffolding/templates/view_model.ftt
         
     | 
| 
       58 
59 
     | 
    
         
             
            - lib/extensions/gtk/interface_builder.rb
         
     | 
| 
       59 
60 
     | 
    
         
             
            - lib/extensions/gtk/dialog_helper.rb
         
     | 
    
        data/lib/scaffolding/ftrain.rb
    DELETED
    
    | 
         @@ -1,23 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            require "rubygems"
         
     | 
| 
       3 
     | 
    
         
            -
            require "require_all"
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            require_all File.dirname(__FILE__) + "/commands"
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            require File.dirname(__FILE__) + "/generator.rb"
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            begin
         
     | 
| 
       10 
     | 
    
         
            -
              klass = eval("#{ARGV[0].capitalize}Command")
         
     | 
| 
       11 
     | 
    
         
            -
            rescue
         
     | 
| 
       12 
     | 
    
         
            -
              print "No command '#{ARGV[0]}'\n"
         
     | 
| 
       13 
     | 
    
         
            -
            end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            begin
         
     | 
| 
       16 
     | 
    
         
            -
              command = klass.new(*ARGV[1...ARGV.length])
         
     | 
| 
       17 
     | 
    
         
            -
              command.check
         
     | 
| 
       18 
     | 
    
         
            -
              command.execute
         
     | 
| 
       19 
     | 
    
         
            -
            rescue Exception => ex
         
     | 
| 
       20 
     | 
    
         
            -
              print ex.message + "\n"
         
     | 
| 
       21 
     | 
    
         
            -
            end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     |