Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 1021

Show
Ignore:
Timestamp:
03/27/05 13:33:54 (3 years ago)
Author:
david
Message:

Made ready for better release automation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionmailer/Rakefile

    r976 r1021  
    1212PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" 
    1313 
     14RELEASE_NAME  = "REL #{PKG_VERSION}" 
     15 
     16RUBY_FORGE_PROJECT = "actionmailer" 
     17RUBY_FORGE_USER    = "webster132" 
     18 
    1419desc "Default Task" 
    1520task :default => [ :test ] 
    1621 
    1722# Run the unit tests 
    18  
    1923Rake::TestTask.new { |t| 
    2024  t.libs << "test" 
     
    2529 
    2630# Genereate the RDoc documentation 
    27  
    2831Rake::RDocTask.new { |rdoc| 
    2932  rdoc.rdoc_dir = 'doc' 
     
    3740 
    3841# Create compressed packages 
    39  
    40  
    4142spec = Gem::Specification.new do |s| 
    4243  s.platform = Gem::Platform::RUBY 
     
    7071 
    7172 
    72 # Publish beta gem 
    7373desc "Publish the API documentation" 
    7474task :pgem => [:package] do  
     
    7676end 
    7777 
    78 # Publish documentation 
    7978desc "Publish the API documentation" 
    8079task :pdoc => [:rdoc] do  
     
    8281end 
    8382 
    84 desc "Publish to RubyForge" 
    85 task :rubyforge do 
    86     Rake::RubyForgePublisher.new('actionmailer', 'webster132').upload 
     83desc "Publish the release files to RubyForge." 
     84task :release => [:package] do 
     85  files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" } 
     86 
     87  if RUBY_FORGE_PROJECT then 
     88    require 'net/http' 
     89    require 'open-uri' 
     90 
     91    project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/" 
     92    project_data = open(project_uri) { |data| data.read } 
     93    group_id = project_data[/[?&]group_id=(\d+)/, 1] 
     94    raise "Couldn't get group id" unless group_id 
     95 
     96    # This echos password to shell which is a bit sucky 
     97    if ENV["RUBY_FORGE_PASSWORD"] 
     98      password = ENV["RUBY_FORGE_PASSWORD"] 
     99    else 
     100      print "#{RUBY_FORGE_USER}@rubyforge.org's password: " 
     101      password = STDIN.gets.chomp 
     102    end 
     103 
     104    login_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     105      data = [ 
     106        "login=1", 
     107        "form_loginname=#{RUBY_FORGE_USER}", 
     108        "form_pw=#{password}" 
     109      ].join("&") 
     110      http.post("/account/login.php", data) 
     111    end 
     112 
     113    cookie = login_response["set-cookie"] 
     114    raise "Login failed" unless cookie 
     115    headers = { "Cookie" => cookie } 
     116 
     117    release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}" 
     118    release_data = open(release_uri, headers) { |data| data.read } 
     119    package_id = release_data[/[?&]package_id=(\d+)/, 1] 
     120    raise "Couldn't get package id" unless package_id 
     121 
     122    first_file = true 
     123    release_id = "" 
     124 
     125    files.each do |filename| 
     126      basename  = File.basename(filename) 
     127      file_ext  = File.extname(filename) 
     128      file_data = File.open(filename, "rb") { |file| file.read } 
     129 
     130      puts "Releasing #{basename}..." 
     131 
     132      release_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     133        release_date = Time.now.strftime("%Y-%m-%d %H:%M") 
     134        type_map = { 
     135          ".zip"    => "3000", 
     136          ".tgz"    => "3110", 
     137          ".gz"     => "3110", 
     138          ".gem"    => "1400" 
     139        }; type_map.default = "9999" 
     140        type = type_map[file_ext] 
     141        boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor" 
     142 
     143        query_hash = if first_file then 
     144          { 
     145            "group_id" => group_id, 
     146            "package_id" => package_id, 
     147            "release_name" => RELEASE_NAME, 
     148            "release_date" => release_date, 
     149            "type_id" => type, 
     150            "processor_id" => "8000", # Any 
     151            "release_notes" => "", 
     152            "release_changes" => "", 
     153            "preformatted" => "1", 
     154            "submit" => "1" 
     155          } 
     156        else 
     157          { 
     158            "group_id" => group_id, 
     159            "release_id" => release_id, 
     160            "package_id" => package_id, 
     161            "step2" => "1", 
     162            "type_id" => type, 
     163            "processor_id" => "8000", # Any 
     164            "submit" => "Add This File" 
     165          } 
     166        end 
     167 
     168        query = "?" + query_hash.map do |(name, value)| 
     169          [name, URI.encode(value)].join("=") 
     170        end.join("&") 
     171 
     172        data = [ 
     173          "--" + boundary, 
     174          "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"", 
     175          "Content-Type: application/octet-stream", 
     176          "Content-Transfer-Encoding: binary", 
     177          "", file_data, "" 
     178          ].join("\x0D\x0A") 
     179 
     180        release_headers = headers.merge( 
     181          "Content-Type" => "multipart/form-data; boundary=#{boundary}" 
     182        ) 
     183 
     184        target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php" 
     185        http.post(target + query, data, release_headers) 
     186      end 
     187 
     188      if first_file then 
     189        release_id = release_response.body[/release_id=(\d+)/, 1] 
     190        raise("Couldn't get release id") unless release_id 
     191      end 
     192 
     193      first_file = false 
     194    end 
     195  end 
    87196end 
    88  
    89  
    90 desc "Count lines in the main rake file" 
    91 task :lines do 
    92   lines = 0 
    93   codelines = 0 
    94   Dir.foreach("lib/action_mailer") { |file_name|  
    95     next unless file_name =~ /.*rb/ 
    96      
    97     f = File.open("lib/action_mailer/" + file_name) 
    98  
    99     while line = f.gets 
    100       lines += 1 
    101       next if line =~ /^\s*$/ 
    102       next if line =~ /^\s*#/ 
    103       codelines += 1 
    104     end 
    105   } 
    106   puts "Lines #{lines}, LOC #{codelines}" 
    107 end 
  • trunk/actionpack/Rakefile

    r976 r1021  
    1111PKG_VERSION   = '1.6.0' + PKG_BUILD 
    1212PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" 
     13 
     14RELEASE_NAME  = "REL #{PKG_VERSION}" 
     15 
     16RUBY_FORGE_PROJECT = "actionpack" 
     17RUBY_FORGE_USER    = "webster132" 
    1318 
    1419desc "Default Task" 
     
    3944 
    4045# Create compressed packages 
    41  
    42  
    4346dist_dirs = [ "lib", "test", "examples" ] 
    4447 
     
    7881 
    7982 
    80 # Publish beta gem 
     83# Publishing ------------------------------------------------------ 
     84 
    8185desc "Publish the API documentation" 
    8286task :pgem => [:package] do  
     
    8589end 
    8690 
    87 # Publish documentation 
    8891desc "Publish the API documentation" 
    8992task :pdoc => [:rdoc] do  
     
    9194end 
    9295 
    93  
    94 desc "Count lines in the main rake file" 
    95 task :lines do 
    96   lines = 0 
    97   codelines = 0 
    98   Dir.foreach("lib/action_controller") { |file_name|  
    99     next unless file_name =~ /.*rb/ 
    100      
    101     f = File.open("lib/action_controller/" + file_name) 
    102  
    103     while line = f.gets 
    104       lines += 1 
    105       next if line =~ /^\s*$/ 
    106       next if line =~ /^\s*#/ 
    107       codelines += 1 
     96desc "Publish the release files to RubyForge." 
     97task :release => [:package] do 
     98  files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" } 
     99 
     100  if RUBY_FORGE_PROJECT then 
     101    require 'net/http' 
     102    require 'open-uri' 
     103 
     104    project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/" 
     105    project_data = open(project_uri) { |data| data.read } 
     106    group_id = project_data[/[?&]group_id=(\d+)/, 1] 
     107    raise "Couldn't get group id" unless group_id 
     108 
     109    # This echos password to shell which is a bit sucky 
     110    if ENV["RUBY_FORGE_PASSWORD"] 
     111      password = ENV["RUBY_FORGE_PASSWORD"] 
     112    else 
     113      print "#{RUBY_FORGE_USER}@rubyforge.org's password: " 
     114      password = STDIN.gets.chomp 
    108115    end 
    109   } 
    110   puts "Lines #{lines}, LOC #{codelines}" 
    111 end 
     116 
     117    login_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     118      data = [ 
     119        "login=1", 
     120        "form_loginname=#{RUBY_FORGE_USER}", 
     121        "form_pw=#{password}" 
     122      ].join("&") 
     123      http.post("/account/login.php", data) 
     124    end 
     125 
     126    cookie = login_response["set-cookie"] 
     127    raise "Login failed" unless cookie 
     128    headers = { "Cookie" => cookie } 
     129 
     130    release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}" 
     131    release_data = open(release_uri, headers) { |data| data.read } 
     132    package_id = release_data[/[?&]package_id=(\d+)/, 1] 
     133    raise "Couldn't get package id" unless package_id 
     134 
     135    first_file = true 
     136    release_id = "" 
     137 
     138    files.each do |filename| 
     139      basename  = File.basename(filename) 
     140      file_ext  = File.extname(filename) 
     141      file_data = File.open(filename, "rb") { |file| file.read } 
     142 
     143      puts "Releasing #{basename}..." 
     144 
     145      release_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     146        release_date = Time.now.strftime("%Y-%m-%d %H:%M") 
     147        type_map = { 
     148          ".zip"    => "3000", 
     149          ".tgz"    => "3110", 
     150          ".gz"     => "3110", 
     151          ".gem"    => "1400" 
     152        }; type_map.default = "9999" 
     153        type = type_map[file_ext] 
     154        boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor" 
     155 
     156        query_hash = if first_file then 
     157          { 
     158            "group_id" => group_id, 
     159            "package_id" => package_id, 
     160            "release_name" => RELEASE_NAME, 
     161            "release_date" => release_date, 
     162            "type_id" => type, 
     163            "processor_id" => "8000", # Any 
     164            "release_notes" => "", 
     165            "release_changes" => "", 
     166            "preformatted" => "1", 
     167            "submit" => "1" 
     168          } 
     169        else 
     170          { 
     171            "group_id" => group_id, 
     172            "release_id" => release_id, 
     173            "package_id" => package_id, 
     174            "step2" => "1", 
     175            "type_id" => type, 
     176            "processor_id" => "8000", # Any 
     177            "submit" => "Add This File" 
     178          } 
     179        end 
     180 
     181        query = "?" + query_hash.map do |(name, value)| 
     182          [name, URI.encode(value)].join("=") 
     183        end.join("&") 
     184 
     185        data = [ 
     186          "--" + boundary, 
     187          "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"", 
     188          "Content-Type: application/octet-stream", 
     189          "Content-Transfer-Encoding: binary", 
     190          "", file_data, "" 
     191          ].join("\x0D\x0A") 
     192 
     193        release_headers = headers.merge( 
     194          "Content-Type" => "multipart/form-data; boundary=#{boundary}" 
     195        ) 
     196 
     197        target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php" 
     198        http.post(target + query, data, release_headers) 
     199      end 
     200 
     201      if first_file then 
     202        release_id = release_response.body[/release_id=(\d+)/, 1] 
     203        raise("Couldn't get release id") unless release_id 
     204      end 
     205 
     206      first_file = false 
     207    end 
     208  end 
     209end 
  • trunk/actionwebservice/Rakefile

    r976 r1021  
    1313PKG_FILE_NAME   = "#{PKG_NAME}-#{PKG_VERSION}" 
    1414PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}" 
     15 
     16RELEASE_NAME  = "REL #{PKG_VERSION}" 
     17 
     18RUBY_FORGE_PROJECT = "aws" 
     19RUBY_FORGE_USER    = "webster132" 
    1520 
    1621desc "Default Task" 
     
    145150  puts "  Lines #{total_lines}, LOC #{total_loc}" 
    146151end 
     152 
     153desc "Publish the release files to RubyForge." 
     154task :release => [:package] do 
     155  files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" } 
     156 
     157  if RUBY_FORGE_PROJECT then 
     158    require 'net/http' 
     159    require 'open-uri' 
     160 
     161    project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/" 
     162    project_data = open(project_uri) { |data| data.read } 
     163    group_id = project_data[/[?&]group_id=(\d+)/, 1] 
     164    raise "Couldn't get group id" unless group_id 
     165 
     166    # This echos password to shell which is a bit sucky 
     167    if ENV["RUBY_FORGE_PASSWORD"] 
     168      password = ENV["RUBY_FORGE_PASSWORD"] 
     169    else 
     170      print "#{RUBY_FORGE_USER}@rubyforge.org's password: " 
     171      password = STDIN.gets.chomp 
     172    end 
     173 
     174    login_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     175      data = [ 
     176        "login=1", 
     177        "form_loginname=#{RUBY_FORGE_USER}", 
     178        "form_pw=#{password}" 
     179      ].join("&") 
     180      http.post("/account/login.php", data) 
     181    end 
     182 
     183    cookie = login_response["set-cookie"] 
     184    raise "Login failed" unless cookie 
     185    headers = { "Cookie" => cookie } 
     186 
     187    release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}" 
     188    release_data = open(release_uri, headers) { |data| data.read } 
     189    package_id = release_data[/[?&]package_id=(\d+)/, 1] 
     190    raise "Couldn't get package id" unless package_id 
     191 
     192    first_file = true 
     193    release_id = "" 
     194 
     195    files.each do |filename| 
     196      basename  = File.basename(filename) 
     197      file_ext  = File.extname(filename) 
     198      file_data = File.open(filename, "rb") { |file| file.read } 
     199 
     200      puts "Releasing #{basename}..." 
     201 
     202      release_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     203        release_date = Time.now.strftime("%Y-%m-%d %H:%M") 
     204        type_map = { 
     205          ".zip"    => "3000", 
     206          ".tgz"    => "3110", 
     207          ".gz"     => "3110", 
     208          ".gem"    => "1400" 
     209        }; type_map.default = "9999" 
     210        type = type_map[file_ext] 
     211        boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor" 
     212 
     213        query_hash = if first_file then 
     214          { 
     215            "group_id" => group_id, 
     216            "package_id" => package_id, 
     217            "release_name" => RELEASE_NAME, 
     218            "release_date" => release_date, 
     219            "type_id" => type, 
     220            "processor_id" => "8000", # Any 
     221            "release_notes" => "", 
     222            "release_changes" => "", 
     223            "preformatted" => "1", 
     224            "submit" => "1" 
     225          } 
     226        else 
     227          { 
     228            "group_id" => group_id, 
     229            "release_id" => release_id, 
     230            "package_id" => package_id, 
     231            "step2" => "1", 
     232            "type_id" => type, 
     233            "processor_id" => "8000", # Any 
     234            "submit" => "Add This File" 
     235          } 
     236        end 
     237 
     238        query = "?" + query_hash.map do |(name, value)| 
     239          [name, URI.encode(value)].join("=") 
     240        end.join("&") 
     241 
     242        data = [ 
     243          "--" + boundary, 
     244          "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"", 
     245          "Content-Type: application/octet-stream", 
     246          "Content-Transfer-Encoding: binary", 
     247          "", file_data, "" 
     248          ].join("\x0D\x0A") 
     249 
     250        release_headers = headers.merge( 
     251          "Content-Type" => "multipart/form-data; boundary=#{boundary}" 
     252        ) 
     253 
     254        target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php" 
     255        http.post(target + query, data, release_headers) 
     256      end 
     257 
     258      if first_file then 
     259        release_id = release_response.body[/release_id=(\d+)/, 1] 
     260        raise("Couldn't get release id") unless release_id 
     261      end 
     262 
     263      first_file = false 
     264    end 
     265  end 
     266end 
  • trunk/activerecord/Rakefile

    r976 r1021  
    1111PKG_VERSION   = '1.9.0' + PKG_BUILD 
    1212PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" 
     13 
     14RELEASE_NAME  = "REL #{PKG_VERSION}" 
     15 
     16RUBY_FORGE_PROJECT = "activerecord" 
     17RUBY_FORGE_USER    = "webster132" 
    1318 
    1419PKG_FILES = FileList[ 
     
    8994 
    9095 
    91 # Publish beta gem 
    92 desc "Publish the beta gem" 
    93 task :pgem => [:package] do  
    94   Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload 
    95   `ssh davidhh@comox.textdrive.com './gemupdate.sh'` 
    96 end 
    97  
    98 # Publish documentation 
    99 desc "Publish the API documentation" 
    100 task :pdoc => [:rdoc] do  
    101   Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/ar", "doc").upload 
    102 end 
    103  
    104  
    10596# Create compressed packages 
    10697 
     
    144135 
    145136 
    146 task :lines do 
    147   lines = 0 
    148   codelines = 0 
    149   Dir.foreach("lib/active_record") { |file_name|  
    150     next unless file_name =~ /.*rb/ 
    151      
    152     f = File.open("lib/active_record/" + file_name) 
    153  
    154     while line = f.gets 
    155       lines += 1 
    156       next if line =~ /^\s*$/ 
    157       next if line =~ /^\s*#/ 
    158       codelines += 1 
     137# Publishing ------------------------------------------------------ 
     138 
     139desc "Publish the beta gem" 
     140task :pgem => [:package] do  
     141  Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload 
     142  `ssh davidhh@comox.textdrive.com './gemupdate.sh'` 
     143end 
     144 
     145desc "Publish the API documentation" 
     146task :pdoc => [:rdoc] do  
     147  Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/ar", "doc").upload 
     148end 
     149 
     150desc "Publish the release files to RubyForge." 
     151task :release => [:package] do 
     152  files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" } 
     153 
     154  if RUBY_FORGE_PROJECT then 
     155    require 'net/http' 
     156    require 'open-uri' 
     157 
     158    project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/" 
     159    project_data = open(project_uri) { |data| data.read } 
     160    group_id = project_data[/[?&]group_id=(\d+)/, 1] 
     161    raise "Couldn't get group id" unless group_id 
     162 
     163    # This echos password to shell which is a bit sucky 
     164    if ENV["RUBY_FORGE_PASSWORD"] 
     165      password = ENV["RUBY_FORGE_PASSWORD"] 
     166    else 
     167      print "#{RUBY_FORGE_USER}@rubyforge.org's password: " 
     168      password = STDIN.gets.chomp 
    159169    end 
    160   } 
    161   puts "Lines #{lines}, LOC #{codelines}" 
    162 end 
     170 
     171    login_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     172      data = [ 
     173        "login=1", 
     174        "form_loginname=#{RUBY_FORGE_USER}", 
     175        "form_pw=#{password}" 
     176      ].join("&") 
     177      http.post("/account/login.php", data) 
     178    end 
     179 
     180    cookie = login_response["set-cookie"] 
     181    raise "Login failed" unless cookie 
     182    headers = { "Cookie" => cookie } 
     183 
     184    release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}" 
     185    release_data = open(release_uri, headers) { |data| data.read } 
     186    package_id = release_data[/[?&]package_id=(\d+)/, 1] 
     187    raise "Couldn't get package id" unless package_id 
     188 
     189    first_file = true 
     190    release_id = "" 
     191 
     192    files.each do |filename| 
     193      basename  = File.basename(filename) 
     194      file_ext  = File.extname(filename) 
     195      file_data = File.open(filename, "rb") { |file| file.read } 
     196 
     197      puts "Releasing #{basename}..." 
     198 
     199      release_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     200        release_date = Time.now.strftime("%Y-%m-%d %H:%M") 
     201        type_map = { 
     202          ".zip"    => "3000", 
     203          ".tgz"    => "3110", 
     204          ".gz"     => "3110", 
     205          ".gem"    => "1400" 
     206        }; type_map.default = "9999" 
     207        type = type_map[file_ext] 
     208        boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor" 
     209 
     210        query_hash = if first_file then 
     211          { 
     212            "group_id" => group_id, 
     213            "package_id" => package_id, 
     214            "release_name" => RELEASE_NAME, 
     215            "release_date" => release_date, 
     216            "type_id" => type, 
     217            "processor_id" => "8000", # Any 
     218            "release_notes" => "", 
     219            "release_changes" => "", 
     220            "preformatted" => "1", 
     221            "submit" => "1" 
     222          } 
     223        else 
     224          { 
     225            "group_id" => group_id, 
     226            "release_id" => release_id, 
     227            "package_id" => package_id, 
     228            "step2" => "1", 
     229            "type_id" => type, 
     230            "processor_id" => "8000", # Any 
     231            "submit" => "Add This File" 
     232          } 
     233        end 
     234 
     235        query = "?" + query_hash.map do |(name, value)| 
     236          [name, URI.encode(value)].join("=") 
     237        end.join("&") 
     238 
     239        data = [ 
     240          "--" + boundary, 
     241          "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"", 
     242          "Content-Type: application/octet-stream", 
     243          "Content-Transfer-Encoding: binary", 
     244          "", file_data, "" 
     245          ].join("\x0D\x0A") 
     246 
     247        release_headers = headers.merge( 
     248          "Content-Type" => "multipart/form-data; boundary=#{boundary}" 
     249        ) 
     250 
     251        target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php" 
     252        http.post(target + query, data, release_headers) 
     253      end 
     254 
     255      if first_file then 
     256        release_id = release_response.body[/release_id=(\d+)/, 1] 
     257        raise("Couldn't get release id") unless release_id 
     258      end 
     259 
     260      first_file = false 
     261    end 
     262  end 
     263end 
  • trunk/activesupport/Rakefile

    r976 r1021  
    88PKG_VERSION   = '1.0.2' + PKG_BUILD 
    99PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" 
     10 
     11RELEASE_NAME  = "REL #{PKG_VERSION}" 
     12 
     13RUBY_FORGE_PROJECT = "activesupport" 
     14RUBY_FORGE_USER    = "webster132" 
    1015 
    1116task :default => :test 
     
    5156end 
    5257 
    53 # Publish beta gem   
    5458desc "Publish the beta gem" 
    5559task :pgem => [:package] do 
     
    5862end 
    5963 
    60 # Publish documentation 
    6164desc "Publish the API documentation" 
    6265task :pdoc => [:rdoc] do  
    6366  Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/as", "doc").upload 
    6467end 
     68 
     69desc "Publish the release files to RubyForge." 
     70task :release => [:package] do 
     71  files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" } 
     72 
     73  if RUBY_FORGE_PROJECT then 
     74    require 'net/http' 
     75    require 'open-uri' 
     76 
     77    project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/" 
     78    project_data = open(project_uri) { |data| data.read } 
     79    group_id = project_data[/[?&]group_id=(\d+)/, 1] 
     80    raise "Couldn't get group id" unless group_id 
     81 
     82    # This echos password to shell which is a bit sucky 
     83    if ENV["RUBY_FORGE_PASSWORD"] 
     84      password = ENV["RUBY_FORGE_PASSWORD"] 
     85    else 
     86      print "#{RUBY_FORGE_USER}@rubyforge.org's password: " 
     87      password = STDIN.gets.chomp 
     88    end 
     89 
     90    login_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     91      data = [ 
     92        "login=1", 
     93        "form_loginname=#{RUBY_FORGE_USER}", 
     94        "form_pw=#{password}" 
     95      ].join("&") 
     96      http.post("/account/login.php", data) 
     97    end 
     98 
     99    cookie = login_response["set-cookie"] 
     100    raise "Login failed" unless cookie 
     101    headers = { "Cookie" => cookie } 
     102 
     103    release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}" 
     104    release_data = open(release_uri, headers) { |data| data.read } 
     105    package_id = release_data[/[?&]package_id=(\d+)/, 1] 
     106    raise "Couldn't get package id" unless package_id 
     107 
     108    first_file = true 
     109    release_id = "" 
     110 
     111    files.each do |filename| 
     112      basename  = File.basename(filename) 
     113      file_ext  = File.extname(filename) 
     114      file_data = File.open(filename, "rb") { |file| file.read } 
     115 
     116      puts "Releasing #{basename}..." 
     117 
     118      release_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     119        release_date = Time.now.strftime("%Y-%m-%d %H:%M") 
     120        type_map = { 
     121          ".zip"    => "3000", 
     122          ".tgz"    => "3110", 
     123          ".gz"     => "3110", 
     124          ".gem"    => "1400" 
     125        }; type_map.default = "9999" 
     126        type = type_map[file_ext] 
     127        boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor" 
     128 
     129        query_hash = if first_file then 
     130          { 
     131            "group_id" => group_id, 
     132            "package_id" => package_id, 
     133            "release_name" => RELEASE_NAME, 
     134            "release_date" => release_date, 
     135            "type_id" => type, 
     136            "processor_id" => "8000", # Any 
     137            "release_notes" => "", 
     138            "release_changes" => "", 
     139            "preformatted" => "1", 
     140            "submit" => "1" 
     141          } 
     142        else 
     143          { 
     144            "group_id" => group_id, 
     145            "release_id" => release_id, 
     146            "package_id" => package_id, 
     147            "step2" => "1", 
     148            "type_id" => type, 
     149            "processor_id" => "8000", # Any 
     150            "submit" => "Add This File" 
     151          } 
     152        end 
     153 
     154        query = "?" + query_hash.map do |(name, value)| 
     155          [name, URI.encode(value)].join("=") 
     156        end.join("&") 
     157 
     158        data = [ 
     159          "--" + boundary, 
     160          "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"", 
     161          "Content-Type: application/octet-stream", 
     162          "Content-Transfer-Encoding: binary", 
     163          "", file_data, "" 
     164          ].join("\x0D\x0A") 
     165 
     166        release_headers = headers.merge( 
     167          "Content-Type" => "multipart/form-data; boundary=#{boundary}" 
     168        ) 
     169 
     170        target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php" 
     171        http.post(target + query, data, release_headers) 
     172      end 
     173 
     174      if first_file then 
     175        release_id = release_response.body[/release_id=(\d+)/, 1] 
     176        raise("Couldn't get release id") unless release_id 
     177      end 
     178 
     179      first_file = false 
     180    end 
     181  end 
     182end 
  • trunk/railties/fresh_rakefile

    r978 r1021  
    7272Rake::RDocTask.new("apidoc") { |rdoc| 
    7373  rdoc.rdoc_dir = 'doc/api' 
     74  rdoc.template = 'jamis.rb' if ENV['template'] == 'jamis' 
    7475  rdoc.title    = "Rails Framework Documentation" 
    7576  rdoc.options << '--line-numbers --inline-source' 
     
    9091  rdoc.rdoc_files.include('vendor/rails/actionmailer/lib/action_mailer/base.rb') 
    9192  rdoc.rdoc_files.include('vendor/rails/actionwebservice/README') 
    92   rdoc.rdoc_files.include('vendor/rails/actionwebservice/ChangeLog') 
     93  rdoc.rdoc_files.include('vendor/rails/actionwebservice/CHANGELOG') 
    9394  rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service.rb') 
    9495  rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/*.rb') 
     
    100101  rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/support/*.rb') 
    101102  rdoc.rdoc_files.include('vendor/rails/activesupport/README') 
     103  rdoc.rdoc_files.include('vendor/rails/activesupport/CHANGELOG') 
    102104  rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb') 
    103105} 
  • trunk/railties/Rakefile

    r993 r1021  
    1313PKG_FILE_NAME   = "#{PKG_NAME}-#{PKG_VERSION}" 
    1414PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}" 
     15 
     16RELEASE_NAME  = "REL #{PKG_VERSION}" 
     17 
     18RUBY_FORGE_PROJECT = "rails" 
     19RUBY_FORGE_USER    = "webster132" 
    1520 
    1621 
     
    234239  EOF 
    235240 
    236   s.add_dependency('rake', '>= 0.4.15') 
     241  s.add_dependency('rake', '>= 0.5.0') 
    237242  s.add_dependency('activesupport',    '= 1.0.2' + PKG_BUILD) 
    238243  s.add_dependency('activerecord',     '= 1.9.0' + PKG_BUILD) 
     
    260265end 
    261266 
    262 # Publish beta gem 
     267 
     268# Publishing ------------------------------------------------------- 
    263269desc "Publish the API documentation" 
    264270task :pgem => [:gem] do  
     
    266272  `ssh davidhh@comox.textdrive.com './gemupdate.sh'` 
    267273end 
     274 
     275desc "Publish the release files to RubyForge." 
     276task :release => [:package] do 
     277  files = ["gem"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" } 
     278 
     279  if RUBY_FORGE_PROJECT then 
     280    require 'net/http' 
     281    require 'open-uri' 
     282 
     283    project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/" 
     284    project_data = open(project_uri) { |data| data.read } 
     285    group_id = project_data[/[?&]group_id=(\d+)/, 1] 
     286    raise "Couldn't get group id" unless group_id 
     287 
     288    # This echos password to shell which is a bit sucky 
     289    if ENV["RUBY_FORGE_PASSWORD"] 
     290      password = ENV["RUBY_FORGE_PASSWORD"] 
     291    else 
     292      print "#{RUBY_FORGE_USER}@rubyforge.org's password: " 
     293      password = STDIN.gets.chomp 
     294    end 
     295 
     296    login_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     297      data = [ 
     298        "login=1", 
     299        "form_loginname=#{RUBY_FORGE_USER}", 
     300        "form_pw=#{password}" 
     301      ].join("&") 
     302      http.post("/account/login.php", data) 
     303    end 
     304 
     305    cookie = login_response["set-cookie"] 
     306    raise "Login failed" unless cookie 
     307    headers = { "Cookie" => cookie } 
     308 
     309    release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}" 
     310    release_data = open(release_uri, headers) { |data| data.read } 
     311    package_id = release_data[/[?&]package_id=(\d+)/, 1] 
     312    raise "Couldn't get package id" unless package_id 
     313 
     314    first_file = true 
     315    release_id = "" 
     316 
     317    files.each do |filename| 
     318      basename  = File.basename(filename) 
     319      file_ext  = File.extname(filename) 
     320      file_data = File.open(filename, "rb") { |file| file.read } 
     321 
     322      puts "Releasing #{basename}..." 
     323 
     324      release_response = Net::HTTP.start("rubyforge.org", 80) do |http| 
     325        release_date = Time.now.strftime("%Y-%m-%d %H:%M") 
     326        type_map = { 
     327          ".zip"    => "3000", 
     328          ".tgz"    => "3110", 
     329          ".gz"     => "3110", 
     330          ".gem"    => "1400" 
     331        }; type_map.default = "9999" 
     332        type = type_map[file_ext] 
     333        boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor" 
     334 
     335        query_hash = if first_file then 
     336          { 
     337            "group_id" => group_id, 
     338            "package_id" => package_id, 
     339            "release_name" => RELEASE_NAME, 
     340            "release_date" => release_date, 
     341            "type_id" => type, 
     342            "processor_id" => "8000", # Any 
     343            "release_notes" => "", 
     344            "release_changes" => "", 
     345            "preformatted" => "1", 
     346            "submit" => "1" 
     347          } 
     348        else 
     349          { 
     350            "group_id" => group_id, 
     351            "release_id" => release_id, 
     352            "package_id" => package_id, 
     353            "step2" => "1", 
     354            "type_id" => type, 
     355            "processor_id" => "8000", # Any 
     356            "submit" => "Add This File" 
     357          } 
     358        end 
     359 
     360        query = "?" + query_hash.map do |(name, value)| 
     361          [name, URI.encode(value)].join("=") 
     362        end.join("&") 
     363 
     364        data = [ 
     365          "--" + boundary, 
     366          "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"", 
     367          "Content-Type: application/octet-stream", 
     368          "Content-Transfer-Encoding: binary", 
     369          "", file_data, "" 
     370          ].join("\x0D\x0A") 
     371 
     372        release_headers = headers.merge( 
     373          "Content-Type" => "multipart/form-data; boundary=#{boundary}" 
     374        ) 
     375 
     376        target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php" 
     377        http.post(target + query, data, release_headers) 
     378      end 
     379 
     380      if first_file then 
     381        release_id = release_response.body[/release_id=(\d+)/, 1] 
     382        raise("Couldn't get release id") unless release_id 
     383      end 
     384 
     385      first_file = false 
     386    end 
     387  end 
     388end 
  • trunk/railties/README

    r793 r1021  
    6868== Example for lighttpd conf (with FastCGI) 
    6969 
    70 server.port = 8080 
    71 server.bind = "127.0.0.1" 
    72 # server.event-handler = "freebsd-kqueue" # needed on OS X 
    73  
    74 server.modules = ( "mod_rewrite", "mod_fastcgi" ) 
    75  
    76 url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) 
    77 server.error-handler-404 = "/dispatch.fcgi" 
    78  
    79 server.document-root = "/path/application/public" 
    80 server.errorlog      = "/path/application/log/server.log" 
    81  
    82 fastcgi.server = ( ".fcgi" => 
    83   ( "localhost" => 
    84       ( 
    85         "min-procs" => 1,  
    86         "max-procs" => 5, 
    87         "socket"   => "/tmp/application.fcgi.socket", 
    88         "bin-path" => "/path/application/public/dispatch.fcgi", 
    89         "bin-environment" => ( "RAILS_ENV" => "development" ) 
    90       ) 
     70  server.port = 8080 
     71  server.bind = "127.0.0.1" 
     72  # server.event-handler = "freebsd-kqueue" # needed on OS X 
     73   
     74  server.modules = ( "mod_rewrite", "mod_fastcgi" ) 
     75   
     76  url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) 
     77  server.error-handler-404 = "/dispatch.fcgi" 
     78   
     79  server.document-root = "/path/application/public" 
     80  server.errorlog      = "/path/application/log/server.log" 
     81   
     82  fastcgi.server = ( ".fcgi" => 
     83    ( "localhost" => 
     84        ( 
     85          "min-procs" => 1,  
     86          "max-procs" => 5, 
     87          "socket"   => "/tmp/application.fcgi.socket", 
     88          "bin-path" => "/path/application/public/dispatch.fcgi", 
     89          "bin-environment" => ( "RAILS_ENV" => "development" ) 
     90        ) 
     91    ) 
    9192  ) 
    92 
    93  
     93   
    9494 
    9595== Debugging Rails 
     
    140140Here you'll have all parts of the application configured, just like it is when the 
    141141application is running. You can inspect domain models, change values, and save to the 
    142 database. Start the script without arguments to see the options. 
     142database. Start the script without arguments will launch it in the development environment. 
     143Passing an argument will specify a different environment, like <tt>console production</tt>. 
    143144 
    144145