engineyard-serverside 1.4.13 → 1.4.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -119,7 +119,7 @@ module EY
119
119
  end
120
120
 
121
121
  def framework_envs
122
- "RAILS_ENV=#{environment} RACK_ENV=#{environment} MERB_ENV=#{environment}"
122
+ "RAILS_ENV=#{environment} RACK_ENV=#{environment} NODE_ENV=#{environment} MERB_ENV=#{environment}"
123
123
  end
124
124
 
125
125
  def current_path
@@ -2,11 +2,13 @@
2
2
  require 'base64'
3
3
  require 'fileutils'
4
4
  require 'json'
5
+ require 'engineyard-serverside/rails_asset_support'
5
6
 
6
7
  module EY
7
8
  module Serverside
8
9
  class DeployBase < Task
9
10
  include LoggedOutput
11
+ include ::EY::Serverside::RailsAssetSupport
10
12
 
11
13
  # default task
12
14
  def deploy
@@ -29,7 +31,10 @@ module EY
29
31
  symlink_configs
30
32
  conditionally_enable_maintenance_page
31
33
  run_with_callbacks(:migrate)
34
+ run_with_callbacks(:compile_assets) # defined in RailsAssetSupport
32
35
  callback(:before_symlink)
36
+ # We don't use run_with_callbacks for symlink because we need
37
+ # to clean up manually if it fails.
33
38
  symlink
34
39
  end
35
40
 
@@ -127,6 +132,10 @@ module EY
127
132
  "/engineyard/bin/app_#{c.app} deploy"
128
133
  end
129
134
 
135
+ def clean_environment
136
+ "env -i PATH=$PATH HOME=$HOME GEM_PATH=$GEM_PATH GEM_HOME=$GEM_HOME"
137
+ end
138
+
130
139
  # task
131
140
  def bundle
132
141
  if File.exist?("#{c.release_path}/Gemfile")
@@ -140,7 +149,7 @@ module EY
140
149
  get_default_bundler_installer
141
150
  end
142
151
 
143
- sudo "#{serverside_bin} install_bundler #{bundler_installer.version}"
152
+ sudo "#{clean_environment} #{serverside_bin} install_bundler #{bundler_installer.version}"
144
153
 
145
154
  bundled_gems_path = File.join(c.shared_path, "bundled_gems")
146
155
  ruby_version_file = File.join(bundled_gems_path, "RUBY_VERSION")
@@ -160,10 +169,19 @@ module EY
160
169
  end
161
170
  end
162
171
 
163
- run "cd #{c.release_path} && bundle _#{bundler_installer.version}_ install #{bundler_installer.options}"
172
+ run "cd #{c.release_path} && #{clean_environment} ruby -S bundle _#{bundler_installer.version}_ install #{bundler_installer.options}"
164
173
 
165
174
  run "mkdir -p #{bundled_gems_path} && ruby -v > #{ruby_version_file} && uname -m > #{system_version_file}"
166
175
  end
176
+
177
+ if File.exist?("#{c.release_path}/package.json")
178
+ unless run("which npm")
179
+ abort "*** [Error] package.json detected, but npm was not installed"
180
+ else
181
+ info "~> package.json detected, installing npm packages"
182
+ run "cd #{c.release_path} && npm install"
183
+ end
184
+ end
167
185
  end
168
186
 
169
187
  # task
@@ -219,24 +237,31 @@ module EY
219
237
  end
220
238
 
221
239
  def symlink_configs(release_to_link=c.release_path)
222
- info "~> Symlinking configs"
223
- [ "chmod -R g+w #{release_to_link}",
224
- "rm -rf #{release_to_link}/log #{release_to_link}/public/system #{release_to_link}/tmp/pids",
225
- "mkdir -p #{release_to_link}/tmp",
226
- "ln -nfs #{c.shared_path}/log #{release_to_link}/log",
227
- "mkdir -p #{release_to_link}/public",
228
- "mkdir -p #{release_to_link}/config",
229
- "ln -nfs #{c.shared_path}/system #{release_to_link}/public/system",
230
- "ln -nfs #{c.shared_path}/pids #{release_to_link}/tmp/pids",
231
- "find #{c.shared_path}/config -type f -exec ln -s {} #{release_to_link}/config \\;",
232
- "ln -nfs #{c.shared_path}/config/database.yml #{release_to_link}/config/database.yml",
233
- "ln -nfs #{c.shared_path}/config/mongrel_cluster.yml #{release_to_link}/config/mongrel_cluster.yml",
234
- ].each do |cmd|
235
- run cmd
240
+ info "~> Preparing shared resources for release"
241
+ symlink_tasks(release_to_link).each do |what, cmd|
242
+ info "~> #{what}"
243
+ run(cmd)
236
244
  end
