Class: Clearsight::Middleman
- Inherits:
-
Object
- Object
- Clearsight::Middleman
- Includes:
- Methadone::CLILogging, Methadone::SH
- Defined in:
- lib/clearsight/middleman.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
Instance Method Summary collapse
- #clone ⇒ Object
- #create(project) ⇒ Object
-
#initialize(args) ⇒ Middleman
constructor
A new instance of Middleman.
- #pass ⇒ Object
- #run ⇒ Object
- #setup ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(args) ⇒ Middleman
Returns a new instance of Middleman.
8 9 10 |
# File 'lib/clearsight/middleman.rb', line 8 def initialize(args) @args = args end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
6 7 8 |
# File 'lib/clearsight/middleman.rb', line 6 def args @args end |
Instance Method Details
#clone ⇒ Object
28 29 30 31 32 |
# File 'lib/clearsight/middleman.rb', line 28 def clone print "Cloning ClearSight middleman template..." sh "git clone [email protected]:clearsightstudio/middleman-template.git ~/.middleman/clearsight" puts "done." end |
#create(project) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/clearsight/middleman.rb', line 40 def create(project) setup print "Setting up new middleman project..." sh "middleman init -T=clearsight #{project}" puts "done." end |
#pass ⇒ Object
20 21 22 |
# File 'lib/clearsight/middleman.rb', line 20 def pass sh "middleman #{@args.join(' ')}" end |
#run ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/clearsight/middleman.rb', line 12 def run if @args.first == "new" create @args[1] else pass end end |
#setup ⇒ Object
24 25 26 |
# File 'lib/clearsight/middleman.rb', line 24 def setup File.exist?("#{ENV['HOME']}/.middleman/clearsight") ? update : clone end |
#update ⇒ Object
34 35 36 37 38 |
# File 'lib/clearsight/middleman.rb', line 34 def update print "Updating ClearSight middleman template..." sh "cd ~/.middleman/clearsight && git pull && cd -" puts "done." end |