Class: Serve::Project
- Inherits:
-
Object
- Object
- Serve::Project
- Includes:
- JavaScripts, Out
- Defined in:
- lib/serve/project.rb
Overview
Serve::Project.new(options).create Serve::Project.new(options).convert
Constant Summary
Constant Summary
Constants included from JavaScripts
JavaScripts::GOOGLE_AJAX_APIS, JavaScripts::JAVASCRIPT_FRAMEWORKS, JavaScripts::JQUERY_UI_VERSION, JavaScripts::JQUERY_VERSION, JavaScripts::MOOTOOLS_VERSION, JavaScripts::PROTOTYPE_VERSION, JavaScripts::SCRIPTACULOUS_VERSION
Constants included from Out
Instance Attribute Summary (collapse)
-
- (Object) framework
readonly
:nodoc:.
-
- (Object) location
readonly
:nodoc:.
-
- (Object) name
readonly
:nodoc:.
Instance Method Summary (collapse)
-
- (Object) convert
Convert an existing Compass project to a Serve project.
-
- (Object) create
Create a new Serve project.
-
- (Project) initialize(options)
constructor
A new instance of Project.
Methods included from JavaScripts
#fetch_javascript, #javascript_filename, #javascript_framework_url, #jquery_ui_url, #jquery_url, #mootools_url, #prototype_url, #scriptaculous_url, #supported_javascript_frameworks, #valid_javascript_framework?
Methods included from Out
#color, #color_msg, #log_action, #print, #puts, #stderr, #stderr=, #stdout, #stdout=
Constructor Details
- (Project) initialize(options)
A new instance of Project
13 14 15 16 17 18 |
# File 'lib/serve/project.rb', line 13 def initialize() @name = [:name] @location = normalize_location([:directory], @name) @full_name = git_config('user.name') || 'Your Full Name' @framework = [:framework] end |
Instance Attribute Details
- (Object) framework (readonly)
:nodoc:
11 12 13 |
# File 'lib/serve/project.rb', line 11 def framework @framework end |
- (Object) location (readonly)
:nodoc:
11 12 13 |
# File 'lib/serve/project.rb', line 11 def location @location end |
- (Object) name (readonly)
:nodoc:
11 12 13 |
# File 'lib/serve/project.rb', line 11 def name @name end |
Instance Method Details
- (Object) convert
Convert an existing Compass project to a Serve project
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/serve/project.rb', line 38 def convert setup_base move_file 'images', 'public/' move_file 'stylesheets', 'public/' if File.directory? 'javascripts' move_file 'javascripts', 'public/' else make_path 'public/javascripts' end move_file 'src', 'sass' install_javascript_framework @framework note_old_compass_config end |
- (Object) create
Create a new Serve project
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/serve/project.rb', line 21 def create setup_base %w( public/images public/javascripts public/stylesheets sass ).each { |path| make_path path } create_file 'sass/application.sass', read_template('application.sass') create_file 'views/_layout.html.erb', read_template('_layout.html.erb') create_file 'views/hello.html.erb', read_template('hello.html.erb') create_file 'views/view_helpers.rb', read_template('view_helpers.rb') create_file 'views/index.redirect', read_template('index.redirect') install_javascript_framework @framework end |