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

Skip to content
{"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":".gitignore","path":".gitignore","contentType":"file"},{"name":".project","path":".project","contentType":"file"},{"name":"CHANGELOG.md","path":"CHANGELOG.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":"angularjs.ftp","path":"angularjs.ftp","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":"gen_jstd_configs.js","path":"gen_jstd_configs.js","contentType":"file"},{"name":"java","path":"java","contentType":"file"},{"name":"link-docs.sh","path":"link-docs.sh","contentType":"file"},{"name":"nodeserver.sh","path":"nodeserver.sh","contentType":"file"},{"name":"package.json","path":"package.json","contentType":"file"},{"name":"pom.xml","path":"pom.xml","contentType":"file"},{"name":"release-commit.sh","path":"release-commit.sh","contentType":"file"},{"name":"server-coverage.sh","path":"server-coverage.sh","contentType":"file"},{"name":"server-scenario.sh","path":"server-scenario.sh","contentType":"file"},{"name":"server.sh","path":"server.sh","contentType":"file"},{"name":"start-iteration.sh","path":"start-iteration.sh","contentType":"file"},{"name":"test-coverage.sh","path":"test-coverage.sh","contentType":"file"},{"name":"test-jquery.sh","path":"test-jquery.sh","contentType":"file"},{"name":"test-modules.sh","path":"test-modules.sh","contentType":"file"},{"name":"test-perf.sh","path":"test-perf.sh","contentType":"file"},{"name":"test-reset.sh","path":"test-reset.sh","contentType":"file"},{"name":"test-scenario.sh","path":"test-scenario.sh","contentType":"file"},{"name":"test.sh","path":"test.sh","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"},{"name":"watchr.rb","path":"watchr.rb","contentType":"file"}],"totalCount":50}},"fileTreeProcessingTime":10.027903,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":4633117,"defaultBranch":"master","name":"angular.js","ownerLogin":"kevan","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2012-06-12T04:05:52.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/354812?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1613559092.2691681","canEdit":false,"refType":"branch","currentOid":"fc0b2b5715655a05cbb4c8e79969c95d7e7ce8b7"},"path":"Rakefile","currentUser":null,"blob":{"rawLines":["require 'yaml'","include FileUtils","","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 [:compile, :test]","","","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)."," 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'])","end","","","desc 'Clean Generated Files'","task :clean do"," FileUtils.rm_r(BUILD_DIR, :force =\u003e true)"," FileUtils.mkdir(BUILD_DIR)","end","","","desc 'Compile Scenario'","task :compile_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 'Compile JSTD Scenario Adapter'","task :compile_jstd_scenario_adapter =\u003e :init do",""," concat_file('jstd-scenario-adapter.js', ["," 'src/ngScenario/jstd-scenario-adapter/angular.prefix',"," 'src/ngScenario/jstd-scenario-adapter/Adapter.js',"," 'src/ngScenario/jstd-scenario-adapter/angular.suffix',"," ])",""," # TODO(vojta) use jstd configuration when implemented"," # (instead of including jstd-adapter-config.js)"," File.open(path_to('jstd-scenario-adapter-config.js'), 'w') do |f|"," f.write(\"/**\\r\\n\" +"," \" * Configuration for jstd scenario adapter \\n */\\n\" +"," \"var jstdScenarioAdapter = {\\n relativeUrlPrefix: '/build/docs/'\\n};\\n\")"," end","end","","","desc 'Compile JavaScript'","task :compile =\u003e [:init, :compile_scenario, :compile_jstd_scenario_adapter] 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')",""," closure_compile('angular.js')"," closure_compile('angular-cookies.js')"," closure_compile('angular-loader.js')"," closure_compile('angular-resource.js')"," closure_compile('angular-sanitize.js')"," closure_compile('angular-bootstrap.js')"," closure_compile('angular-bootstrap-prettify.js')","","end","","","desc 'Generate docs'","task :docs =\u003e [:init] do"," `node docs/src/gen-docs.js`"," rewrite_file(path_to('docs/.htaccess')) do |content|"," content.sub!('\"NG_VERSION_FULL\"', NG_VERSION.full)"," end","end","","","desc 'Create angular distribution'","task :package =\u003e [:clean, :compile, :docs] do"," tarball = \"angular-#{NG_VERSION.full}.tgz\"",""," pkg_dir = path_to(\"pkg/angular-#{NG_VERSION.full}\")"," FileUtils.rm_r(path_to('pkg'), :force =\u003e true)"," FileUtils.mkdir_p(pkg_dir)",""," [ path_to('angular.js'),"," path_to('angular.min.js'),"," path_to('angular-loader.js'),"," path_to('angular-loader.min.js'),"," path_to('angular-bootstrap.js'),"," path_to('angular-bootstrap.min.js'),"," path_to('angular-bootstrap-prettify.js'),"," path_to('angular-bootstrap-prettify.min.js'),"," path_to('angular-mocks.js'),"," path_to('angular-cookies.js'),"," path_to('angular-cookies.min.js'),"," path_to('angular-resource.js'),"," path_to('angular-resource.min.js'),"," path_to('angular-sanitize.js'),"," path_to('angular-sanitize.min.js'),"," path_to('angular-scenario.js'),"," path_to('jstd-scenario-adapter.js'),"," path_to('jstd-scenario-adapter-config.js'),"," ].each do |src|"," dest = src.gsub(/^.*\\//, '').gsub(/((\\.min)?\\.js)$/, \"-#{NG_VERSION.full}\\\\1\")"," FileUtils.cp(src, pkg_dir + '/' + dest)"," end",""," FileUtils.cp_r path_to('i18n'), \"#{pkg_dir}/i18n-#{NG_VERSION.full}\""," FileUtils.cp_r path_to('docs'), \"#{pkg_dir}/docs-#{NG_VERSION.full}\"",""," rewrite_file(\"#{pkg_dir}/angular-mocks-#{NG_VERSION.full}.js\") do |content|"," content.sub!('\"NG_VERSION_FULL\"', NG_VERSION.full)"," end","",""," [ \"#{pkg_dir}/docs-#{NG_VERSION.full}/index.html\","," \"#{pkg_dir}/docs-#{NG_VERSION.full}/index-jq.html\","," \"#{pkg_dir}/docs-#{NG_VERSION.full}/index-nocache.html\","," \"#{pkg_dir}/docs-#{NG_VERSION.full}/index-jq-nocache.html\","," \"#{pkg_dir}/docs-#{NG_VERSION.full}/index-debug.html\","," \"#{pkg_dir}/docs-#{NG_VERSION.full}/index-jq-debug.html\""," ].each do |src|"," rewrite_file(src) do |content|"," content.gsub!(/'angular(.*)\\.js/, '\\'angular\\1-' + NG_VERSION.full + '.js')"," end"," end","",""," rewrite_file(\"#{pkg_dir}/docs-#{NG_VERSION.full}/docs-scenario.html\") do |content|"," content.sub!('angular-scenario.js', \"angular-scenario-#{NG_VERSION.full}.js\")"," end","",""," [ \"#{pkg_dir}/docs-#{NG_VERSION.full}/appcache.manifest\","," \"#{pkg_dir}/docs-#{NG_VERSION.full}/appcache-offline.manifest\""," ].each do |src|"," rewrite_file(src) do |content|"," content.sub!('../angular.min.js', \"angular-#{NG_VERSION.full}.min.js\")."," sub!('/build/docs/', \"/#{NG_VERSION.full}/docs-#{NG_VERSION.full}/\")"," end"," end","",""," %x(tar -czf #{path_to(tarball)} -C #{path_to('pkg')} .)",""," FileUtils.cp path_to(tarball), pkg_dir"," FileUtils.mv pkg_dir, path_to(['pkg', NG_VERSION.full])",""," puts \"Package created: #{path_to(tarball)}\"","end","","","namespace :server do",""," desc 'Run JsTestDriver Server'"," task :start do"," sh %x(java -jar lib/jstestdriver/JsTestDriver.jar --browser open --port 9876)"," end",""," desc 'Run JavaScript tests against the server'"," task :test do"," sh %(java -jar lib/jstestdriver/JsTestDriver.jar --tests all)"," end","","end","","","desc 'Run JavaScript tests'","task :test do"," sh %(java -jar lib/jstestdriver/JsTestDriver.jar --tests all --browser open --port 9876)","end","","","desc 'Lint'","task :lint do"," out = %x(lib/jsl/jsl -conf lib/jsl/jsl.default.conf)"," print out","end","","","desc 'push_angularjs'","task :push_angularjs =\u003e :compile do"," sh %(cat angularjs.ftp | ftp -N angularjs.netrc angularjs.org)","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 \"Compiling #{filename} ...\"",""," min_path = path_to(filename.gsub(/\\.js$/, '.min.js'))",""," %x(java -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 \"Building #{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"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/kevan/angular.js/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"Rakefile","displayUrl":"https://github.com/kevan/angular.js/blob/master/Rakefile?raw=true","headerInfo":{"blobSize":"9.16 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":"9c18da9","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fkevan%2Fangular.js%2Fblob%2Fmaster%2FRakefile","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"328","truncatedSloc":"246"},"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":"/kevan/angular.js/blob/master/Rakefile","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/kevan/angular.js/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/kevan/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":7099,"ident_end":7106,"extent_start":7095,"extent_end":7618,"fully_qualified_name":"gen_css","ident_utf16":{"start":{"line_number":239,"utf16_col":4},"end":{"line_number":239,"utf16_col":11}},"extent_utf16":{"start":{"line_number":239,"utf16_col":0},"end":{"line_number":261,"utf16_col":3}}},{"name":"path_to","kind":"method","ident_start":7680,"ident_end":7687,"extent_start":7676,"extent_end":7742,"fully_qualified_name":"path_to","ident_utf16":{"start":{"line_number":267,"utf16_col":4},"end":{"line_number":267,"utf16_col":11}},"extent_utf16":{"start":{"line_number":267,"utf16_col":0},"end":{"line_number":269,"utf16_col":3}}},{"name":"closure_compile","kind":"method","ident_start":7749,"ident_end":7764,"extent_start":7745,"extent_end":8236,"fully_qualified_name":"closure_compile","ident_utf16":{"start":{"line_number":272,"utf16_col":4},"end":{"line_number":272,"utf16_col":19}},"extent_utf16":{"start":{"line_number":272,"utf16_col":0},"end":{"line_number":287,"utf16_col":3}}},{"name":"concat_file","kind":"method","ident_start":8243,"ident_end":8254,"extent_start":8239,"extent_end":8984,"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":8991,"ident_end":9004,"extent_start":8987,"extent_end":9136,"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":9143,"ident_end":9155,"extent_start":9139,"extent_end":9379,"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}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/kevan/angular.js/branches":{"post":"8OEWvOWSNPHz7UgrOucs2okiGlYq0BQ_qYLXkLLkbaZnPJ2Tsfbk8lnzccWgjs2Gl6o2yP6PkE0-LE13wcYh3w"},"/repos/preferences":{"post":"_EiFd2rr2nUMS9pCzrGmv76E7FRyU4Tr9Wrdi5NyzRDRFC8guyVCvweVqFgTfRtmD_enPuuXRvwJ46qOMoZ76w"}}},"title":"angular.js/Rakefile at master · kevan/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