Class: Cup::CommandLine
- Inherits:
-
Thor
- Object
- Thor
- Cup::CommandLine
- Includes:
- Thor::Actions
- Defined in:
- lib/cup/command_line.rb
Defined Under Namespace
Classes: Helper
Instance Method Summary collapse
- #build ⇒ Object
- #concatenate ⇒ Object
- #create(name) ⇒ Object
- #ify ⇒ Object
- #minify ⇒ Object
- #rackup ⇒ Object
- #server(port = 5555) ⇒ Object
- #version ⇒ Object
Instance Method Details
#build ⇒ Object
159 160 161 |
# File 'lib/cup/command_line.rb', line 159 def build Cup.build! :cli => self end |
#concatenate ⇒ Object
164 165 166 |
# File 'lib/cup/command_line.rb', line 164 def concatenate $stdout.puts Cup.concatenate! end |
#create(name) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/cup/command_line.rb', line 131 def create(name) unless valid_cup_name?(name) raise "#{name} is not a valid filename (letters, numbers, underscore and dashes only)" end helper = Helper.new(name) if Dir.exists? helper.root say_status :halted, "Cannot cup '#{name}'. A directory of that name already exists", :red return end cupify_with helper, name end |
#ify ⇒ Object
148 149 150 151 152 153 154 155 156 |
# File 'lib/cup/command_line.rb', line 148 def ify path = current_path name = File.basename(path) name = 'new cup' unless valid_cup_name? name helper = Helper.new(path) cupify_with(helper, name) end |
#minify ⇒ Object
169 170 171 |
# File 'lib/cup/command_line.rb', line 169 def minify $stdout.puts Cup.minify! end |
#rackup ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/cup/command_line.rb', line 192 def rackup helper = pwd_helper return no_cupfile unless helper.cupfile? create_file helper.rackup_file, <<-CONFIG_RU require 'rubygems' # for ruby 1.8.x require 'rack' require 'cup/server/app' run Cup::Server::App CONFIG_RU end |
#server(port = 5555) ⇒ Object
174 175 176 177 178 179 180 181 182 183 |
# File 'lib/cup/command_line.rb', line 174 def server(port=5555) helper = pwd_helper return no_cupfile unless helper.cupfile? say(shell.set_color "cup server for '#{Cup.cup_name}' starting on port #{port}", :cyan, true) Cup::Server::App.set :port => port Cup::Server::App.run! end |