Class: Speckle::CLI::RakeApp
- Inherits:
-
Object
- Object
- Speckle::CLI::RakeApp
- Defined in:
- lib/speckle/cli/rake_app.rb
Instance Method Summary collapse
- #configure_rake ⇒ Object
- #debug ⇒ Object
- #get_builder ⇒ Object
-
#initialize(options) ⇒ RakeApp
constructor
A new instance of RakeApp.
- #inputs ⇒ Object
- #invoke_task(name) ⇒ Object
- #rake ⇒ Object
- #rake_env(key, value) ⇒ Object
- #test_build_dir ⇒ Object
- #test_compiled ⇒ Object
- #test_libs ⇒ Object
- #test_sources ⇒ Object
- #to_int(option) ⇒ Object
- #verbose ⇒ Object
Constructor Details
#initialize(options) ⇒ RakeApp
13 14 15 |
# File 'lib/speckle/cli/rake_app.rb', line 13 def initialize() = end |
Instance Method Details
#configure_rake ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/speckle/cli/rake_app.rb', line 58 def configure_rake rake_env('TEST_SOURCES', test_sources) rake_env('TEST_LIBS', test_libs) rake_env('BUILD_DIR', test_build_dir) rake_env('TEST_COMPILED', test_compiled) rake_env('TEST_VIM', .vim) rake_env('TEST_REPORTER', .reporter) rake_env('SLOW_THRESHOLD', .slow_threshold.to_s) rake_env('SKIP_VIMRC', to_int(.skip_vimrc)) rake_env('COLORIZE', to_int(.colorize)) rake_env('BAIL', to_int(.bail)) rake_env('TAG', .tag) if .verbose rake_env('VERBOSE', 'yes') end if .debug rake_env('DEBUG', 'yes') end end |
#debug ⇒ Object
25 26 27 |
# File 'lib/speckle/cli/rake_app.rb', line 25 def debug .debug end |
#get_builder ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/speckle/cli/rake_app.rb', line 99 def get_builder if @source_builder.nil? @source_builder = Speckle::List::Builder.new .inputs.each do |input| @source_builder.add_source input end @source_builder.add_filter Speckle::List::DirExpander.new('**/*_spec.riml') unless .tag.nil? @source_builder.add_filter Speckle::List::FileContentFilter.new(.tag, false) end unless .grep_pattern.nil? @source_builder.add_filter Speckle::List::PatternFilter.new(.grep_pattern, .grep_invert) end # Not using this at the moment, as it's simpler to not rebuild the source paths for test_compiled #@source_builder.add_filter Speckle::List::AbsolutePathTransformer.new #@source_builder.add_filter Speckle::List::ExtensionTransformer.new('vim') end @source_builder end |
#inputs ⇒ Object
17 18 19 |
# File 'lib/speckle/cli/rake_app.rb', line 17 def inputs .inputs end |
#invoke_task(name) ⇒ Object
45 46 47 48 49 |
# File 'lib/speckle/cli/rake_app.rb', line 45 def invoke_task(name) #puts "invoke_task: #{name}" #rake rake.invoke_task("speckle:#{name.to_s}") end |
#rake ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/speckle/cli/rake_app.rb', line 29 def rake if @rake_app return @rake_app end configure_rake Dir.chdir .root_dir @rake_app = Rake.application @rake_app.init @rake_app.load_rakefile Dir.chdir .cwd @rake_app end |
#rake_env(key, value) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/speckle/cli/rake_app.rb', line 51 def rake_env(key, value) unless value.nil? ENV[key] = if value.is_a?(Array) then value.join(';') else value end puts "rake_env: #{key} = #{ENV[key]}" if debug end end |
#test_build_dir ⇒ Object
84 85 86 |
# File 'lib/speckle/cli/rake_app.rb', line 84 def test_build_dir "#{@options.cwd}/build" end |
#test_compiled ⇒ Object
92 93 94 95 96 97 |
# File 'lib/speckle/cli/rake_app.rb', line 92 def test_compiled sources = test_sources sources.collect do |source| source.ext('vim') end end |
#test_libs ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/speckle/cli/rake_app.rb', line 124 def test_libs input_libs = .libs return nil if input_libs.nil? input_libs = input_libs.split(':') input_libs << 'spec' if File.directory?(.speckle_lib_dir) input_libs << .speckle_lib_dir end libs = [] input_libs.each do |lib| libs << File.absolute_path(lib) end libs.join(':') end |
#test_sources ⇒ Object
88 89 90 |
# File 'lib/speckle/cli/rake_app.rb', line 88 def test_sources get_builder.build end |
#to_int(option) ⇒ Object
80 81 82 |
# File 'lib/speckle/cli/rake_app.rb', line 80 def to_int(option) option ? '1' : '0' end |
#verbose ⇒ Object
21 22 23 |
# File 'lib/speckle/cli/rake_app.rb', line 21 def verbose .verbose end |