<commit_before>namespace :nginx do
  NGINX_VER = "nginx-1.4.0"

  #desc "Make nginx prerequisites"
  task :prereq do
    tools = %w{zlib1g zlib1g-dev libpcre3 libpcre3-dev openssl libxml2-dev libxslt-dev}
    install_pkg(tools)
    notice("Installed nginx prerequisites")
  end

  #desc "Make mod_wsgi"
  task :mod_wsgi => ["mercurial:bin"] do
    FileUtils.cd(TMP_DIR) do
      sh("hg clone http://bitbucket.org/lifeeth/mod_wsgi/")
      sh("cd mod_wsgi")
      sh("sudo python setup.py --prefix=/usr/local/#{NGINX_VER} install")
      notice("Built mod_wsgi")
    end
  end

  #desc "Make pagespeed"
  task :pagespeed do
    # From:
    #  https://developers.google.com/speed/docs/mod_pagespeed/build_from_source

    depends = %w{apache2 g++ python subversion gperf make devscripts fakeroot}
    install_pkg(depends)

    FileUtils.cd(TMP_DIR) do
      sh("svn co http://src.chromium.org/svn/trunk/tools/depot_tools")

      FileUtils.mkdir("mod_pagespeed") unless File.exists?("mod_pagespeed")
      FileUtils.cd("mod_pagespeed") do
        gclient = "../depot_tools/gclient"
        sh("#{gclient} config http://modpagespeed.googlecode.com/svn/branches/latest-beta/src")
        sh("#{gclient} sync --force --jobs=1")
      end
    end
    notice("Built pagespeed")
  end

  #desc "Test pagespeed"
  task :pagespeed_test => [:pagespeed] do
    FileUtils.cd(File.join(TMP_DIR, "mod_pagespeed", "src")) do
      sh("make BUILDTYPE=Release mod_pagespeed_test pagespeed_automatic_test")
      sh("./out/Release/mod_pagespeed_test")
      sh("./out/Release/pagespeed_automatic_test")
    end
    notice("Tested pagespeed")
  end

  #desc "Compile pagespeed"
  task :pagespeed_compile => [:pagespeed] do
    FileUtils.cd(File.join(TMP_DIR, "mod_pagespeed", "src")) do
      sh("make BUILDTYPE=Release")
      FileUtils.cd("#{TMP_DIR}/mod_pagespeed/src/net/instaweb/automatic") do
        sh("make all")
      end
    end
    notice("Compiled pagespeed")
  end

  #desc "Install pagespeed"
  task :pagespeed_install => [:pagespeed_compile] do
    FileUtils.cd(File.join(TMP_DIR, "mod_pagespeed", "src")) do
      sh("./ubuntu.sh staging")
      sh("sudo ./ubuntu.sh install")
      #sh("sudo ./ubuntu.sh stop start")
    end
  end

  #desc "Make mod_pagespeed"
  task :mod_pagespeed => [:pagespeed, :pagespeed_test, :pagespeed_compile, :pagespeed_install, "git:bin"] do
    FileUtils.cd(TMP_DIR) do
      sh("git clone git://github.com/pagespeed/ngx_pagespeed.git")
      notice("Built mod_pagespeed")
    end
  end

  #desc "install nginx source"
  task :nginx_src do
    FileUtils.cd(TMP_DIR) do
      sh("wget -O #{NGINX_VER}.tar.gz http://nginx.org/download/#{NGINX_VER}.tar.gz && tar xvfz #{NGINX_VER}.tar.gz && cd #{NGINX_VER}")

      # Fetch and apply the Nginx SPDY patch
      #sh("wget http://nginx.org/patches/spdy/patch.spdy.txt")
      #sh("patch -p0 < patch.spdy.txt")

      notice("Installed nginx source")
    end
  end

  #desc "Install nginx binary"
  #:mod_wsgi, :mod_pagespeed,
  # --add-module=../mod_wsgi
  # --add-module=../mod_pagespeed
  task :nginx => [:prereq, :nginx_src] do
    
    FileUtils.cd(TMP_DIR) do
      FileUtils.cd(NGINX_VER) do
        options = %w{
          --prefix=/usr<commit_msg>Remove dead mod_pagespeed code<commit_after>namespace :nginx do
  NGINX_VER = "nginx-1.4.0"

  #desc "Make nginx prerequisites"
  task :prereq do
    tools = %w{zlib1g zlib1g-dev libpcre3 libpcre3-dev openssl libxml2-dev libxslt-dev}
    install_pkg(tools)
    notice("Installed nginx prerequisites")
  end

  #desc "Make mod_wsgi"
  task :mod_wsgi => ["mercurial:bin"] do
    FileUtils.cd(TMP_DIR) do
      sh("hg clone http://bitbucket.org/lifeeth/mod_wsgi/")
      sh("cd mod_wsgi")
      sh("sudo python setup.py --prefix=/usr/local/#{NGINX_VER} install")
      notice("Built mod_wsgi")
    end
  end

    install_pkg(depends)

    FileUtils.cd(TMP_DIR) do
    end
  end

  #desc "install nginx source"
  task :nginx_src do
    FileUtils.cd(TMP_DIR) do
      sh("wget -O #{NGINX_VER}.tar.gz http://nginx.org/download/#{NGINX_VER}.tar.gz && tar xvfz #{NGINX_VER}.tar.gz && cd #{NGINX_VER}")
      notice("Installed nginx source")
    end
  end

  #desc "Install nginx binary"
  #:mod_wsgi
  # --add-module=../mod_wsgi
  task :nginx => [:prereq, :nginx_src] do
    
    FileUtils.cd(TMP_DIR) do
      FileUtils.cd(NGINX_VER) do
        options = %w{
          --prefix=/usr
{'fraction_non_alphanumeric': 0.139709223080418, 'fraction_numerical': 0.004316219900045434, 'mean_word_length': 3.165562913907285, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 11, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '183218', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1668, 'n_words': 326}