Class: Scalerui
- Inherits:
-
Object
- Object
- Scalerui
- Defined in:
- lib/scalerui.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Scalerui
constructor
A new instance of Scalerui.
Constructor Details
#initialize(args) ⇒ Scalerui
Returns a new instance of Scalerui.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/scalerui.rb', line 9 def initialize(args) @args = args # Default Options @options = { :install => false, :upgrade => false, :version => "latest", :assets => nil } # Option Parser optparse = OptionParser.new do |opts| opts. = <<-EOF Scaler UI Framework (c) Copyright 2009 Simon Chiu, Scaler Apps http://ui.scalerapps.com --------------------------------------------------------------------------------------------------------- Usage: scalerui [options] [framework directory] Description: Enables you to easily install, remove, or upgrade Scaler UI for Rails Options: EOF opts.on_tail('--help', "Displays this screen") do puts opts exit end opts.on('--install', "Installs the UI") do @options[:install] = true end opts.on('--remove', "Removes the UI") do @options[:install] = false end opts.on('--version n', "Installs a specific UI version") do |version| @options[:version] = version end opts.on('--dir INSTALL-DIRECTORY', "Rails directoryw here you want to install UI") do |dir| @options[:install_dir] = dir end opts.on('--assets ASSETS-LOCATION', "URL of where your assets are hosted, eg. CDN") do |url| @options[:assets] = url end opts.parse!(@args) # Sets some instance variables @install = @options[:install] @install_dir = @options[:install_dir] raise NoTargetDirectoryError if @install_dir.nil? @assets_dir = @options[:assets] || File.join(@install_dir, "public") @scalerui_dir = File.join(@assets_dir, "scalerui") @images_dir = File.join(@scalerui_dir, "images") @js_dir = File.join(@scalerui_dir, "javascript") @css_dir = File.join(@scalerui_dir, "css") @src_dir = File.join(File.dirname(__FILE__) + "/../src") process end end |