mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-10 15:54:42 +00:00
Add support for version numbers in the Rakefile
* version number is stored in version.yaml - work in progress is marked with version number that ends with '-snapshot' * all compiled files are stored in the './build/' directory without version numbers * :package task creates a tarball in the build directory - if version number contains '-snapshot', this substring is replaced with sha of the head - tarball contains version number in the filename - all js files contain version number in the filename * .gitignore was updated to reflect all these changes * the .map file is not created by the closure compiler any more
This commit is contained in:
parent
7530eea703
commit
2e687ee56f
3 changed files with 42 additions and 33 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -1,8 +1,3 @@
|
||||||
angular-minified.map
|
build/
|
||||||
angular.js
|
|
||||||
angular-minified.js
|
|
||||||
angular-debug.js
|
|
||||||
angular-ie-compat.js
|
|
||||||
angular-scenario.js
|
|
||||||
angularjs.netrc
|
angularjs.netrc
|
||||||
jstd.log
|
jstd.log
|
||||||
|
|
|
||||||
64
Rakefile
64
Rakefile
|
|
@ -34,20 +34,15 @@ ANGULAR_SCENARIO = [
|
||||||
'src/scenario/matchers.js',
|
'src/scenario/matchers.js',
|
||||||
]
|
]
|
||||||
|
|
||||||
GENERATED_FILES = [
|
BUILD_DIR = 'build'
|
||||||
'angular-debug.js',
|
|
||||||
'angular-minified.js',
|
|
||||||
'angular-minified.map',
|
|
||||||
'angular-ie-compat.js',
|
|
||||||
'angular-scenario.js',
|
|
||||||
]
|
|
||||||
|
|
||||||
task :default => [:compile, :test]
|
task :default => [:compile, :test]
|
||||||
|
|
||||||
|
|
||||||
desc 'Clean Generated Files'
|
desc 'Clean Generated Files'
|
||||||
task :clean do
|
task :clean do
|
||||||
FileUtils.rm(GENERATED_FILES, :force => true)
|
FileUtils.rm_r(BUILD_DIR, :force => true)
|
||||||
|
FileUtils.mkdir(BUILD_DIR)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -64,7 +59,7 @@ task :compile_scenario do
|
||||||
|
|
||||||
concat = 'cat ' + deps.flatten.join(' ')
|
concat = 'cat ' + deps.flatten.join(' ')
|
||||||
|
|
||||||
File.open('angular-scenario.js', 'w') do |f|
|
File.open(path_to('angular-scenario.js'), 'w') do |f|
|
||||||
f.write(%x{#{concat}})
|
f.write(%x{#{concat}})
|
||||||
f.write(gen_css('css/angular.css') + "\n")
|
f.write(gen_css('css/angular.css') + "\n")
|
||||||
f.write(gen_css('css/angular-scenario.css'))
|
f.write(gen_css('css/angular-scenario.css'))
|
||||||
|
|
@ -87,10 +82,11 @@ task :generate_ie_compat do
|
||||||
|
|
||||||
# create a js file with multipart header containing the extracted images. the entire file *must*
|
# create a js file with multipart header containing the extracted images. the entire file *must*
|
||||||
# be CRLF (\r\n) delimited
|
# be CRLF (\r\n) delimited
|
||||||
File.open('angular-ie-compat.js', 'w') do |f|
|
File.open(path_to('angular-ie-compat.js'), 'w') do |f|
|
||||||
f.write("/*\r\n" +
|
f.write("/*\r\n" +
|
||||||
"Content-Type: multipart/related; boundary=\"_\"\r\n" +
|
"Content-Type: multipart/related; boundary=\"_\"\r\n" +
|
||||||
"\r\n")
|
"\r\n")
|
||||||
|
|
||||||
images.each_index do |idx|
|
images.each_index do |idx|
|
||||||
f.write("--_\r\n" +
|
f.write("--_\r\n" +
|
||||||
"Content-Location:img#{idx}\r\n" +
|
"Content-Location:img#{idx}\r\n" +
|
||||||
|
|
@ -139,7 +135,7 @@ task :compile => [:compile_scenario, :generate_ie_compat] do
|
||||||
'src/angular.suffix',
|
'src/angular.suffix',
|
||||||
]
|
]
|
||||||
|
|
||||||
File.open('angular-debug.js', 'w') do |f|
|
File.open(path_to('angular.js'), 'w') do |f|
|
||||||
concat = 'cat ' + deps.flatten.join(' ')
|
concat = 'cat ' + deps.flatten.join(' ')
|
||||||
f.write(%x{#{concat}})
|
f.write(%x{#{concat}})
|
||||||
f.write(gen_css('css/angular.css', true))
|
f.write(gen_css('css/angular.css', true))
|
||||||
|
|
@ -147,30 +143,36 @@ task :compile => [:compile_scenario, :generate_ie_compat] do
|
||||||
|
|
||||||
%x(java -jar lib/compiler-closure/compiler.jar \
|
%x(java -jar lib/compiler-closure/compiler.jar \
|
||||||
--compilation_level SIMPLE_OPTIMIZATIONS \
|
--compilation_level SIMPLE_OPTIMIZATIONS \
|
||||||
--js angular-debug.js \
|
--js #{path_to('angular.js')} \
|
||||||
--create_source_map ./angular-minified.map \
|
--js_output_file #{path_to('angular.min.js')})
|
||||||
--js_output_file angular-minified.js)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
desc 'Create angular distribution'
|
desc 'Create angular distribution'
|
||||||
task :package => :compile do
|
task :package => :compile do
|
||||||
date = Time.now.strftime('%y%m%d_%H%M')
|
v = YAML::load( File.open( 'version.yaml' ) )['version']
|
||||||
sha = %x(git rev-parse HEAD)[0..7]
|
match = v.match(/^([^-]*)(-snapshot)?$/)
|
||||||
filename = "angular-#{date}-#{sha}.tgz"
|
version = match[1] + (match[2] ? ('-' + %x(git rev-parse HEAD)[0..7]) : '')
|
||||||
|
|
||||||
%x(cp test/angular-mocks.js ./)
|
tarball = "angular-#{version}.tgz"
|
||||||
|
|
||||||
%x(tar -czf #{filename} \
|
pkg_dir = path_to("pkg/angular-#{version}")
|
||||||
angular-debug.js \
|
FileUtils.rm_r(path_to('pkg'), :force => true)
|
||||||
angular-minified.js \
|
FileUtils.mkdir_p(pkg_dir)
|
||||||
angular-scenario.js \
|
|
||||||
angular-mocks.js \
|
|
||||||
angular-ie-compat.js )
|
|
||||||
|
|
||||||
%x( rm angular-mocks.js)
|
['test/angular-mocks.js',
|
||||||
|
path_to('angular.js'),
|
||||||
|
path_to('angular.min.js'),
|
||||||
|
path_to('angular-ie-compat.js'),
|
||||||
|
path_to('angular-scenario.js')
|
||||||
|
].each do |src|
|
||||||
|
dest = src.gsub(/^[^\/]+\//, '').gsub(/((\.min)?\.js)$/, "-#{version}\\1")
|
||||||
|
FileUtils.cp(src, pkg_dir + '/' + dest)
|
||||||
|
end
|
||||||
|
|
||||||
puts "Package created: #{filename}"
|
%x(tar -czf #{path_to(tarball)} -C #{path_to('pkg')} .)
|
||||||
|
|
||||||
|
puts "Package created: #{path_to(tarball)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -239,4 +241,12 @@ def gen_css(cssFile, minify = false)
|
||||||
css.gsub! /\n/, "\\n"
|
css.gsub! /\n/, "\\n"
|
||||||
|
|
||||||
return %Q{document.write('<style type="text/css">#{css}</style>');}
|
return %Q{document.write('<style type="text/css">#{css}</style>');}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# returns path to the file in the build directory
|
||||||
|
#
|
||||||
|
def path_to(filename)
|
||||||
|
return File.join(BUILD_DIR, filename)
|
||||||
|
end
|
||||||
|
|
|
||||||
4
version.yaml
Normal file
4
version.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# <angular/> build config file
|
||||||
|
---
|
||||||
|
version: 0.9.0-snapshot
|
||||||
|
codename: dragonbreath
|
||||||
Loading…
Reference in a new issue