Module: Rapid

Defined in:
lib/rapid/check.rb,
lib/rapid/error.rb,
lib/rapid/module.rb,
lib/rapid/railtie.rb,
lib/rapid/version.rb,
lib/rapid/settings.rb,
lib/rapid/web/base.rb,
lib/rapid/setting/base.rb,
lib/rapid/skeleton/base.rb,
lib/rapid/spec/template.rb,
lib/rapid/template/base.rb,
lib/rapid/web/bootstrap.rb,
lib/rapid/web/navigator.rb,
lib/rapid/setting/module.rb,
lib/rapid/setting/definer.rb,
lib/rapid/template/parser.rb,
lib/rapid/setting/comments.rb,
lib/rapid/template/node/base.rb,
lib/rapid/template/node/root.rb,
lib/rapid/web/select_helpers.rb,
lib/rapid/web/static_helpers.rb,
lib/rapid/skeleton/helpers/gem.rb,
lib/rapid/template/node/static.rb,
lib/rapid/skeleton/helpers/view.rb,
lib/rapid/template/node/if_node.rb,
lib/rapid/template/pulling/base.rb,
lib/rapid/setting/namespace/base.rb,
lib/rapid/setting/string_setting.rb,
lib/rapid/skeleton/helpers/files.rb,
lib/rapid/skeleton/helpers/route.rb,
lib/rapid/template/node/variable.rb,
lib/rapid/web/controller_helpers.rb,
lib/rapid/setting/boolean_setting.rb,
lib/rapid/setting/integer_setting.rb,
lib/rapid/skeleton/helpers/script.rb,
lib/rapid/skeleton/helpers/template.rb,
lib/rapid/template/pulling/explicit.rb,
lib/rapid/web/settings_form_builder.rb,
lib/rapid/setting/namespace/instance.rb,
lib/rapid/setting/nested_validations.rb,
lib/rapid/skeleton/helpers/directory.rb,
lib/rapid/skeleton/helpers/migration.rb,
lib/rapid/template/node/comment_node.rb,
lib/rapid/template/pulling/forgiving.rb,
lib/rapid/skeleton/helpers/if_setting.rb

Defined Under Namespace

Modules: Setting, Settings, Skeleton, Spec, Template, Web Classes: Check, CheckError, Exception, FileNotFoundCheckError, InvalidSettingError, InvalidSkeletonError, InvalidTemplateError, InvalidYamlError, NotMatchingTemplateError, ProjectFileNotFoundError, Railtie, SettingError, SettingLoadError, SkeletonError, TemplateError, TemplateNotFoundError, TemplateRenderError, UnknownMethodTemplateError, UnknownSettingError

Constant Summary collapse

VERSION =
"0.2.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.middlewareObject

Returns the value of attribute middleware.



5
6
7
# File 'lib/rapid/module.rb', line 5

def middleware
  @middleware
end

.view_pathObject

Returns the value of attribute view_path.



5
6
7
# File 'lib/rapid/module.rb', line 5

def view_path
  @view_path
end

Class Method Details

.color_puts(type, message) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rapid/module.rb', line 18

def color_puts type, message
  case type
  when :ok
    puts green(message)
    
  when :warning
    puts yellow(message)
    
  when :error
    puts red(message)
    
  when :info
    puts gray(message)
    
  else
    raise "Invalid type: #{type.inspect}"
  end
end

.colorize(text, color_code) ⇒ Object

from rspec



9
10
11
# File 'lib/rapid/module.rb', line 9

def colorize(text, color_code)
  "#{color_code}#{text}\e[0m"
end

.gray(text) ⇒ Object



16
# File 'lib/rapid/module.rb', line 16

def gray(text); colorize(text, "\e[90m"); end

.green(text) ⇒ Object



14
# File 'lib/rapid/module.rb', line 14

def green(text); colorize(text, "\e[32m"); end

.red(text) ⇒ Object



13
# File 'lib/rapid/module.rb', line 13

def red(text); colorize(text, "\e[31m"); end

.use_middleware(middleware) ⇒ Object



37
38
39
40
# File 'lib/rapid/module.rb', line 37

def use_middleware middleware
  @middleware ||= []
  @middleware.push middleware
end

.yellow(text) ⇒ Object



15
# File 'lib/rapid/module.rb', line 15

def yellow(text); colorize(text, "\e[33m"); end