245
+ owner = [c.user, c.group].join(':')
246
+ info "~> Setting ownership to #{owner}"
247
+ sudo "chown -R #{owner} #{release_to_link}"
248
+ end
237
249
 
238
- sudo "chown -R #{c.user}:#{c.group} #{release_to_link}"
239
- run "if [ -f \"#{c.shared_path}/config/newrelic.yml\" ]; then ln -nfs #{c.shared_path}/config/newrelic.yml #{release_to_link}/config/newrelic.yml; fi"
250
+ def symlink_tasks(release_to_link)
251
+ [
252
+ ["Set group write permissions", "chmod -R g+w #{release_to_link}"],
253
+ ["Remove revision-tracked shared directories from deployment", "rm -rf #{release_to_link}/log #{release_to_link}/public/system #{release_to_link}/tmp/pids"],
254
+ ["Create tmp directory", "mkdir -p #{release_to_link}/tmp"],
255
+ ["Symlink shared log directory", "ln -nfs #{c.shared_path}/log #{release_to_link}/log"],
256
+ ["Create public directory if needed", "mkdir -p #{release_to_link}/public"],
257
+ ["Create config directory if needed", "mkdir -p #{release_to_link}/config"],
258
+ ["Create system directory if needed", "ln -nfs #{c.shared_path}/system #{release_to_link}/public/system"],
259
+ ["Symlink shared pids directory", "ln -nfs #{c.shared_path}/pids #{release_to_link}/tmp/pids"],
260
+ ["Symlink other shared config files", "find #{c.shared_path}/config -type f -not -name 'database.yml' -exec ln -s {} #{release_to_link}/config \\;"],
261
+ ["Symlink mongrel_cluster.yml", "ln -nfs #{c.shared_path}/config/mongrel_cluster.yml #{release_to_link}/config/mongrel_cluster.yml"],
262
+ ["Symlink database.yml", "ln -nfs #{c.shared_path}/config/database.yml #{release_to_link}/config/database.yml"],
263
+ ["Symlink newrelic.yml if needed", "if [ -f \"#{c.shared_path}/config/newrelic.yml\" ]; then ln -nfs #{c.shared_path}/config/newrelic.yml #{release_to_link}/config/newrelic.yml; fi"],
264
+ ]
240
265
  end
241
266
 
242
267
  # task
@@ -364,6 +389,5 @@ module EY
364
389
  super
365
390
  end
366
391
  end
367
-
368
392
  end
369
393
  end
