Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Compile nodejs with node.cpu.total threads #20

Merged
merged 6 commits into from

2 participants

@ChrisLundquist
  • Uses jamie for a test framework
  • compiles with all the threads the machine sees
@ChrisLundquist

To give it a go

$ bundle
$ jamie test source-ubuntu-1204 # $ jamie list to see all the targets
@ChrisLundquist

It looks like the travis test timed out rather than failed. What can I do to get this merged?

@mdxp mdxp merged commit 715e755 into from
@mdxp
Owner

Merged. Thanks Chris!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 5, 2013
  1. [source] compile with all processors when known. Default:2

    Chris Lundquist authored
  2. [default.rb] platform_family for mint support

    Chris Lundquist authored
  3. [source.rb] print how many CPUs we're using

    Chris Lundquist authored
  4. [Jamie] use the framework I wish I had 3 months ago

    Chris Lundquist authored
  5. [jamie] whoops I thought package was the default

    Chris Lundquist authored
  6. [jamie] subshell the test command

    Chris Lundquist authored
This page is out of date. Refresh to see the latest.
View
2  .gitignore
@@ -1,2 +1,4 @@
Gemfile.lock
tmp/
+.jamie/
+.jamie.local.yml
View
40 .jamie.yml
@@ -0,0 +1,40 @@
+---
+driver_plugin: vagrant
+driver_config:
+ customize:
+ memory: 512
+ cpus: 4
+platforms:
+- name: ubuntu-12.04
+ driver_config:
+ box: opscode-ubuntu-12.04
+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-12.04.box
+ run_list:
+ - recipe[apt]
+- name: ubuntu-10.04
+ driver_config:
+ box: opscode-ubuntu-10.04
+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-10.04.box
+ run_list:
+ - recipe[apt]
+- name: centos-6.3
+ driver_config:
+ box: opscode-centos-6.3
+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-6.3.box
+- name: centos-5.8
+ driver_config:
+ box: opscode-centos-5.8
+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-5.8.box
+suites:
+- name: package
+ run_list:
+ - recipe[nodejs]
+ attributes:
+ nodejs:
+ install_method: package
+- name: source
+ run_list:
+ - recipe[nodejs]
+ attributes:
+ nodejs:
+ install_method: source
View
1  Berksfile
@@ -1,2 +1,3 @@
cookbook 'apt'
cookbook 'build-essential'
+cookbook 'nodejs', :path => '.'
View
4 Gemfile
@@ -0,0 +1,4 @@
+gem 'foodcritic'
+gem 'berkshelf'
+gem 'jamie'
+gem 'jamie-vagrant'
View
7 Rakefile
@@ -27,3 +27,10 @@ recipes resources templates}
cp_r Dir.glob("{#{files.join(',')}}"), sandbox
puts "\n\n"
end
+
+begin
+ require 'jamie/rake_tasks'
+ Jamie::RakeTasks.new
+rescue LoadError
+ puts ">>>>> Jamie gem not loaded, omitting tasks" unless ENV['CI']
+end
View
77 Vagrantfile
@@ -1,78 +1,9 @@
-# -*- mode: ruby -*-
-# vi: set ft=ruby :
-begin
- require 'active_support/core_ext/hash/deep_merge'
-rescue LoadError => e
- STDERR.puts '', "[!] ERROR -- Please install ActiveSupport (gem install activesupport)", '-'*80, ''
- raise e
-end
-
# Automatically install and mount cookbooks from Berksfile
-#
-require 'berkshelf/vagrant'
-
-distributions = {
- 'opscode-ubuntu-12.04' => {
- :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-12.04.box',
- :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
- :node => {}
- },
-
- 'opscode-ubuntu-12.04-i386' => {
- :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-12.04-i386.box',
- :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
- :node => {}
- },
- 'opscode-ubuntu-10.04' => {
- :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-10.04.box',
- :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
- :node => {}
- },
-
- 'opscode-centos6.3' => {
- :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-6.3.box',
- :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
- :node => {}
- }
-}
-
-node_config = {
-}
+require 'berkshelf/vagrant'
+require 'jamie/vagrant'
Vagrant::Config.run do |config|
-
- distributions.each_pair do |name, options|
-
- config.vm.define name, :options => options[:primary] do |box_config|
-
- box_config.vm.box = name.to_s
- box_config.vm.box_url = options[:url]
-
- box_config.vm.host_name = name.to_s
-
- # Install latest Chef on the machine
-
- box_config.vm.provision :shell do |shell|
- version = ENV['CHEF'].match(/^\d+/) ? ENV['CHEF'] : nil
- shell.inline = %Q{
- test -d "apt-get" && apt-get update
- test -d "chef-solo" || curl -# -L http://www.opscode.com/chef/install.sh | sudo bash -s -- #{version ? "-v #{version}" : ''}
- }
- end if ENV['CHEF']
-
- # Provision the machine with Chef Solo
- #
- box_config.vm.provision :chef_solo do |chef|
- chef.cookbooks_path = ['..', './tmp/cookbooks']
- chef.provisioning_path = '/etc/vagrant-chef'
- chef.log_level = :debug
-
- chef.run_list = options[:run_list]
- chef.json = node_config.deep_merge(options[:node])
- end
- end
-
- end
-
+ Jamie::Vagrant.define_vms(config)
end
+
View
4 recipes/default.rb
@@ -17,8 +17,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-case node['platform']
- when "ubuntu", "debian"
+case node['platform_family']
+ when "debian"
include_recipe "apt"
end
View
6 recipes/install_from_source.rb
@@ -49,12 +49,14 @@
creates "/usr/local/src/node-v#{node['nodejs']['version']}"
end
-bash "compile node.js" do
+make_threads = node['cpu'] ? node['cpu']['total'].to_i : 2
+bash "compile node.js (on #{make_threads} cpu)" do
+ # OSX doesn't have the attribute so arbitrarily default 2
cwd "/usr/local/src/node-v#{node['nodejs']['version']}"
code <<-EOH
PATH="/usr/local/bin:$PATH"
./configure --prefix=#{node['nodejs']['dir']} && \
- make
+ make -j #{make_threads}
EOH
creates "/usr/local/src/node-v#{node['nodejs']['version']}/node"
end
View
5 test/integration/package/bats/package.bats
@@ -0,0 +1,5 @@
+#!/usr/bin/env bats
+
+@test "node should be in the path" {
+ [ "$(command -v node)" ]
+}
View
5 test/integration/source/bats/source.bats
@@ -0,0 +1,5 @@
+#!/usr/bin/env bats
+
+@test "node should be in the path" {
+ [ "$(command -v node)" ]
+}
Something went wrong with that request. Please try again.