Class: Shards::Repo
- Inherits:
-
Object
- Object
- Shards::Repo
- Defined in:
- lib/shards/repo.rb
Constant Summary collapse
- @@times =
0
Instance Attribute Summary collapse
-
#git ⇒ Object
Returns the value of attribute git.
-
#message ⇒ Object
Returns the value of attribute message.
-
#root ⇒ Object
Returns the value of attribute root.
Instance Method Summary collapse
- #autocommit ⇒ Object
- #autocommit_message ⇒ Object
- #clean ⇒ Object
- #clean_passwd ⇒ Object
- #diff ⇒ Object
-
#initialize ⇒ Repo
constructor
A new instance of Repo.
- #live_branch ⇒ Object
Constructor Details
Instance Attribute Details
#git ⇒ Object
Returns the value of attribute git.
8 9 10 |
# File 'lib/shards/repo.rb', line 8 def git @git end |
#message ⇒ Object
Returns the value of attribute message.
8 9 10 |
# File 'lib/shards/repo.rb', line 8 def @message end |
#root ⇒ Object
Returns the value of attribute root.
8 9 10 |
# File 'lib/shards/repo.rb', line 8 def root @root end |
Instance Method Details
#autocommit ⇒ Object
28 29 30 31 32 33 |
# File 'lib/shards/repo.rb', line 28 def autocommit git.add all: true git.commit git.pull 'origin', live_branch git.push 'origin', live_branch end |
#autocommit_message ⇒ Object
35 36 37 |
# File 'lib/shards/repo.rb', line 35 def "[AUTOCOMMIT] #{}" end |
#clean ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/shards/repo.rb', line 20 def clean @@times+=1 git.reset_hard git.clean force: true, d: true git.branch(live_branch).checkout git.pull 'origin', live_branch end |
#clean_passwd ⇒ Object
44 45 46 |
# File 'lib/shards/repo.rb', line 44 def clean_passwd git.diff.to_s.gsub( /password:\ \w+/, "password: *************") end |
#diff ⇒ Object
39 40 41 42 |
# File 'lib/shards/repo.rb', line 39 def diff git.add all: true clean_passwd end |
#live_branch ⇒ Object
16 17 18 |
# File 'lib/shards/repo.rb', line 16 def live_branch ENV['LIVE_BRANCH'] || 'v5' end |