Module: Crafti::RunCommands
- Included in:
- Root
- Defined in:
- lib/crafti.rb
Instance Method Summary collapse
- #bower(*packages) ⇒ Object
- #bundle(command, options = {}) ⇒ Object
-
#git(&block) ⇒ Object
git do init add :all commit ‘First Commit’ end.
- #run(command) ⇒ Object
- #sudo(command) ⇒ Object
Instance Method Details
#bower(*packages) ⇒ Object
113 114 115 116 117 |
# File 'lib/crafti.rb', line 113 def bower(*packages) packages.each do |package| run "bower install #{package}" end end |
#bundle(command, options = {}) ⇒ Object
119 120 121 122 123 124 |
# File 'lib/crafti.rb', line 119 def bundle(command, = {}) opts = [[:with]].flatten.map { |o| "--#{o}" }.join(' ') opts ||= '' run "bundle #{command.to_s} #{opts}" end |
#git(&block) ⇒ Object
git do
init
add :all
commit 'First Commit'
end
133 134 135 |
# File 'lib/crafti.rb', line 133 def git(&block) Git.new(app_path, &block) end |
#run(command) ⇒ Object
105 106 107 |
# File 'lib/crafti.rb', line 105 def run(command) system("cd #{app_path} && #{command}") end |
#sudo(command) ⇒ Object
109 110 111 |
# File 'lib/crafti.rb', line 109 def sudo(command) run "sudo #{command}" end |