Class: Unixoid::Git
- Inherits:
-
Object
- Object
- Unixoid::Git
- Extended by:
- Forwardable
- Defined in:
- lib/unixoid/git.rb
Instance Method Summary collapse
- #add(file) ⇒ Object
- #add_remote ⇒ Object
- #commit_results ⇒ Object
- #configure(name, email) ⇒ Object
- #configured? ⇒ Boolean
- #create_repo ⇒ Object
-
#initialize(github) ⇒ Git
constructor
A new instance of Git.
- #push_results ⇒ Object
- #remove_remote ⇒ Object
- #submit(file) ⇒ Object
Constructor Details
Instance Method Details
#add(file) ⇒ Object
30 31 32 |
# File 'lib/unixoid/git.rb', line 30 def add(file) run("git add #{file}") end |
#add_remote ⇒ Object
38 39 40 |
# File 'lib/unixoid/git.rb', line 38 def add_remote run("git remote add origin https://:username::[email protected]/:username/unixoid_submission.git", params: {username: username, password: password}) end |
#commit_results ⇒ Object
34 35 36 |
# File 'lib/unixoid/git.rb', line 34 def commit_results run("git commit -m 'Unixoid submission'") end |
#configure(name, email) ⇒ Object
54 55 56 57 |
# File 'lib/unixoid/git.rb', line 54 def configure(name, email) run("git config --global user.name :name", params: {name: name}) run("git config --global user.email :email", params: {email: email}) end |
#configured? ⇒ Boolean
50 51 52 |
# File 'lib/unixoid/git.rb', line 50 def configured? run('git config --get user.email', outcodes: [0, 1]) != '' && run('git config --get user.name', outcodes: [0, 1]) != '' end |
#create_repo ⇒ Object
26 27 28 |
# File 'lib/unixoid/git.rb', line 26 def create_repo run('git init') end |
#push_results ⇒ Object
42 43 44 |
# File 'lib/unixoid/git.rb', line 42 def push_results run('git push --force -u origin master') end |
#remove_remote ⇒ Object
46 47 48 |
# File 'lib/unixoid/git.rb', line 46 def remove_remote run('git remote rm origin') end |
#submit(file) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/unixoid/git.rb', line 17 def submit(file) create_repo add(file) commit_results add_remote push_results remove_remote end |