incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quellho...@apache.org
Subject svn commit: r449142 [25/31] - in /incubator/heraldry: idp/ idp/pip/ idp/pip/branches/ idp/pip/tags/ idp/pip/trunk/ idp/pip/trunk/app/ idp/pip/trunk/app/controllers/ idp/pip/trunk/app/helpers/ idp/pip/trunk/app/models/ idp/pip/trunk/app/views/ idp/pip/t...
Date Sat, 23 Sep 2006 01:37:43 GMT
Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/globalize/generators/globalize/USAGE
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/globalize/generators/globalize/USAGE?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/globalize/generators/globalize/USAGE (added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/globalize/generators/globalize/USAGE Fri
Sep 22 18:37:26 2006
@@ -0,0 +1,10 @@
+Description:
+    Generates a new migration that creates and populates the "globalize" db tables.
+    All tables are prefixed with "globalize_", so they won't conflict with 
+    other application tables. Run 'rake migrate' afterwards to synch the db.
+
+Example:
+    ./script/generate globalize
+
+    This will create:
+	db/migrate/xxx_globalize.rb
\ No newline at end of file

Added: incubator/heraldry/idp/pip/trunk/vendor/plugins/globalize/generators/globalize/globalize_generator.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/vendor/plugins/globalize/generators/globalize/globalize_generator.rb?view=auto&rev=449142
==============================================================================
--- incubator/heraldry/idp/pip/trunk/vendor/plugins/globalize/generators/globalize/globalize_generator.rb
(added)
+++ incubator/heraldry/idp/pip/trunk/vendor/plugins/globalize/generators/globalize/globalize_generator.rb
Fri Sep 22 18:37:26 2006
@@ -0,0 +1,42 @@
+require 'zlib'
+require 'pathname'
+
+class GlobalizeGenerator < MigrationGenerator
+  def initialize(runtime_args, runtime_options = {})
+    arg = runtime_args.first
+    @tiny = arg && arg.downcase == 'tiny'
+    super([ "globalize_migration" ] + runtime_args, runtime_options)
+  end
+
+  def banner
+    "Usage: script/generate globalize [tiny]\n" +
+    '  Specify "tiny" to generate a compact version of the data files (major languages only).'
+  end
+
+  def inflate_schema
+    deflated_name = @tiny ? 'tiny_migration.rb.gz' : 'migration.rb.gz'
+    inflated_path = source_path('migration.rb')
+    deflated_path = source_path(deflated_name)
+
+    return if File.exist?(inflated_path) && !File.exist?(deflated_path)
+    return if !File.exist?(deflated_path)
+
+    File.open(inflated_path, 'w') do |f|
+      Zlib::GzipReader.open(deflated_path) do |gzip|
+        gzip.each do |line|
+          line.chomp!
+          f.puts line
+        end
+      end
+    end
+  end
+
+  def manifest
+    record do |m|
+      m.directory 'db/migrate'
+      m.inflate_schema
+      m.migration_template 'migration.rb', 'db/migrate'
+    end
+  end
+end
+



Mime
View raw message