99require 'open3'
1010require 'openstudio'
1111require 'yaml'
12- require 'fileutils'
1312require 'parallel'
1413require 'bcl'
1514
@@ -48,7 +47,7 @@ def initialize(dirname = Dir.pwd, bundle_without = [], options = {})
4847 runner_config = OpenStudio ::Extension ::RunnerConfig . new ( dirname )
4948 # use the default values overriden with runner.conf values where not
5049 # nil nor empty strings
51- @options = @options . merge ( runner_config . options . reject { |k , v | v . nil? || ( v . kind_of ?( String ) && v === '' ) } )
50+ @options = @options . merge ( runner_config . options . reject { |k , v | v . nil? || ( v . is_a ?( String ) && v == '' ) } )
5251 end
5352
5453 if !options . empty?
@@ -61,8 +60,8 @@ def initialize(dirname = Dir.pwd, bundle_without = [], options = {})
6160 @dirname = File . absolute_path ( dirname )
6261
6362 # use passed options, otherwise assume @dirname
64- @gemfile_path = !@options . key? ( :gemfile_path ) || @options [ :gemfile_path ] === '' ? File . join ( @dirname , 'Gemfile' ) : @options [ :gemfile_path ]
65- @bundle_install_path = !@options . key? ( :bundle_install_path ) || @options [ :bundle_install_path ] === '' ? File . join ( @dirname , '.bundle/install/' ) : @options [ :bundle_install_path ]
63+ @gemfile_path = !@options . key? ( :gemfile_path ) || @options [ :gemfile_path ] == '' ? File . join ( @dirname , 'Gemfile' ) : @options [ :gemfile_path ]
64+ @bundle_install_path = !@options . key? ( :bundle_install_path ) || @options [ :bundle_install_path ] == '' ? File . join ( @dirname , '.bundle/install/' ) : @options [ :bundle_install_path ]
6665 @original_dir = Dir . pwd
6766
6867 # gemfile directory
@@ -100,7 +99,7 @@ def initialize(dirname = Dir.pwd, bundle_without = [], options = {})
10099
101100 # check existing config
102101 needs_config = true
103- if conf_bpath = Bundler . configured_bundle_path . explicit_path
102+ if ( conf_bpath = Bundler . configured_bundle_path . explicit_path )
104103 puts 'bundler config exists'
105104 needs_config = false
106105
@@ -362,7 +361,7 @@ def list_measures(measures_dir)
362361 puts "#{ measures . length } MEASURES FOUND"
363362 measures . each do |measure |
364363 name = measure . split ( '/' ) [ -2 ]
365- puts name . to_s
364+ puts name
366365 end
367366 end
368367
@@ -497,9 +496,9 @@ def update_copyright(root_dir, doc_templates_dir)
497496 FileUtils . cp ( File . join ( doc_templates_dir , 'LICENSE.md' ) , File . join ( root_dir , 'LICENSE.md' ) )
498497 end
499498
500- ruby_regex = /^\# \s ?[\# \ * ]{12,}.*copyright.*?\# \s ?[\# \ * ]{12,}\s *$/mi
501- erb_regex = /^<%\s *\# \s ?[\# \ * ]{12,}.*copyright.*?\# \s ?[\# \ * ]{12,}\s *%>$/mi
502- js_regex = /^ \ /\* @preserve.*copyright.*?\* \/ / mi
499+ ruby_regex = /^\# \s ?[\# *]{12,}.*copyright.*?\# \s ?[\# *]{12,}\s *$/mi
500+ erb_regex = /^<%\s *\# \s ?[\# *]{12,}.*copyright.*?\# \s ?[\# *]{12,}\s *%>$/mi
501+ js_regex = %r{^ /\* @preserve.*copyright.*?\* /} mi
503502
504503 filename = File . join ( doc_templates_dir , 'copyright_ruby.txt' )
505504 puts "Copyright file path: #{ filename } "
@@ -542,14 +541,13 @@ def update_copyright(root_dir, doc_templates_dir)
542541 { glob : "#{ root_dir } /**/*.js.erb" , license : js_header_text , regex : js_regex }
543542 ]
544543 # This is the bundle deployment folder
545- excluded_subfolders = [ 'vendor' ] . map { |d | "#{ root_dir } /vendor/bundle" }
546-
544+ excluded_subfolders = [ 'vendor' ] . map { |d | "#{ root_dir } /vendor/bundle" }
547545
548546 puts "Encoding.default_external = #{ Encoding . default_external } "
549547 puts "Encoding.default_internal = #{ Encoding . default_internal } "
550548
551549 paths . each do |path |
552- Dir [ path [ :glob ] ] . reject { |f | excluded_subfolders . any? { |d | f [ d ] } } . each do |dir_file |
550+ Dir [ path [ :glob ] ] . reject { |f | excluded_subfolders . any? { |d | f [ d ] } } . each do |dir_file |
553551 puts "Updating license in file #{ dir_file } "
554552 f = File . read ( dir_file )
555553 if f . match? ( path [ :regex ] )
0 commit comments