8000 angular.js/Rakefile at master · evjan/angular.js · GitHub
[go: up one dir, main page]

Skip to content
< 7532 script type="application/json" data-target="react-app.embeddedData">{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".externalToolBuilders","path":".externalToolBuilders","contentType":"directory"},{"name":".settings","path":".settings","contentType":"directory"},{"name":"css","path":"css","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"example","path":"example","contentType":"directory"},{"name":"i18n","path":"i18n","contentType":"directory"},{"name":"images","path":"images","contentType":"directory"},{"name":"lib","path":"lib","contentType":"directory"},{"name":"logs","path":"logs","contentType":"directory"},{"name":"perf","path":"perf","contentType":"directory"},{"name":"regression","path":"regression","contentType":"directory"},{"name":"src","path":"src","contentType":"directory"},{"name":"test","path":"test","contentType":"directory"},{"name":"tmp","path":"tmp","contentType":"directory"},{"name":".gitattributes","path":".gitattributes","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".project","path":".project","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"CHANGELOG.md","path":"CHANGELOG.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"Rakefile","path":"Rakefile","contentType":"file"},{"name":"angularFiles.js","path":"angularFiles.js","contentType":"file"},{"name":"changelog.js","path":"changelog.js","contentType":"file"},{"name":"changelog.spec.js","path":"changelog.spec.js","contentType":"file"},{"name":"changelog.tmp.md","path":"changelog.tmp.md","contentType":"file"},{"name":"check-size.sh","path":"check-size.sh","contentType":"file"},{"name":"gdocs.js","path":"gdocs.js","contentType":"file"},{"name":"gen_docs.sh","path":"gen_docs.sh","contentType":"file"},{"name":"init-repo.sh","path":"init-repo.sh","contentType":"file"},{"name":"nodeserver.sh","path":"nodeserver.sh","contentType":"file"},{"name":"package.json","path":"package.json","contentType":"file"},{"name":"release-commit.sh","path":"release-commit.sh","contentType":"file"},{"name":"start-iteration.sh","path":"start-iteration.sh","contentType":"file"},{"name":"testacular-e2e.conf.js","path":"testacular-e2e.conf.js","contentType":"file"},{"name":"testacular-jqlite.conf.js","path":"testacular-jqlite.conf.js","contentType":"file"},{"name":"testacular-jquery.conf.js","path":"testacular-jquery.conf.js","contentType":"file"},{"name":"testacular-modules.conf.js","path":"testacular-modules.conf.js","contentType":"file"},{"name":"validate-commit-msg.js","path":"validate-commit-msg.js","contentType":"file"},{"name":"validate-commit-msg.spec.js","path":"validate-commit-msg.spec.js","contentType":"file"},{"name":"version.js","path":"version.js","contentType":"file"},{"name":"version.yaml","path":"version.yaml","contentType":"file"},{"name":"watchr-docs.rb","path":"watchr-docs.rb","contentType":"file"}],"totalCount":44}},"fileTreeProcessingTime":9.160112999999999,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":7108898,"defaultBranch":"master","name":"angular.js","ownerLogin":"evjan","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2012-12-11T09:16:25.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/18362?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1613558935.0926878","canEdit":false,"refType":"branch","currentOid":"59d9b89852805ad08e8e3bc2f80625b9697dc768"},"path":"Rakefile","currentUser":null,"blob":{"rawLines":["require 'yaml'","include FileUtils","","","## High level flow of the build:","##","## clean -\u003e init -\u003e concat -\u003e minify -\u003e package","##","","","content = File.open('angularFiles.js', 'r') {|f| f.read }","files = eval(content.gsub(/\\};(\\s|\\S)*/, '}')."," gsub(/angularFiles = /, '')."," gsub(/:/, '=\u003e')."," gsub(/\\/\\//, '#'));","","BUILD_DIR = 'build'","","task :default =\u003e [:package]","","","desc 'Init the build workspace'","task :init do"," FileUtils.mkdir(BUILD_DIR) unless File.directory?(BUILD_DIR)",""," v = YAML::load( File.open( 'version.yaml' ) )"," match = v['version'].match(/^([^-]*)(-snapshot)?$/)",""," NG_VERSION = Struct.new(:full, :major, :minor, :dot, :codename, :stable)."," new(match[1] + (match[2] ? ('-' + %x(git rev-parse HEAD)[0..7]) : ''),"," match[1].split('.')[0],"," match[1].split('.')[1],"," match[1].split('.')[2].sub(/\\D+.*$/, ''),"," v['codename'],"," v['stable'])","end","","","desc 'Clean Generated Files'","task :clean do"," FileUtils.rm_r(BUILD_DIR, :force =\u003e true)"," FileUtils.mkdir(BUILD_DIR)"," FileUtils.rm_r('test_out', :force =\u003e true)","end","","","desc 'Concat Scenario'","task :concat_scenario =\u003e :init do",""," concat_file('angular-scenario.js', ["," 'lib/jquery/jquery.js',"," 'src/ngScenario/angular.prefix',"," files['angularSrc'],"," files['angularScenario'],"," 'src/ngScenario/angular.suffix',"," ], gen_css('css/angular.css') + \"\\n\" + gen_css('css/angular-scenario.css'))","end","","","","desc 'Concat AngularJS files'","task :concat =\u003e :init do"," concat_file('angular.js', ["," 'src/angular.prefix',"," files['angularSrc'],"," 'src/angular.suffix',"," ], gen_css('css/angular.css', true))",""," FileUtils.cp_r 'src/ngLocale', path_to('i18n')",""," concat_file('angular-loader.js', ["," 'src/loader.prefix',"," 'src/loader.js',"," 'src/loader.suffix'])","",""," concat_module('sanitize', ["," 'src/ngSanitize/sanitize.js',"," 'src/ngSanitize/directive/ngBindHtml.js',"," 'src/ngSanitize/filter/linky.js'])",""," concat_module('resource', ['src/ngResource/resource.js'])"," concat_module('cookies', ['src/ngCookies/cookies.js'])"," concat_module('bootstrap', ['src/bootstrap/bootstrap.js'])"," concat_module('bootstrap-prettify', ['src/bootstrap/bootstrap-prettify.js',"," 'src/bootstrap/google-prettify/prettify.js'],"," gen_css('src/bootstrap/google-prettify/prettify.css', true))","",""," FileUtils.cp 'src/ngMock/angular-mocks.js', path_to('angular-mocks.js')",""," rewrite_file(path_to('angular-mocks.js')) do |content|"," content.sub!('\"NG_VERSION_FULL\"', NG_VERSION.full)"," end","end","","","desc 'Minify JavaScript'","task :minify =\u003e [:init, :concat, :concat_scenario] do"," [ 'angular.js',"," 'angular-cookies.js',"," 'angular-loader.js',"," 'angular-resource.js',"," 'angular-sanitize.js',"," 'angular-bootstrap.js',"," 'angular-bootstrap-prettify.js'"," ].each do |file|"," fork { closure_compile(file) }"," end",""," Process.waitall","end","","","desc 'Generate version.txt file'","task :version =\u003e [:init] do"," `echo #{NG_VERSION.full} \u003e #{path_to('version.txt')}`","end","","","desc 'Generate docs'","task :docs =\u003e [:init] do"," `node docs/src/gen-docs.js`",""," [ path_to('docs/.htaccess'),"," path_to('docs/index.html'),"," path_to('docs/index-debug.html'),"," path_to('docs/index-nocache.html'),"," path_to('docs/index-jq.html'),"," path_to('docs/index-jq-debug.html'),"," path_to('docs/index-jq-nocache.html'),"," path_to('docs/docs-scenario.html')"," ].each do |src|"," rewrite_file(src) do |content|"," content.sub!('\"NG_VERSION_FULL\"', NG_VERSION.full)."," sub('\"NG_VERSION_STABLE\"', NG_VERSION.stable)"," end"," end","end","","","desc 'Create angular distribution'","task :package =\u003e [:clean, :minify, :version, :docs] do"," zip_dir = \"angular-#{NG_VERSION.full}\""," zip_file = \"#{zip_dir}.zip\"",""," FileUtils.ln_s BUILD_DIR, zip_dir"," %x(zip -r #{zip_file} #{zip_dir})"," FileUtils.rm zip_dir",""," FileUtils.mv zip_file, path_to(zip_file)",""," puts \"Package created: #{path_to(zip_file)}\"","end","","","desc 'Start development webserver'","task :webserver, :port do |t, args|"," exec \"node lib/nodeserver/server.js #{args[:port]}\"","end","","","desc 'Run all AngularJS tests'","task :test, :browsers, :misc_options do |t, args|"," [ 'test:jqlite',"," 'test:jquery',"," 'test:modules',"," 'test:e2e'"," ].each do |task|"," Rake::Task[task].invoke(args[:browsers], args[:misc_options])"," end","end","","","namespace :test do",""," desc 'Run all unit tests (single run)'"," task :unit, :browsers, :misc_options do |t, args|"," [ 'test:jqlite',"," 'test:jquery',"," 'test:modules'"," ].each do |task|"," Rake::Task[task].invoke(args[:browsers], args[:misc_options])"," end"," end","",""," desc 'Run jqLite-based unit test suite (single run)'"," task :jqlite, :browsers, :misc_options do |t, args|"," start_testacular('testacular-jqlite.conf.js', true, args[:browsers], args[:misc_options])"," end","",""," desc 'Run jQuery-based unit test suite (single run)'"," task :jquery, :browsers, :misc_options do |t, args|"," start_testacular('testacular-jquery.conf.js', true, args[:browsers], args[:misc_options])"," end","",""," desc 'Run bundled modules unit test suite (single run)'"," task :modules, :browsers, :misc_options do |t, args|"," start_testacular('testacular-modules.conf.js', true, args[:browsers], args[:misc_options])"," end","",""," desc 'Run e2e test suite (single run)'"," task :e2e, :browsers, :misc_options do |t, args|"," start_testacular('testacular-e2e.conf.js', true, args[:browsers], args[:misc_options])"," end","end","","","namespace :autotest do",""," desc 'Run jqLite-based unit test suite (autowatch)'"," task :jqlite, :browsers, :misc_options do |t, args|"," start_testacular('testacular-jqlite.conf.js', false, args[:browsers], args[:misc_options])"," end","",""," desc 'Run jQuery-based unit test suite (autowatch)'"," task :jquery, :browsers, :misc_options do |t, args|"," start_testacular('testacular-jquery.conf.js', false, args[:browsers], args[:misc_options])"," end","end","","","","###################","# utility methods #","###################","","","##","# generates css snippet from a given files and optionally applies simple minification rules","#","def gen_css(cssFile, minify = false)"," css = ''"," File.open(cssFile, 'r') do |f|"," css = f.read"," end",""," if minify"," css.gsub! /\\n/, ''"," css.gsub! /\\/\\*.*?\\*\\//, ''"," css.gsub! /:\\s+/, ':'"," css.gsub! /\\s*\\{\\s*/, '{'"," css.gsub! /\\s*\\}\\s*/, '}'"," css.gsub! /\\s*\\,\\s*/, ','"," css.gsub! /\\s*\\;\\s*/, ';'"," end",""," #escape for js"," css.gsub! /\\\\/, \"\\\\\\\\\\\\\""," css.gsub! /'/, \"\\\\\\\\'\""," css.gsub! /\\n/, \"\\\\n\"",""," return %Q{angular.element(document).find('head').append('\u003cstyle type=\"text/css\"\u003e#{css}\u003c/style\u003e');}","end","","","##","# returns path to the file in the build directory","#","def path_to(filename)"," return File.join(BUILD_DIR, *filename)","end","","","def closure_compile(filename)"," puts \"Minifying #{filename} ...\"",""," min_path = path_to(filename.gsub(/\\.js$/, '.min.js'))",""," %x(java \\"," -client \\"," -d32 \\"," -jar lib/closure-compiler/compiler.jar \\"," --compilation_level SIMPLE_OPTIMIZATIONS \\"," --language_in ECMASCRIPT5_STRICT \\"," --js #{path_to(filename)} \\"," --js_output_file #{min_path})",""," rewrite_file(min_path) do |content|"," content.sub!(\"'use strict';\", \"\")."," sub!(/\\(function\\([^)]*\\)\\{/, \"\\\\0'use strict';\")"," end","end","","","def concat_file(filename, deps, footer='')"," puts \"Creating #{filename} ...\""," File.open(path_to(filename), 'w') do |f|"," concat = 'cat ' + deps.flatten.join(' ')",""," content = %x{#{concat}}."," gsub('\"NG_VERSION_FULL\"', NG_VERSION.full)."," gsub('\"NG_VERSION_MAJOR\"', NG_VERSION.major)."," gsub('\"NG_VERSION_MINOR\"', NG_VERSION.minor)."," gsub('\"NG_VERSION_DOT\"', NG_VERSION.dot)."," gsub('\"NG_VERSION_CODENAME\"', NG_VERSION.codename)."," gsub(/^\\s*['\"]use strict['\"];?\\s*$/, ''). # remove all file-specific strict mode flags"," sub(/\\(function\\([^)]*\\)\\s*\\{/, \"\\\\0\\n'use strict';\") # add single strict mode flag",""," f.write(content)"," f.write(footer)"," end","end","","","def concat_module(name, files, footer='')"," concat_file('angular-' + name + '.js', ['src/module.prefix'] + files + ['src/module.suffix'], footer)","end","","","def rewrite_file(filename)"," File.open(filename, File::RDWR) do |f|"," content = f.read",""," content = yield content",""," raise \"File rewrite failed - No content!\" unless content",""," f.truncate 0"," f.rewind"," f.write content"," end","end","","","def start_testacular(config, singleRun, browsers, misc_options)"," sh \"./node_modules/testacular/bin/testacular start \" +"," \"#{config} \" +"," \"#{'--single-run=true' if singleRun} \" +"," \"#{'--browsers=' + browsers.gsub('+', ',') if browsers} \" +"," \"#{(misc_options || '').gsub('+', ',')}\"","end"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/evjan/angular.js/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"Rakefile","displayUrl":"https://github.com/evjan/angular.js/blob/master/Rakefile?raw=true","headerInfo":{"blobSize":"8.68 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"3a8cc00","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fevjan%2Fangular.js%2Fblob%2Fmaster%2FRakefile","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"337","truncatedSloc":"250"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Ruby","languageID":326,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/evjan/angular.js/blob/master/Rakefile","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/evjan/angular.js/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/evjan/angular.js/raw/refs/heads/master/Rakefile","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"gen_css","kind":"method","ident_start":6217,"ident_end":6224,"extent_start":6213,"extent_end":6736,"fully_qualified_name":"gen_css","ident_utf16":{"start":{"line_number":236,"utf16_col":4},"end":{"line_number":236,"utf16_col":11}},"extent_utf16":{"start":{"line_number":236,"utf16_col":0},"end":{"line_number":258,"utf16_col":3}}},{"name":"path_to","kind":"method","ident_start":6798,"ident_end":6805,"extent_start":6794,"extent_end":6860,"fully_qualified_name":"path_to","ident_utf16":{"start":{"line_number":264,"utf16_col":4},"end":{"line_number":264,"utf16_col":11}},"extent_utf16":{"start":{"line_number":264,"utf16_col":0},"end":{"line_number":266,"utf16_col":3}}},{"name":"closure_compile","kind":"method","ident_start":6867,"ident_end":6882,"extent_start":6863,"extent_end":7397,"fully_qualified_name":"closure_compile","ident_utf16":{"start":{"line_number":269,"utf16_col":4},"end":{"line_number":269,"utf16_col":19}},"extent_utf16":{"start":{"line_number":269,"utf16_col":0},"end":{"line_number":287,"utf16_col":3}}},{"name":"concat_file","kind":"method","ident_start":7404,"ident_end":7415,"extent_start":7400,"extent_end":8145,"fully_qualified_name":"concat_file","ident_utf16":{"start":{"line_number":290,"utf16_col":4},"end":{"line_number":290,"utf16_col":15}},"extent_utf16":{"start":{"line_number":290,"utf16_col":0},"end":{"line_number":307,"utf16_col":3}}},{"name":"concat_module","kind":"method","ident_start":8152,"ident_end":8165,"extent_start":8148,"extent_end":8297,"fully_qualified_name":"concat_module","ident_utf16":{"start":{"line_number":310,"utf16_col":4},"end":{"line_number":310,"utf16_col":17}},"extent_utf16":{"start":{"line_number":310,"utf16_col":0},"end":{"line_number":312,"utf16_col":3}}},{"name":"rewrite_file","kind":"method","ident_start":8304,"ident_end":8316,"extent_start":8300,"extent_end":8540,"fully_qualified_name":"rewrite_file","ident_utf16":{"start":{"line_number":315,"utf16_col":4},"end":{"line_number":315,"utf16_col":16}},"extent_utf16":{"start":{"line_number":315,"utf16_col":0},"end":{"line_number":327,"utf16_col":3}}},{"name":"start_testacular","kind":"method","ident_start":8547,"ident_end":8563,"extent_start":8543,"extent_end":8888,"fully_qualified_name":"start_testacular","ident_utf16":{"start":{"line_number":330,"utf16_col":4},"end":{"line_number":330,"utf16_col":20}},"extent_utf16":{"start":{"line_number":330,"utf16_col":0},"end":{"line_number":336,"utf16_col":3}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/evjan/angular.js/branches":{"post":"zRhQvddpSQekAk5nD9OkquA09HDvUd0_IPswM7nn9xIH9_2TVRnTPO23mX5-Q4g9xvt_e4iIibNFSXiuJQHVuA"},"/repos/preferences":{"post":"P2yam8LT0-NUEDMbykCEbBXRCR7b9GA-tVUn6h15G3MT_WZuDvOofhp8tJqvGd2Pa8EWR5TJGV9FyjFth3YIvg"}}},"title":"angular.js/Rakefile at master · evjan/angular.js","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1b17b3e7786a.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0