Module: Sprout

Defined in:
lib/sprout.rb,
lib/sprout/errors.rb,
lib/sprout/system.rb,
lib/sprout/version.rb,
lib/sprout/library.rb,
lib/sprout/concern.rb,
lib/sprout/platform.rb,
lib/sprout/generator.rb,
lib/sprout/executable.rb,
lib/sprout/file_target.rb,
lib/sprout/rdoc_parser.rb,
lib/sprout/progress_bar.rb,
lib/sprout/ruby_feature.rb,
lib/sprout/command_line.rb,
lib/sprout/specification.rb,
lib/sprout/output_buffer.rb,
lib/sprout/executable/url.rb,
lib/sprout/generator/base.rb,
lib/sprout/process_runner.rb,
lib/sprout/executable/urls.rb,
lib/sprout/executable/path.rb,
lib/sprout/executable/base.rb,
lib/sprout/executable/files.rb,
lib/sprout/executable/param.rb,
lib/sprout/executable/paths.rb,
lib/sprout/executable/number.rb,
lib/sprout/remote_file_loader.rb,
lib/sprout/executable/boolean.rb,
lib/sprout/executable/strings.rb,
lib/sprout/remote_file_target.rb,
lib/sprout/executable/file_param.rb,
lib/sprout/executable/string_param.rb,
lib/sprout/executable/collection_param.rb,
lib/sprout/generators/tool/tool_generator.rb,
lib/sprout/generators/ruby/ruby_generator.rb,
lib/sprout/generators/library/library_generator.rb,
lib/sprout/generators/generator/generator_generator.rb

Defined Under Namespace

Modules: Concern, Errors, Executable, Generator, RubyFeature, System, TestHelper, VERSION Classes: ArchiveUnpacker, CommandLine, FileTarget, GeneratorGenerator, Library, LibraryGenerator, OutputBuffer, Platform, ProcessRunner, ProgressBar, ProgressBarImpl, ProgressBarManager, ProgressBarOutputStream, RDocParser, RemoteFileLoader, RemoteFileTarget, ReversedProgressBar, RubyGenerator, Specification, ToolGenerator

Constant Summary

NAME =
'sprout'

Class Method Summary (collapse)

Class Method Details

+ (Dir) cache

where Sprouts will look for downloaded archives.

puts ">> Sprout Cache: #{Sprout.cache}"

Returns:

  • (Dir)

    The system-specific path to the writeable cache directory



63
64
65
# File 'lib/sprout.rb', line 63

def cache
  File.join(home, 'cache')
end

+ (Sprout::System) current_system

determine features like the cache path and how external processes are executed.

system = Sprout.current_system
puts ">> System: #{system.inspect}"

Returns:



95
96
97
# File 'lib/sprout.rb', line 95

def current_system
  Sprout::System.create
end

+ (File) file_from_caller(caller_string)

a Ruby exception.

Note: It's a real bummer that this string is colon delimited - The value on Windows often includes a colon... Once again, Windows is dissed by fundamental Ruby decisions.

Returns:

  • (File)

    Path to the file from the 'caller' property of



122
123
124
125
126
127
128
129
# File 'lib/sprout.rb', line 122

def file_from_caller caller_string
  parts = caller_string.split(':')
  str   = parts.shift
  while(parts.size > 0 && !File.exists?(str))
    str << ":#{parts.shift}"
  end
  str
end

+ (Dir) generator_cache

templates.

puts ">> Generator Cache: #{Sprout.generator_cache}"

Returns:

  • (Dir)

    The location where Sprouts will look for generators and their



83
84
85
# File 'lib/sprout.rb', line 83

def generator_cache
  File.join cache, 'generators'
end

+ (Dir) home

will write files and generators and their templates.

puts ">> Sprout home: #{Sprout.home}"

Returns:

  • (Dir)

    The location where the currently-running version of Sprouts



73
74
75
# File 'lib/sprout.rb', line 73

def home
  File.join(current_system.application_home('sprouts'), Sprout::VERSION::MAJOR_MINOR)
end

+ (Object) stderr



111
112
113
# File 'lib/sprout.rb', line 111

def stderr
  @stderr ||= $stderr
end

+ (Object) stderr=(err)



107
108
109
# File 'lib/sprout.rb', line 107

def stderr=(err)
  @stderr = err
end

+ (Object) stdout



103
104
105
# File 'lib/sprout.rb', line 103

def stdout
  @stdout ||= $stdout
end

+ (Object) stdout=(out)



99
100
101
# File 'lib/sprout.rb', line 99

def stdout=(out)
  @stdout = out
end