@@ -0,0 +1,96 @@
1
+ module EY
2
+ module Serverside
3
+ module RailsAssetSupport
4
+ def compile_assets
5
+ asset_dir = "#{c.release_path}/app/assets"
6
+ return unless app_needs_assets?
7
+ rails_version = bundled_rails_version
8
+ roles :app_master, :app, :solo do
9
+ keep_existing_assets
10
+ cmd = "cd #{c.release_path} && PATH=#{c.binstubs_path}:$PATH #{c.framework_envs} rake assets:precompile"
11
+ if rails_version
12
+ info "~> Precompiling assets for rails v#{version}"
13
+ else
14
+ info "~> [WARN] Precompiling assets even though Rails was not bundled."
15
+ end
16
+ run(cmd)
17
+ end
18
+ end
19
+
20
+ def app_needs_assets?
21
+ app_rb_path = File.join(c.release_path, 'config', 'application.rb')
22
+ return unless File.readable?(app_rb_path) # Not a Rails app in the first place.
23
+ return unless File.directory?(File.join(c.release_path, 'app', 'assets'))
24
+ if app_builds_own_assets?
25
+ info "~> public/assets already exists, skipping pre-compilation."
26
+ return
27
+ end
28
+ if app_disables_assets?(app_rb_path)
29
+ info "~> application.rb has disabled asset compilation. Skipping."
30
+ return
31
+ end
32
+ unless app_has_asset_task?
33
+ info "~> No 'assets:precompile' Rake task found. Skipping."
34
+ return
35
+ end
36
+ true
37
+ end
38
+
39
+ def app_disables_assets?(path)
40
+ disabled = nil
41
+ File.open(path) do |fd|
42
+ pattern = /^[^#].*config\.assets\.enabled\s+=\s+(false|nil)/
43
+ contents = fd.read
44
+ disabled = contents.match(pattern)
45
+ end
46
+ disabled
47
+ end
48
+
49
+ # Runs 'rake -T' to see if there is an assets:precompile task.
50
+ def app_has_asset_task?
51
+ # We just run this locally on the app master; everybody else should
52
+ # have the same code anyway.
53
+ task_check = "PATH=#{c.binstubs_path}:$PATH #{c.framework_envs} rake -T assets:precompile |grep 'assets:precompile'"
54
+ cmd = "cd #{c.release_path} && #{task_check}"
55
+ logged_system "cd #{c.release_path} && #{task_check}"
56
+ $? == 0
57
+ end
58
+
59
+ def app_builds_own_assets?
60
+ File.directory?(File.join(c.release_path, 'public', 'assets'))
61
+ end
62
+
63
+ # To support operations like Unicorn's hot reload, it is useful to have
64
+ # the prior release's assets as well. Otherwise, while a deploy is running,
65
+ # clients may request stale assets that you just deleted.
66
+ # Making use of this requires a properly-configured front-end HTTP server.
67
+ def keep_existing_assets
68
+ current = File.join(c.shared_path, 'assets')
69
+ last_asset_path = File.join(c.shared_path, 'last_assets')
70
+ # If there are current shared assets, move them under a 'last_assets' directory.
71
+ run <<-COMMAND
72
+ if [ -d #{current} ]; then
73
+ rm -rf #{last_asset_path} && mkdir #{last_asset_path} && mv #{current} #{last_asset_path} && mkdir -p #{current};
74
+ else
75
+ mkdir -p #{current} #{last_asset_path};
76
+ fi;
77
+ ln -nfs #{current} #{last_asset_path} #{c.release_path}/public
78
+ COMMAND
79
+ end
80
+
81
+ def bundled_rails_version(lockfile_path = nil)
82
+ lockfile_path ||= File.join(c.release_path, 'Gemfile.lock')
83
+ lockfile = File.open(lockfile_path) {|f| f.read}
84
+ lockfile.each_line do |line|
85
+ # scan for gemname (version) toplevel deps.
86
+ # Likely doesn't handle ancient Bundler versions, but
87
+ # we only call this when something looks like it is Rails 3.
88
+ next unless line =~ /^\s{4}([-\w_.0-9]+)\s*\((.*)\)/
89
+ return $2 if $1 == 'rails'
90
+ end
91
+ nil
92
+ end
93
+ end
94
+ end
95
+ end
96
+
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '1.4.13'
3
+ VERSION = '1.4.14'
4
4
  end
5
5
  end
@@ -39,6 +39,8 @@ describe "Deploying an application without Bundler" do
39
39
  File.exist?(File.join(@deploy_dir, 'current', 'after_bundle.ran' )).should be_true
40
40
  File.exist?(File.join(@deploy_dir, 'current', 'before_migrate.ran')).should be_true
41
41
  File.exist?(File.join(@deploy_dir, 'current', 'after_migrate.ran' )).should be_true
42
+ File.exist?(File.join(@deploy_dir, 'current', 'before_compile_assets.ran')).should be_true
43
+ File.exist?(File.join(@deploy_dir, 'current', 'after_compile_assets.ran' )).should be_true
42
44
  File.exist?(File.join(@deploy_dir, 'current', 'before_symlink.ran')).should be_true
43
45
  File.exist?(File.join(@deploy_dir, 'current', 'after_symlink.ran' )).should be_true
44
46
  File.exist?(File.join(@deploy_dir, 'current', 'before_restart.ran')).should be_true
@@ -1,6 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Deploying an application that uses Bundler" do
4
+ before(:each) do
5
+ @bundler_version = ::EY::Serverside::LockfileParser.default_version
6
+ @version_pattern = Regexp.quote(@bundler_version)
7
+ end
8
+
4
9
  def deploy_test_application
5
10
  @deploy_dir = File.join(Dir.tmpdir, "serverside-deploy-#{Time.now.to_i}-#{$$}")
6
11
 
@@ -40,11 +45,11 @@ describe "Deploying an application that uses Bundler" do
40
45
  it "runs the right bundler command" do
41
46
  install_bundler_command_ran = @deployer.commands.detect{ |command| command.index("install_bundler") }
42
47
  install_bundler_command_ran.should_not be_nil
43
- install_bundler_command_ran.should == "#{@binpath} install_bundler 1.0.10"
48
+ install_bundler_command_ran.should include("#{@binpath} install_bundler #{@bundler_version}")
44
49
  end
45
50
 
46
51
  it "runs 'bundle install' with --deployment" do
47
- bundle_install_cmd = @deployer.commands.grep(/bundle _\S+_ install/).first
52
+ bundle_install_cmd = @deployer.commands.grep(/bundle _#{@version_pattern}_ install/).first
48
53
  bundle_install_cmd.should_not be_nil
49
54
  bundle_install_cmd.should include('--deployment')
50
55
  end
@@ -83,14 +88,15 @@ describe "Deploying an application that uses Bundler" do
83
88
  deploy_test_application
84
89
  end
85
90
 
86
- it "default to Bundler 1.0.10" do
91
+ it "installs the proper Bundler version" do
92
+ @bundler_version.should == "1.0.10" # Something should break when the default changes.
87
93
  install_bundler_command_ran = @deployer.commands.detect{ |command| command.index("install_bundler") }
88
94
  install_bundler_command_ran.should_not be_nil
89
- install_bundler_command_ran.should == "#{@binpath} install_bundler 1.0.10"
95
+ install_bundler_command_ran.should include("#{@binpath} install_bundler #{@bundler_version}")
90
96
  end
91
97
 
92
98
  it "runs 'bundle install' without --deployment" do
93
- bundle_install_cmd = @deployer.commands.grep(/bundle _\S+_ install/).first
99
+ bundle_install_cmd = @deployer.commands.grep(/bundle _#{@version_pattern}_ install/).first
94
100
  bundle_install_cmd.should_not be_nil
95
101
  bundle_install_cmd.should_not include('--deployment')
96
102
  end
@@ -24,6 +24,7 @@ describe "the EY::Serverside::Deploy API" do
24
24
  def bundle() @call_order << 'bundle' end
25
25
  def symlink_configs() @call_order << 'symlink_configs' end
26
26
  def migrate() @call_order << 'migrate' end
27
+ def compile_assets() @call_order << 'compile_assets' end
27
28
  def symlink() @call_order << 'symlink' end
28
29
  def restart() @call_order << 'restart' end
29
30
  def cleanup_old_releases() @call_order << 'cleanup_old_releases' end
@@ -41,6 +42,7 @@ describe "the EY::Serverside::Deploy API" do
41
42
  symlink_configs
42
43
  conditionally_enable_maintenance_page
43
44
  migrate
45
+ compile_assets
44
46
  symlink
45
47
  restart
46
48
  disable_maintenance_page
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Deploying an application that uses Node.js and NPM" do
4
+ def deploy_test_application
5
+ @deploy_dir = File.join(Dir.tmpdir, "serverside-deploy-#{Time.now.to_i}-#{$$}")
6
+
7
+ # set up EY::Serverside::Server like we're on a solo
8
+ EY::Serverside::Server.reset
9
+ EY::Serverside::Server.add(:hostname => 'localhost', :roles => %w[solo])
10
+
11
+ # run a deploy
12
+ config = EY::Serverside::Deploy::Configuration.new({
13
+ "strategy" => "NodeIntegrationSpec",
14
+ "deploy_to" => @deploy_dir,
15
+ "group" => `id -gn`.strip,
16
+ "stack" => 'nginx_nodejs',
17
+ 'app' => 'nodeapp',
18
+ 'framework_env' => 'staging'
19
+ })
20
+
21
+ @binpath = File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'engineyard-serverside'))
22
+ @deployer = FullTestDeploy.new(config)
23
+ @deployer.deploy
24
+ end
25
+
26
+ before(:all) do
27
+ deploy_test_application
28
+ end
29
+
30
+ it "runs 'npm install'" do
31
+ install_cmd = @deployer.commands.grep(/npm install/).first
32
+ install_cmd.should_not be_nil
33
+ end
34
+ end if $NPM_INSTALLED
35
+
36
+
@@ -0,0 +1,99 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Deploying a Rails 3.1 application" do
4
+ def deploy_test_application(assets_enabled = true, &block)
5
+ $DISABLE_GEMFILE = false
6
+ $DISABLE_LOCKFILE = false
7
+ @deploy_dir = File.join(Dir.tmpdir, "serverside-deploy-#{Time.now.to_i}-#{$$}")
8
+
9
+ # set up EY::Serverside::Server like we're on a solo
10
+ EY::Serverside::Server.reset
11
+ EY::Serverside::Server.add(:hostname => 'localhost', :roles => %w[solo])
12
+
13
+ # run a deploy
14
+ @config = EY::Serverside::Deploy::Configuration.new({
15
+ "strategy" => "IntegrationSpec",
16
+ "deploy_to" => @deploy_dir,
17
+ "group" => `id -gn`.strip,
18
+ "stack" => 'nginx_passenger',
19
+ "migrate" => "ruby -e 'puts ENV[\"PATH\"]' > #{@deploy_dir}/path-when-migrating",
20
+ 'app' => 'rails31',
21
+ 'framework_env' => 'staging'
22
+ })
23
+
24
+ # pretend there is a shared bundled_gems directory
25
+ FileUtils.mkdir_p(File.join(@deploy_dir, 'shared', 'bundled_gems'))
26
+ %w(RUBY_VERSION SYSTEM_VERSION).each do |name|
27
+ File.open(File.join(@deploy_dir, 'shared', 'bundled_gems', name), "w") { |f| f.write("old\n") }
28
+ end
29
+
30
+ # Set up the application directory to have the requested asset options.
31
+ prepare_rails31_app(assets_enabled)
32
+
33
+ @binpath = File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'engineyard-serverside'))
34
+ @deployer = FullTestDeploy.new(@config)
35
+ @deployer.deploy(&block)
36
+ end
37
+
38
+ def prepare_rails31_app(assets_enabled)
39
+ FileUtils.mkdir_p(File.join(@config.release_path, 'config'))
40
+ app_rb = File.join(@config.release_path, 'config', 'application.rb')
41
+ app_rb_contents = <<-EOF
42
+ module Rails31
43
+ class Application < Rails::Application
44
+ config.assets.enabled = #{assets_enabled ? 'true' : 'false'}
45
+ end
46
+ end
47
+ EOF
48
+ File.open(app_rb, 'w') {|f| f.write(app_rb_contents)}
49
+ rakefile = File.join(@config.release_path, 'Rakefile')
50
+ rakefile_contents = <<-EOF
51
+ desc 'Precompile yar assetz'
52
+ task 'assets:precompile' do
53
+ sh 'touch precompiled'
54
+ end
55
+ EOF
56
+ File.open(rakefile, 'w') {|f| f.write(rakefile_contents)}
57
+ FileUtils.mkdir_p(File.join(@config.release_path, 'app', 'assets'))
58
+ end
59
+
60
+ context "with default production settings" do
61
+ before(:all) do
62
+ deploy_test_application
63
+ end
64
+
65
+ it "precompiles assets" do
66
+ File.exist?(File.join(@deploy_dir, 'current', 'precompiled')).should be_true
67
+ end
68
+ end
69
+
70
+ context "with asset support disabled in its config" do
71
+ before(:all) do
72
+ deploy_test_application(with_assets = false)
73
+ end
74
+
75
+ it "does not precompile assets" do
76
+ File.exist?(File.join(@deploy_dir, 'current', 'precompiled')).should be_false
77
+ end
78
+ end
79
+
80
+ context "with existing precompilation in a deploy hook" do
81
+ before(:all) do
82
+ deploy_test_application do
83
+ deploy_dir = File.join(@config.shared_path, 'cached-copy', 'deploy')
84
+ FileUtils.mkdir_p(deploy_dir)
85
+ hook = File.join(deploy_dir, 'before_migrate.rb')
86
+ hook_contents = %Q[run 'touch custom_compiled && mkdir public/assets']
87
+ File.open(hook, 'w') {|f| f.puts(hook_contents) }
88
+ File.chmod(0755, hook)
89
+ end
90
+ end
91
+
92
+ it "does not replace the public/assets directory" do
93
+ File.exist?(File.join(@deploy_dir, 'current', 'custom_compiled')).should be_true
94
+ File.exist?(File.join(@deploy_dir, 'current', 'precompiled')).should be_false
95
+ File.directory?(File.join(@deploy_dir, 'current', 'public', 'assets')).should be_true
96
+ File.symlink?(File.join(@deploy_dir, 'current', 'public', 'assets')).should be_false
97
+ end
98
+ end
99
+ end
data/spec/spec_helper.rb CHANGED
@@ -23,8 +23,12 @@ module EY
23
23
  def logged_system(cmd)
