incubator-alois-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fla...@apache.org
Subject svn commit: r1031571 - in /incubator/alois/trunk: ./ etc/default/ prisma/bin/ prisma/lib/prisma/ rails/ rails/app/models/ rails/app/views/survey/ rails/app/views/tablelist/ rails/script/
Date Fri, 05 Nov 2010 14:10:54 GMT
Author: flavio
Date: Fri Nov  5 14:10:53 2010
New Revision: 1031571

URL: http://svn.apache.org/viewvc?rev=1031571&view=rev
Log:
Worked on Makefile and INSTALL text, to enable deveopers

Modified:
    incubator/alois/trunk/INSTALL
    incubator/alois/trunk/Makefile
    incubator/alois/trunk/etc/default/alois-environment-config.rb
    incubator/alois/trunk/etc/default/alois-environment.rb
    incubator/alois/trunk/prisma/bin/prisma
    incubator/alois/trunk/prisma/lib/prisma/database.rb
    incubator/alois/trunk/rails/Rakefile
    incubator/alois/trunk/rails/app/models/connection.rb
    incubator/alois/trunk/rails/app/views/survey/_data_table.rhtml
    incubator/alois/trunk/rails/app/views/tablelist/index.rhtml
    incubator/alois/trunk/rails/script/compile_java

Modified: incubator/alois/trunk/INSTALL
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/INSTALL?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/INSTALL (original)
+++ incubator/alois/trunk/INSTALL Fri Nov  5 14:10:53 2010
@@ -1,28 +1,31 @@
 = Installation =
 
-== Configuration ==
-Two config files:
- * default_environment.rb
-
 == Local usage ==
-/!\ Probably not working yet /!\
-TODO: Create default sqlite DB
-TODO: Create script to fill sqlite db with local logs
-TODO: compile java
-TODO: List required packages (eg java or jfreechart)
-
 You can use alois without installing antything. Beacause
 ALOIS is a rails application you can simply use the common
 rails commands to start a local webserver on port 3000. All
-you need is a working rubygems version installed on your
-system.
+you need is a working rubygems version and some system
+libraries installed on your system.
+
+# required packages
+sudo apt-get install rubygems rake ruby1.8-dev libmysqlclient-dev libsqlite3-ruby1.8 libjfreechart-java
+# install a java runtime and java compiler eg openjdk-6-jdk
+suod gem install libisi
+
+# download necessary gems
+make freeze-gems
+
+# initialize directory structure
+make init
+
+# creates new sqlite databases
+make init-db
+
+TODO: Create script to fill sqlite db with local logs
 
 # change into rails directory
 cd <<svn root>>/rails
 
-# Install gems (if not executed as root, gems will be in ~/.gem)
-rake gems:install
-
 # to start server
 ./script/server
 

Modified: incubator/alois/trunk/Makefile
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/Makefile?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/Makefile (original)
+++ incubator/alois/trunk/Makefile Fri Nov  5 14:10:53 2010
@@ -39,7 +39,8 @@ TARGET_RAILS_ENV=$(TARGET_RAILS_CONFIG)/
 WORKING_CONFIG=$(srcdir)/development_configs
 RAKE_COMMAND=cd $(SOURCE_RAILS); rake 
 
-all: build
+all:
+	@echo "TODO add help here"
 
 # build target and freeze gems
 rails/java/CreateChart.class: rails/java/CreateChart.java
@@ -54,20 +55,21 @@ init-dirs:
 init-plugins:
 # git://github.com/imedo/awesome_email.git
 	mkdir -p $(SOURCE_RAILS)/vendor/plugins
-	cp rails_plugins/awesome_email $(SOURCE_RAILS)/vendor/plugins/ -R
-	cp rails_plugins/auto_complete $(SOURCE_RAILS)/vendor/plugins/auto_complete -R
+	rsync --exclude .svn -rv rails_plugins/awesome_email $(SOURCE_RAILS)/vendor/plugins/
+	rsync --exclude .svn -rv rails_plugins/auto_complete $(SOURCE_RAILS)/vendor/plugins/
 
 init: init-dirs init-plugins rails/java/CreateChart.class
 
 
 export GEM_HOME := $(srcdir)/gems
 export GEM_PATH := $(srcdir)/gems
-freeze-gems:
+freeze-gems: init-dirs
 	@echo "Gem home: ${GEM_HOME} Gem path: ${GEM_PATH}"
 	@echo "Downloading rails"
 	gem install -V -v=2.3.2 rails
