Class: Crafti::Git
- Inherits:
-
Object
- Object
- Crafti::Git
- Defined in:
- lib/crafti.rb
Instance Attribute Summary collapse
-
#app_path ⇒ Object
readonly
Returns the value of attribute app_path.
Instance Method Summary collapse
- #add(*args) ⇒ Object
- #commit(message) ⇒ Object
- #git(command) ⇒ Object
- #init ⇒ Object
-
#initialize(app_path, &block) ⇒ Git
constructor
A new instance of Git.
Constructor Details
#initialize(app_path, &block) ⇒ Git
141 142 143 144 |
# File 'lib/crafti.rb', line 141 def initialize(app_path, &block) @app_path = app_path instance_eval(&block) if block_given? end |
Instance Attribute Details
#app_path ⇒ Object (readonly)
Returns the value of attribute app_path.
139 140 141 |
# File 'lib/crafti.rb', line 139 def app_path @app_path end |
Instance Method Details
#add(*args) ⇒ Object
150 151 152 153 154 155 156 157 158 |
# File 'lib/crafti.rb', line 150 def add(*args) cmd = case args.first when :all then "." else files = args.join(' ') end git "add #{cmd}" end |
#commit(message) ⇒ Object
160 161 162 |
# File 'lib/crafti.rb', line 160 def commit() git "commit -am '#{message}'" end |
#git(command) ⇒ Object
164 165 166 |
# File 'lib/crafti.rb', line 164 def git(command) results = system "cd #{app_path} && git #{command}" end |
#init ⇒ Object
146 147 148 |
# File 'lib/crafti.rb', line 146 def init git "init ." end |