24
24
  output = `#{cmd} 2>&1`
25
25
  successful = ($? == 0)
26
- if ENV['VERBOSE'] && !successful
27
- $stderr.puts "\nCommand `#{cmd}` exited with status #{$?.exitstatus}: '#{output.strip}'"
26
+ if ENV['VERBOSE']
27
+ if successful
28
+ $stdout.puts "#{cmd}\n#{output.strip}".chomp
29
+ else
30
+ $stderr.puts "\nCommand `#{cmd}` exited with status #{$?.exitstatus}: '#{output.strip}'"
31
+ end
28
32
  end
29
33
  successful
30
34
  end
@@ -43,6 +47,12 @@ FileUtils.rm_rf GITREPO_DIR if File.exists? GITREPO_DIR
43
47
  Kernel.system "tar xzf #{GITREPO_DIR}.tar.gz -C #{FIXTURES_DIR}"
44
48
 
45
49
  Spec::Runner.configure do |config|
50
+ `which npm 2>&1`
51
+ $NPM_INSTALLED = ($? == 0)
52
+ unless $NPM_INSTALLED
53
+ $stderr.puts "npm not found; skipping Node.js specs."
54
+ end
55
+
46
56
  config.before(:all) do
47
57
  $DISABLE_GEMFILE = false
