Skip to content
This repository
Browse code

Add task to create .zip file that can be unpacked and run on windows

  • Loading branch information...
commit b02b537b2186db03e10716255074b73491647b58 1 parent 64f5775
Dan Lucraft authored March 31, 2012
2  .gitignore
@@ -45,3 +45,5 @@ vendor/plugin_manager
45 45
 vendor/ruby-blockcache
46 46
 vendor/swt
47 47
 vendor/jruby-complete.jar
  48
+vendor/redcar-xulrunner-win
  49
+vendor/zip
1  CHANGES
@@ -3,6 +3,7 @@ Version 0.14 (TBA)
3 3
 ================================
4 4
 
5 5
  * Add a basic, context menu-based bundle and snippet editor to Snippet Browser (Delisa Mason)
  6
+ * Fix a bug in the Lucene plugin that was causing Redcar to hold files open (Dan Lucraft)
6 7
  * OSX platform application bundle (Dan Lucraft)
7 8
  * The line number gutter is coloured like the current theme (Delisa Mason)
8 9
 
45  Rakefile
@@ -21,7 +21,8 @@ end
21 21
 
22 22
 desc "Download dependencies"
23 23
 task :init do
24  
-  sh("curl -L #{JRUBY_JAR_LOCATION} > vendor/jruby-complete.jar")
  24
+  vendor = REDCAR_ROOT + "/vendor"
  25
+  sh("curl -L #{JRUBY_JAR_LOCATION} > #{vendor}/jruby-complete.jar")
25 26
 
26 27
   gems = ["git",
27 28
 #            "spoon",
@@ -30,13 +31,16 @@ task :init do
30 31
           "ruby-blockcache",
31 32
           "bouncy-castle-java",
32 33
           "swt",
33  
-          "plugin_manager"]#, ">= 1.5")
  34
+          "plugin_manager",
  35
+          "redcar-xulrunner-win",
  36
+          "zip"
  37
+          ]#, ">= 1.5")
34 38
   gems.each do |gem_name|
35 39
     puts "fetching #{gem_name}"
36 40
     data = JSON.parse(Net::HTTP.get(URI.parse("http://rubygems.org/api/v1/gems/#{gem_name}.json")))
37  
-    gem_file = "vendor/#{gem_name}-#{data["version"]}.gem" 
  41
+    gem_file = "#{vendor}/#{gem_name}-#{data["version"]}.gem" 
38 42
     sh("curl -L #{data["gem_uri"]} > #{gem_file}")
39  
-    gem_dir = "vendor/#{gem_name}"
  43
+    gem_dir = "#{vendor}/#{gem_name}"
40 44
     rm_rf(gem_dir)
41 45
     mkdir_p(gem_dir)
42 46
     sh("tar xzv -C #{gem_dir} -f #{gem_file}")
@@ -44,10 +48,22 @@ task :init do
44 48
     sh("tar xzv -C #{gem_dir} -f #{gem_dir}/data.tar.gz")
45 49
     rm("#{gem_dir}/data.tar.gz")
46 50
   end
  51
+  sh("cd #{vendor}/redcar-xulrunner-win/vendor; unzip xulrunner*.zip; cd ../../../")
47 52
 end  
48 53
 
49 54
 namespace :installers do
50  
-
  55
+  desc "Package for Windows"
  56
+  task :win do
  57
+    win_dir = REDCAR_ROOT + "/pkg/win"
  58
+    rm_f(win_dir)
  59
+    mkdir_p(win_dir)
  60
+    mkdir_p(win_dir)
  61
+    copy_all(win_dir)
  62
+    cp(REDCAR_ROOT + "/assets/redcar_win.bat", win_dir + "/redcar.bat")
  63
+    chmod(0755, "#{win_dir}/redcar.bat")
  64
+    sh("cd pkg/win; zip -r redcar-#{REDCAR_VERSION}.zip *; cd ../../; mv pkg/win/redcar-#{REDCAR_VERSION}.zip pkg/")
  65
+  end
  66
+  
51 67
   desc "Generate a debian package (uses fpm)"
52 68
   task :deb do
53 69
     deb_dir = REDCAR_ROOT + "/pkg/deb"
@@ -103,10 +119,23 @@ XML
103 119
   end
104 120
   
105 121
   def copy_all(target)
106  
-    exclude = [/pkg/, /spec/, /\.git/, /\.redcar/, /\.gemspec/, /\.yardoc/]
107  
-    Dir[REDCAR_ROOT + "/*"].each do |item|
  122
+    exclude = [/pkg/, /spec/, /\.git/, /\.redcar/, /\.gemspec/, /\.yardoc/, /doc/]
  123
+    Dir.glob(REDCAR_ROOT + "/*").each do |item|
108 124
       unless exclude.any? {|re| re =~ item}
109  
-        cp_r(item, target)
  125
+        sh("cp -r #{item} #{target}")
  126
+      end
  127
+    end
  128
+    clean(target)
  129
+  end
  130
+  
  131
+  def clean(target)
  132
+    Dir.glob(target + "/*", File::FNM_DOTMATCH).each do |item|
  133
+      next if [".", ".."].include?(File.basename(item))
  134
+      if [".redcar", ".DS_Store"].include? File.basename(item) or
  135
+          File.symlink?(item)
  136
+        rm_rf(item)
  137
+      elsif File.directory?(item)
  138
+        clean(item)
110 139
       end
111 140
     end
112 141
   end
1  assets/redcar_win.bat
... ...
@@ -0,0 +1 @@
  1
+start java -Dfile.encoding=UTF8 -classpath vendor\jruby-complete.jar org.jruby.Main bin\redcar --no-sub-jruby
8  plugins/application_swt/lib/application_swt/html_tab.rb
@@ -66,11 +66,9 @@ def add_listeners
66 66
       end
67 67
       
68 68
       def self.windows_xulrunner_path
69  
-        begin
70  
-          require 'redcar-xulrunner-win'
71  
-        rescue LoadError => e
72  
-          raise "Missing xulrunner browser widget, install gem redcar-xulrunner-win."
73  
-        end
  69
+        $:.push(File.expand_path("../../../../../vendor/zip/lib", __FILE__))
  70
+        $:.push(File.expand_path("../../../../../vendor/redcar-xulrunner-win/lib", __FILE__))
  71
+        require 'redcar-xulrunner-win'
74 72
         Redcar::XulrunnerWin.ensure_unpacked
75 73
         Redcar::XulrunnerWin.path
76 74
       end

0 notes on commit b02b537

Please sign in to comment.
Something went wrong with that request. Please try again.