Skip to content

Commit

Permalink
Add ember-data to --head
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Jun 19, 2012
1 parent 1645e30 commit ceaf5d0
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion lib/generators/ember/install_generator.rb
Expand Up @@ -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)
Expand Down

0 comments on commit ceaf5d0

Please sign in to comment.