48
58
  $DISABLE_LOCKFILE = false
@@ -51,10 +51,13 @@ class FullTestDeploy < EY::Serverside::Deploy
51
51
  def bundle
52
52
  my_env = ENV.to_hash
53
53
 
54
- ENV.delete("BUNDLE_GEMFILE")
55
- ENV.delete("BUNDLE_BIN_PATH")
56
-
57
- result = super
54
+ if defined?(Bundler)
55
+ Bundler.with_clean_env do
56
+ result = super
57
+ end
58
+ else
59
+ result = super
60
+ end
58
61
 
59
62
  ENV.replace(my_env)
60
63
  result
@@ -65,6 +68,11 @@ class FullTestDeploy < EY::Serverside::Deploy
65
68
  installer.options << ' --quiet' # stfu already!
66
69
  installer
67
70
  end
71
+
72
+ def deploy
73
+ yield if block_given?
74
+ super
75
+ end
68
76
  end
69
77
 
70
78
  module EY::Serverside::Strategies::IntegrationSpec
@@ -75,10 +83,12 @@ module EY::Serverside::Strategies::IntegrationSpec
75
83
 
76
84
  deploy_hook_dir = File.join(cached_copy, 'deploy')
77
85
  FileUtils.mkdir_p(deploy_hook_dir)