+	gem install libisi
 	@echo "Installing required gems"
-	$(RAKE_COMMAND) "gems:install"
+	$(RAKE_COMMAND) --trace "gems:install"
 	@echo "Freezing gems"
 	$(RAKE_COMMAND) "rails:freeze:gems"
 	@echo "Build required gems"
@@ -185,3 +187,5 @@ clean:
 #	rm $(SOURCE_RAILS)/java/*.class
 	rm -rf $(WORKING_CONFIG)
 
+mrproper: clean
+	rm -rf gems

Modified: incubator/alois/trunk/etc/default/alois-environment-config.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/etc/default/alois-environment-config.rb?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/etc/default/alois-environment-config.rb (original)
+++ incubator/alois/trunk/etc/default/alois-environment-config.rb Fri Nov  5 14:10:53 2010
@@ -38,6 +38,7 @@ def load_config(config)
     config.gem "csspool", :version => "0.2.6"
     config.gem "inline_attachment" #:version => "0.3.0"
     config.gem "rubyforge" # :version => "0.4.4",
+    config.gem "libisi", :lib => false
   
     # for pdf writing
     config.gem "pdf-writer", :lib => false  # => "1.1.3",

Modified: incubator/alois/trunk/etc/default/alois-environment.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/etc/default/alois-environment.rb?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/etc/default/alois-environment.rb (original)
+++ incubator/alois/trunk/etc/default/alois-environment.rb Fri Nov  5 14:10:53 2010
@@ -11,9 +11,18 @@ require 'pathname'
 require 'alois/date_time_enhance'
 require 'mysql_adapter_extensions'
 require 'dummy_class_extension'
-require 'will_paginate'
-require 'inline_attachment'
-require 'awesome_email_fix'
+begin
+  require 'will_paginate'
+rescue LoadError
+  $log.warn("Error loading will_paginate #{$!}")
+end
+begin
+  require 'inline_attachment'
+rescue LoadError
+  $log.warn("Error loading inline_attachment #{$!}")
+end
+
+require 'awesome_email_fix' 
 
 ActionView::Helpers::AssetTagHelper.register_javascript_include_default(
   "prototype","effects","dragdrop","controls","application")
@@ -32,6 +41,8 @@ begin
   alois_conn = Connection.new(attr)
   alois_conn.pool = ActiveRecord::Base.connection_pool
   Connection.register(alois_conn)
+rescue LoadError
+  $log.warn("Could not load alois connection: #{alois_conn}")
 rescue
   $log.warn("Could not load alois connection: #{alois_conn}")
 end

Modified: incubator/alois/trunk/prisma/bin/prisma
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/prisma/bin/prisma?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/prisma/bin/prisma (original)
+++ incubator/alois/trunk/prisma/bin/prisma Fri Nov  5 14:10:53 2010
@@ -1,4 +1,5 @@
 #! /usr/bin/ruby1.8
+require "rubygems"
 require "libisi"
 init_libisi
 

Modified: incubator/alois/trunk/prisma/lib/prisma/database.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/prisma/lib/prisma/database.rb?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/prisma/lib/prisma/database.rb (original)
+++ incubator/alois/trunk/prisma/lib/prisma/database.rb Fri Nov  5 14:10:53 2010
@@ -132,8 +132,8 @@ module Prisma
     def self.schema(db_name)
       self.data_path + "#{db_name}_database/schema.rb"
     end
