Class: Crackin::Status
- Inherits:
-
Object
- Object
- Crackin::Status
- Defined in:
- lib/crackin/status.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #development? ⇒ Boolean
-
#initialize ⇒ Status
constructor
A new instance of Status.
- #process ⇒ Object
- #production? ⇒ Boolean
- #releasing? ⇒ Boolean
- #status_line ⇒ Object
- #to_s ⇒ Object
- #unknown? ⇒ Boolean
Constructor Details
#initialize ⇒ Status
Returns a new instance of Status.
5 6 7 8 9 10 11 12 13 |
# File 'lib/crackin/status.rb', line 5 def initialize @config = Crackin.config @source = @config.source @verbose = @config['status']['verbose'] @version = Crackin::VersionFile.new(@config['version']) @notices = [] process end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
3 4 5 |
# File 'lib/crackin/status.rb', line 3 def state @state end |
Instance Method Details
#development? ⇒ Boolean
42 43 44 |
# File 'lib/crackin/status.rb', line 42 def development? @state == 'development' end |
#process ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/crackin/status.rb', line 15 def process if (@source.current_branch =~ /^crackin_/) == 0 # we're releasing @state = 'releasing' @notices << notice_releasing @notices << notice_releasing_pending if @source.pending @notices << notice_releasing_finish elsif @source.current_branch == @config['branch']['development'] @state = 'development' @notices << notice_development elsif @source.current_branch == @config['branch']['production'] @state = 'production' @notices << notice_production else @state = 'unknown' @notices << notice_unknown end end |
#production? ⇒ Boolean
38 39 40 |
# File 'lib/crackin/status.rb', line 38 def production? @state == 'production' end |
#releasing? ⇒ Boolean
34 35 36 |
# File 'lib/crackin/status.rb', line 34 def releasing? @state == 'releasing' end |
#status_line ⇒ Object
50 51 52 |
# File 'lib/crackin/status.rb', line 50 def status_line "crackin # '#{@version}' # on branch: '#{@source.current_branch}' ('#{@state}') # pending changes: '#{@source.pending?}'" end |
#to_s ⇒ Object
54 55 56 57 58 59 |
# File 'lib/crackin/status.rb', line 54 def to_s out = [] out += @notices if @verbose out << status_line out.join("\n") end |
#unknown? ⇒ Boolean
46 47 48 |
# File 'lib/crackin/status.rb', line 46 def unknown? @state == 'unknown' end |