78
- %w[bundle migrate symlink restart].each do |action|
86
+ %w[bundle compile_assets migrate symlink restart].each do |action|
79
87
  %w[before after].each do |prefix|
80
88
  hook = "#{prefix}_#{action}"
81
- File.open(File.join(deploy_hook_dir, "#{hook}.rb"), 'w') do |f|
89
+ hook_path = File.join(deploy_hook_dir, "#{hook}.rb")
90
+ next if File.exist?(hook_path)
91
+ File.open(hook_path, 'w') do |f|
82
92
  f.write(%Q{run 'touch "#{c.release_path}/#{hook}.ran"'})
83
93
  end
84
94
  end
@@ -99,13 +109,12 @@ module EY::Serverside::Strategies::IntegrationSpec
99
109
 
100
110
  def gemfile_contents
101
111
  <<-EOF
102
- source :gemcutter
103
-
104
- gem "bundler", "~> 1.0.0.rc.6"
105
- gem "rake"
112
+ source 'http://rubygems.org'
113
+ gem 'rake', '= 0.8.7'
106
114
  EOF
107
115
  end
108
116
 
117
+ # Generated using Bundler v1.0.10
109
118
  def lockfile_contents
110
119
  <<-EOF
111
120
  GEM
@@ -117,8 +126,7 @@ PLATFORMS
117
126
  ruby
