Module: Xmvc

Includes:
Helpers::Sprockets
Defined in:
lib/xmvc/stats.rb,
lib/xmvc.rb,
lib/xmvc/ui.rb,
lib/xmvc/api.rb,
lib/xmvc/cli.rb,
lib/xmvc/test.rb,
lib/xmvc/config.rb,
lib/xmvc/plugin.rb,
lib/xmvc/update.rb,
lib/xmvc/vendor.rb,
lib/xmvc/builder.rb,
lib/xmvc/helpers.rb,
lib/xmvc/generator.rb,
lib/xmvc/vendor/plugin.rb,
lib/xmvc/generators/app.rb,
lib/xmvc/builders/vendor.rb,
lib/xmvc/generators/boot.rb,
lib/xmvc/generators/view.rb,
lib/xmvc/generators/model.rb,
lib/xmvc/generators/layout.rb,
lib/xmvc/helpers/sprockets.rb,
lib/xmvc/generators/scaffold.rb,
lib/xmvc/builders/all_builder.rb,
lib/xmvc/builders/css_builder.rb,
lib/xmvc/generators/controller.rb,
lib/xmvc/generators/environment.rb

Overview

run ruby script/update to update MVC files used inside the baseapp, such as ensuring the files in the ‘script’ folder are up to date`

Defined Under Namespace

Modules: Builder, Generator, Helpers, Stats, Update Classes: API, AllBuilder, AppAlreadyExists, AppNotFound, ArgumentError, BuilderError, CLI, Config, CssBuilder, Error, FileExists, HostError, NoFramework, Plugin, Test, UI, Vendor, VendorFileNotFound

Constant Summary collapse

VERSION =
"0.4.0.a"
ROOT =
File.dirname(__FILE__)
CONFIG_PATH =
"config"
TEMPLATE_PATH =
File.join(ROOT, "xmvc", "generators", "templates")
PUBLIC_PATH =
"public"

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Helpers::Sprockets

included

Class Attribute Details

.config=(value) ⇒ Object (writeonly)

Xmvc


93
94
95
# File 'lib/xmvc.rb', line 93

def config=(value)
  @config = value
end

.environmentObject Also known as: env

The Xmvc::Environemnt instance



69
70
71
# File 'lib/xmvc.rb', line 69

def environment
  @environment
end

.hostObject

An instance of supplied framework plugin, eg ExtJS::MVC::CLI deprecate



76
77
78
# File 'lib/xmvc.rb', line 76

def host
  @host
end

.public_pathObject

Returns the value of attribute public_path.



89
90
91
# File 'lib/xmvc.rb', line 89

def public_path
  @public_path
end

.secretaryObject

An instance of the sprockets secretary



87
88
89
# File 'lib/xmvc.rb', line 87

def secretary
  @secretary
end

.uiObject



149
150
151
# File 'lib/xmvc.rb', line 149

def ui
  @ui ||= UI.new
end

.vendorsObject

Thor


81
82
83
# File 'lib/xmvc.rb', line 81

def vendors
  @vendors
end

Class Method Details

.asset_dir(type) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/xmvc.rb', line 119

def asset_dir(type)
  case type
  when :js
    "javascripts"
  when :css
    "stylesheets"
  when :images
    "images"
  when :sass
    "sass"
  end
end

.asset_mgr(options = {}) ⇒ Object



144
145
146
147
# File 'lib/xmvc.rb', line 144

def asset_mgr(options={})
  warn("Xmvc.asset_mgr is disabled")
  #@asset_mgr ||= Jammit::CLI.new([], options)
end

.build_name(type, name, version = nil, suffix = nil) ⇒ Object



109
110
111
112
113
114
115
116
117
# File 'lib/xmvc.rb', line 109

def build_name(type, name, version=nil, suffix=nil)
  version   = "" if version.nil?
  suffix    = "" if suffix.nil?
  package   = name
  package   += "-#{version}" unless version.empty?
  name      += "-all"
  name      += "-#{suffix}" unless suffix.empty?
  File.join(package, "#{name}.#{type.to_s}")
end

.ensure_in_appObject

Ensure we’re running within a rails app unless generating a new app ($ xmvc generate app foo)



135
136
137
138
139
140
141
142
# File 'lib/xmvc.rb', line 135

def ensure_in_app
  
  # Check for existence of arbitrary app files...see if it *looks* like we're in an Xmvc app.
  unless ARGV.empty? || ARGV.first == "help" || (File.exists?("config") && File.exists?("config/environment.yml"))
    raise Xmvc::AppNotFound.new("This command must be executed from the root of an xmvc application")
  end
  
end

.public_build_path(type, name, version = nil, suffix = nil) ⇒ Object

Parameters:

  • type (Symbol)

    :js, :css, :image

  • name (String)
  • version (String) (defaults to: nil)


100
101
102
# File 'lib/xmvc.rb', line 100

def public_build_path(type, name, version=nil, suffix=nil)      
  File.join(public_path, asset_dir(type), build_name(type, name, version, suffix))
end

.public_build_url(type, name, version = nil, suffix = nil) ⇒ Object

TODO Get rid of following obsolete



105
106
107
# File 'lib/xmvc.rb', line 105

def public_build_url(type, name, version=nil, suffix=nil)
  File.join("/#{PUBLIC_PATH}", asset_dir(type), build_name(type, name, version, suffix))
end