Merge pull request #2073 from edx/ned/message-if-no-install-needed
Print a message if the requirements files haven't changed.
This commit is contained in:
@@ -14,7 +14,7 @@ def report_dir_path(dir)
|
||||
return File.join(REPORT_DIR, dir.to_s)
|
||||
end
|
||||
|
||||
def when_changed(*files)
|
||||
def when_changed(unchanged_message, *files)
|
||||
Rake::Task[PREREQS_MD5_DIR].invoke
|
||||
cache_file = File.join(PREREQS_MD5_DIR, files.join('-').gsub(/\W+/, '-')) + '.md5'
|
||||
digest = Digest::MD5.new()
|
||||
@@ -24,6 +24,8 @@ def when_changed(*files)
|
||||
if !File.exists?(cache_file) or digest.hexdigest != File.read(cache_file)
|
||||
yield
|
||||
File.write(cache_file, digest.hexdigest)
|
||||
elsif !unchanged_message.empty?
|
||||
puts unchanged_message
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,21 +12,24 @@ task :install_prereqs => [:install_node_prereqs, :install_ruby_prereqs, :install
|
||||
|
||||
desc "Install all node prerequisites for the lms and cms"
|
||||
task :install_node_prereqs => "ws:migrate" do
|
||||
when_changed('package.json') do
|
||||
unchanged = 'Node requirements unchanged, nothing to install'
|
||||
when_changed(unchanged, 'package.json') do
|
||||
sh('npm install')
|
||||
end unless ENV['NO_PREREQ_INSTALL']
|
||||
end
|
||||
|
||||
desc "Install all ruby prerequisites for the lms and cms"
|
||||
task :install_ruby_prereqs => "ws:migrate" do
|
||||
when_changed('Gemfile') do
|
||||
unchanged = 'Ruby requirements unchanged, nothing to install'
|
||||
when_changed(unchanged, 'Gemfile') do
|
||||
sh('bundle install')
|
||||
end unless ENV['NO_PREREQ_INSTALL']
|
||||
end
|
||||
|
||||
desc "Install all python prerequisites for the lms and cms"
|
||||
task :install_python_prereqs => "ws:migrate" do
|
||||
when_changed('requirements/**/*') do
|
||||
unchanged = 'Python requirements unchanged, nothing to install'
|
||||
when_changed(unchanged, 'requirements/**/*') do
|
||||
ENV['PIP_DOWNLOAD_CACHE'] ||= '.pip_download_cache'
|
||||
sh('pip install --exists-action w -r requirements/edx/base.txt')
|
||||
sh('pip install --exists-action w -r requirements/edx/post.txt')
|
||||
|
||||
Reference in New Issue
Block a user