118
127
 
119
128
  DEPENDENCIES
120
- bundler (~> 1.0.0.rc.6)
121
- rake
129
+ rake (= 0.8.7)
122
130
  EOF
123
131
  end
124
132
 
@@ -137,3 +145,30 @@ EOF
137
145
  end
138
146
  end
139
147
 
148
+ module EY::Serverside::Strategies::NodeIntegrationSpec
149
+ module Helpers
150
+ include EY::Serverside::Strategies::IntegrationSpec::Helpers
151
+
152
+ def generate_gemfile_in(dir)
153
+ generate_package_json_in(dir)
154
+ super(dir)
155
+ end
156
+
157
+ def generate_package_json_in(dir)
158
+ npm_file = File.join(dir, 'package.json')
159
+ File.open(npm_file, 'w') {|f| f.write(npm_content)}
160
+ end
161
+
162
+ def npm_content
163
+ <<-EOF
164
+ {
165
+ "name": "node-example",
166
+ "version": "0.0.1",
167
+ "dependencies": {
168
+ "express": "2.2.0"
169
+ }
170
+ }
171
+ EOF
172
+ end
173
+ end
174
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 13
10
- version: 1.4.13
9
+ - 14
10
+ version: 1.4.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - EY Cloud Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-21 00:00:00 -07:00
18
+ date: 2011-09-27 00:00:00 -04:00
19
19
  default_executable: engineyard-serverside
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,7 @@ files:
67
67
  - lib/engineyard-serverside/deprecation.rb
68
68
  - lib/engineyard-serverside/lockfile_parser.rb
69
69
  - lib/engineyard-serverside/logged_output.rb
70
+ - lib/engineyard-serverside/rails_asset_support.rb
70
71
  - lib/engineyard-serverside/server.rb
71
72
  - lib/engineyard-serverside/strategies/git.rb
72
73
  - lib/engineyard-serverside/task.rb
@@ -274,6 +275,8 @@ files:
274
275
  - spec/fixtures/valid_hook.rb
275
276
  - spec/git_strategy_spec.rb
276
277
  - spec/lockfile_parser_spec.rb
278
+ - spec/nodejs_deploy_spec.rb
279
+ - spec/rails31_deploy_spec.rb
277
280
  - spec/restart_spec.rb
278
281
  - spec/server_spec.rb
279
282
  - spec/spec_helper.rb
@@ -333,6 +336,8 @@ test_files:
333
336
  - spec/fixtures/valid_hook.rb
334
337
  - spec/git_strategy_spec.rb
335
338
  - spec/lockfile_parser_spec.rb
339
+ - spec/nodejs_deploy_spec.rb
340
+ - spec/rails31_deploy_spec.rb
336
341
  - spec/restart_spec.rb
337
342
  - spec/server_spec.rb
338
343
  - spec/spec_helper.rb