Module: Preproc

Defined in:
lib/preproc.rb,
lib/preproc/version.rb

Defined Under Namespace

Classes: IncludeReader

Constant Summary collapse

MAJOR =

todo: namespace inside version or something - why? why not??

0
MINOR =
1
PATCH =
0
VERSION =
[MAJOR,MINOR,PATCH].join('.')

Class Method Summary collapse

Class Method Details

version string for generator meta tag (includes ruby version)



15
16
17
# File 'lib/preproc/version.rb', line 15

def self.banner
  "preproc/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end

.fetcher_read_utf8!(src) ⇒ Object

todo/fix: use/find better name? - e.g. Fetcher.read_utf8!() move out of global ns etc.

 move to Fetcher gem; (re)use!!! remove here
e.g. use Fetch.read_utf8!()  e.g. throws exception on error
                read_blob!()


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/preproc.rb', line 21

def self.fetcher_read_utf8!( src )
  worker = Fetcher::Worker.new
  res = worker.get_response( src )
  if res.code != '200'
    puts "sorry; failed to fetch >#{src} - HTTP #{res.code} - #{res.message}"
    exit 1
  end

  ###
  # Note: Net::HTTP will NOT set encoding UTF-8 etc.
  #  will be set to ASCII-8BIT == BINARY == Encoding Unknown; Raw Bytes Here
  #  thus, set/force encoding to utf-8
  txt = res.body.to_s
  txt = txt.force_encoding( Encoding::UTF_8 )
  txt
end

.rootObject



19
20
21
# File 'lib/preproc/version.rb', line 19

def self.root
  "#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
end

.versionObject



10
11
12
# File 'lib/preproc/version.rb', line 10

def self.version
  VERSION
end