Class: Luna::Binary::Delete
- Inherits:
-
Object
- Object
- Luna::Binary::Delete
- Defined in:
- lib/luna/binary/delete.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #delete ⇒ Object
- #deleteBinaryFramework ⇒ Object
- #deleteRepo ⇒ Object
-
#initialize(name, version) ⇒ Delete
constructor
A new instance of Delete.
- #validate! ⇒ Object
Constructor Details
#initialize(name, version) ⇒ Delete
Returns a new instance of Delete.
14 15 16 17 18 |
# File 'lib/luna/binary/delete.rb', line 14 def initialize(name, version) @name = name @version = version validate! end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/luna/binary/delete.rb', line 11 def name @name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
12 13 14 |
# File 'lib/luna/binary/delete.rb', line 12 def version @version end |
Instance Method Details
#delete ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/luna/binary/delete.rb', line 25 def delete begin deleteRepo rescue => exception ensure deleteBinaryFramework end end |
#deleteBinaryFramework ⇒ Object
43 44 45 46 47 |
# File 'lib/luna/binary/delete.rb', line 43 def deleteBinaryFramework command = "curl -X 'DELETE' #{CBin.config.binary_upload_url}/#{name}/#{version}" p command system command end |
#deleteRepo ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/luna/binary/delete.rb', line 35 def deleteRepo command = "cd #{Luna::Binary::Common.instance.repoPath}; git stash;git checkout master;git pull origin master;" system command Luna::Binary::Common.instance.deleteDirectory("#{Luna::Binary::Common.instance.repoPath}/#{name}/#{version}") commandADD = "cd #{Luna::Binary::Common.instance.repoPath};git add .; git commit -m 'DEL::#{name}-#{version} by LBU'; git push -f origin master" system commandADD end |
#validate! ⇒ Object
20 21 22 23 |
# File 'lib/luna/binary/delete.rb', line 20 def validate! raise "缺少参数" unless name raise "缺少参数" unless version end |