Browse files

Add ember-data to --head

  • Loading branch information...
1 parent 1645e30 commit ceaf5d0849b51dc7aa46373e341e946f41a17eb3 @wycats wycats committed Jun 19, 2012
Showing with 37 additions and 1 deletion.
  1. +37 −1 lib/generators/ember/install_generator.rb
View
38 lib/generators/ember/install_generator.rb
@@ -35,13 +35,49 @@ def copy_ember
end
end
- self.class.source_root File.join(git_root, "dist")
+ source_paths << File.join(git_root, "dist")
copy_file "ember.js", "vendor/assets/ember/development/ember.js"
copy_file "ember.min.js", "vendor/assets/ember/production/ember.js"
end
end
+ def copy_ember_data
+ if options.head?
+
+ git_root = File.expand_path "~/.ember-data"
+ gem_file = File.join git_root, "Gemfile"
+
+ # If it doesn't exist yet
+ unless File.exist?(git_root)
+ command = %{git clone git://github.com/emberjs/data.git "#{git_root}"}
+ say_status("downloading", command, :green)
+
+ cmd command
+ else
+ Dir.chdir git_root do
+ command = "git fetch origin && git reset origin/master --hard"
+ say_status("updating", command, :green)
+
+ cmd command
+ end
+ end
+
+ Dir.chdir git_root do
+ say_status("building", "bundle && bundle exec rake", :green)
+ Bundler.with_clean_env do
+ cmd "bundle --gemfile #{gem_file}"
+ cmd %{BUNDLE_GEMFILE="#{gem_file}" bundle exec rake}
+ end
+ end
+
+ source_paths << File.join(git_root, "dist")
+
+ copy_file "ember-data.js", "vendor/assets/ember/development/ember-data.js"
+ copy_file "ember-data.min.js", "vendor/assets/ember/production/ember-data.js"
+ end
+ end
+
private
def cmd(command)

0 comments on commit ceaf5d0

Please sign in to comment.