-    def self.schema_load(db_name)
-      with_db(db_name) {
+    def self.schema_load(db_name, options = {})
+      with_db(db_name, options) {
         load(schema(db_name).to_s)
       }
     end

Modified: incubator/alois/trunk/rails/Rakefile
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/Rakefile?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/rails/Rakefile (original)
+++ incubator/alois/trunk/rails/Rakefile Fri Nov  5 14:10:53 2010
@@ -1,5 +1,6 @@
 # Add your own tasks in files placed in lib/tasks ending in .rake,
 # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+require "rubygems"
 require "libisi"
 init_libisi(:ui => "console")
 

Modified: incubator/alois/trunk/rails/app/models/connection.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/app/models/connection.rb?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/rails/app/models/connection.rb (original)
+++ incubator/alois/trunk/rails/app/models/connection.rb Fri Nov  5 14:10:53 2010
@@ -103,7 +103,9 @@ class Connection < ActiveRecord::Base
   #   execute("flush tables")
   # end
   def approx_count(table_name)
-    connection_approx_count(activerecord_connection, table_name)
+    c = activerecord_connection
+    ActiveRecord::Base.connection_approx_count(activerecord_connection, table_name) or
+      c.select_value("SELECT count(*) from #{c.quote_table_name(table_name)}")    	
   end
   
   def current_queries

Modified: incubator/alois/trunk/rails/app/views/survey/_data_table.rhtml
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/app/views/survey/_data_table.rhtml?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/rails/app/views/survey/_data_table.rhtml (original)
+++ incubator/alois/trunk/rails/app/views/survey/_data_table.rhtml Fri Nov  5 14:10:53 2010
@@ -51,7 +51,7 @@
 				:action => 'add_condition', 
 				:column => column.name, 
 				:operator => '!=',
-				:value => record.send("#{column.name}_before_type_cast"), 
+				:value => record[column.name], 
 				:state_id => @state_id},
 			:before => "table_reload()",
 			:loaded => 'update_table()'  %>
@@ -62,7 +62,7 @@
 				:action => 'add_condition', 
 				:column => column.name, 
 				:operator => '=', 
-				:value => record.send("#{column.name}_before_type_cast"), 
+				:value => record[column.name], 
 				:state_id => @state_id},
 			:before => "table_reload()",
 			:loaded => 'update_table()'  %>

Modified: incubator/alois/trunk/rails/app/views/tablelist/index.rhtml
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/app/views/tablelist/index.rhtml?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/rails/app/views/tablelist/index.rhtml (original)
+++ incubator/alois/trunk/rails/app/views/tablelist/index.rhtml Fri Nov  5 14:10:53 2010
@@ -6,25 +6,31 @@
     <th class="form_header">Name</th>
     <th class="form_header">Beschreibung</th>
   </tr>
-<% for name, type in {"Log Tables" => :meta, "Raw Logs" => :raw, "Log Queue" =>
:message} %>
+<% Connection.connections.each {|connection_name, @connection| %>
   <tr>
-    <th colspan="2" style="text-align: left"><%=h name %></th>
+    <th colspan="2" style="text-align: left"><%=h @connection.name %></th>
   </tr>
-    <% for klass in Prisma::Database.get_classes(type).sort{ |x,y| ((x.name <=>
y.name) == 0) ? x.description <=> y.description : x.name <=> y.name } %>
+    <% for table in @connection.activerecord_connection.tables %>
       <tr>
         <td>
-          <%= link_to( h( klass.name ), :controller => 'survey', :table=> klass.table_name)
%>
-          <span style='font-weight: bold'>(<span id='count_<%=h klass.table_name
%>' align='right'><%= klass.approx_count %></span>)</span>
+          <%= link_to( h( table ), :controller => 'survey', :table=> table) %>
+          <span style='font-weight: bold'>(<span id='count_<%=h table %>'
align='right'><%= @connection.approx_count(table) %></span>)</span>
         </td>
-        <td><%=h klass.description %></td>
+        <td><%=
+begin
+  h(Prisma::Database.get_class_from_tablename(table).description)
+rescue
+""
+end
+%></td>
       </tr>
 
       <script type="text/javascript">
-      <%= remote_function(:update => 'count_' + klass.table_name, :url => {:action
=> 'count', :params => {:table_name => klass.table_name} }) %>
+      <%#= remote_function(:update => 'count_' + table, :url => {:action => 'count',
:params => {:table_name => table} }) %>
       </script>
       
-      <%= periodically_call_remote(:update => 'count_' + klass.table_name, :frequency
=> 300, :url => {:action => 'count', :params => {:table_name => klass.table_name}
}) %>
+      <%#= periodically_call_remote(:update => 'count_' + table, :frequency => 300,
:url => {:action => 'count', :params => {:table_name => table} }) %>
     <% end %>
-<% end %>
+<% } %>
   </table>
 </div>
\ No newline at end of file

Modified: incubator/alois/trunk/rails/script/compile_java
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/script/compile_java?rev=1031571&r1=1031570&r2=1031571&view=diff
==============================================================================
--- incubator/alois/trunk/rails/script/compile_java (original)
+++ incubator/alois/trunk/rails/script/compile_java Fri Nov  5 14:10:53 2010
@@ -1,4 +1,5 @@
 #!/usr/bin/ruby
+require 'rubygems'
 require 'libisi'
 init_libisi
 optparse



Mime
View raw message