Skip to content

Commit

Permalink
Fix minor conflic on log_entry.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
psyomn committed Nov 2, 2014
2 parents fe5ab05 + 4e95e34 commit 17551e1
Show file tree
Hide file tree
Showing 50 changed files with 172 additions and 186 deletions.
3 changes: 1 addition & 2 deletions bin/wlog
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require 'wlog/ui/bootstrap'
require 'wlog/ui/cli_interface'

include Wlog

if ARGV.size > 0
case ARGV[0]
when "--list"
Expand All @@ -29,4 +29,3 @@ else
Bootstrap.configure!
CliInterface.new.run
end

2 changes: 1 addition & 1 deletion lib/wlog/commands/bootstrap_templates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def execute

private

# Write a default template
# Write a default template
def write_default_template!
fh = File.open(TemplateSampleFile, 'w')
data = "A list of issues:
Expand Down
1 change: 0 additions & 1 deletion lib/wlog/commands/concat_description.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ def execute
attr_reader :id, :str
end
end # end Wlog module

2 changes: 1 addition & 1 deletion lib/wlog/commands/create_issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def execute
desc = Readline.readline("Small issue description :") || "None."
ldesc = Readline.readline("Long issue description :") || "None."
@ret = Issue.create(:description =>desc.chomp, :long_description => ldesc,
:status => 0, :created_at => Time.now, :updated_at => Time.now,
:status => 0, :created_at => Time.now, :updated_at => Time.now,
:due_date => Time.now, :timelog => 0)
end
attr_accessor :ret
Expand Down
1 change: 0 additions & 1 deletion lib/wlog/commands/delete_attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ def execute
private
end
end

3 changes: 1 addition & 2 deletions lib/wlog/commands/delete_issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def execute
@deleted = true
end
rescue ActiveRecord::RecordNotFound
@deleted = false
@deleted = false
end

def deleted?
Expand All @@ -29,4 +29,3 @@ def deleted?
attr :deleted
end
end

3 changes: 1 addition & 2 deletions lib/wlog/commands/fetch_git_commits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FetchGitCommits < Commandable
# @param repo location to the git repo
# @param author only show logs of that author. If none is given, fetch all
# authors
# @example
# @example
# from_date = DateTime.now - 15
# to_date = DateTime.now + 5
# repo = '/home/jon/wlog/.git/'
Expand Down Expand Up @@ -44,4 +44,3 @@ def run_git_cmd

end
end

1 change: 0 additions & 1 deletion lib/wlog/commands/fetch_git_commits_standard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ def execute
attr_accessor :commits
end
end

1 change: 0 additions & 1 deletion lib/wlog/commands/innit_db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,3 @@ def dbconfig

end
end

1 change: 0 additions & 1 deletion lib/wlog/commands/make_csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ def execute
attr_accessor :ret
end
end

4 changes: 2 additions & 2 deletions lib/wlog/commands/new_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ module Wlog
# @author Simon Symeonidis
class NewEntry < Commandable

def initialize(desc, issue)
def initialize(desc, issue)
@desc, @issue = desc, issue
end

def execute
log_entry = LogEntry.new(
:description => @desc,
:description => @desc,
:created_at => DateTime.now,
:updated_at => DateTime.now)

Expand Down
1 change: 0 additions & 1 deletion lib/wlog/commands/replace_pattern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ def execute
end
end
end

1 change: 0 additions & 1 deletion lib/wlog/commands/taint_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ def execute
end
end
end

1 change: 0 additions & 1 deletion lib/wlog/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
require 'wlog/domain/sys_config.rb'
require 'wlog/domain/template_engine.rb'
require 'wlog/domain/timelog_helper.rb'

1 change: 0 additions & 1 deletion lib/wlog/domain/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ def uncompress_string

end
end # module Wlog

2 changes: 1 addition & 1 deletion lib/wlog/domain/git_commit.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Wlog
# A git commit message
# @author Simon Symeonidis
class GitCommit
class GitCommit
def initialize
@commit = @author = @shortlog = @message = ""
end
Expand Down
1 change: 0 additions & 1 deletion lib/wlog/domain/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ def self.make_dirs!
def self.first_setup?; !File.exists? TaintFile end
end
end # module Wlog

2 changes: 1 addition & 1 deletion lib/wlog/domain/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'wlog/domain/log_entry'

module Wlog
# The invoice domain object - use this to manipulate invoice recordings, or
# The invoice domain object - use this to manipulate invoice recordings, or
# this along with some renderer and templates in order to create said invoices.
# @author Simon Symeonidis
class Invoice < ActiveRecord::Base
Expand Down
17 changes: 8 additions & 9 deletions lib/wlog/domain/issue.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'active_record'
require 'active_record'

require 'wlog/domain/log_entry'
require 'wlog/domain/timelog_helper'
Expand All @@ -8,7 +8,7 @@
module Wlog
# This aggregates log entries. The total time spent on this issue is
# calculated from checking out said log entries.
# @author Simon Symeonidis
# @author Simon Symeonidis
class Issue < ActiveRecord::Base

has_many :log_entries, dependent: :delete_all
Expand Down Expand Up @@ -48,10 +48,10 @@ def to_s

# Mark issue as started
def mark_started!; self.status = 0 end

# Mark the issue as working
def mark_working!; self.status = 1 end

# Mark the issue as finished
def mark_finished!; self.status = 2 end

Expand All @@ -63,15 +63,15 @@ def status_s; Statuses[status] end

private
Statuses = {
StatusNew => "new",
StatusStarted => "started work",
StatusFinished => "finished",
StatusNew => "new",
StatusStarted => "started work",
StatusFinished => "finished",
StatusArchived => "archived"}

# Stringify attachments for terminal output
def attachments_s
str = ''
self.attachments.each do |att|
self.attachments.each do |att|
str.concat(att.to_s)
end
str = @strmaker.red(" N/A#{$/}") if str == '' # no attachments
Expand Down Expand Up @@ -108,4 +108,3 @@ def make_colored_num_s(num, num_s)

end # class Issue
end # module Wlog

5 changes: 2 additions & 3 deletions lib/wlog/domain/key_value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class KeyValue < ActiveRecord::Base
def self.put!(key, value)
if ret = KeyValue.find_by_key(key)
ret.value = value
else
else
ret = KeyValue.new(:key => key, :value => value)
end
ret.save
Expand All @@ -29,6 +29,5 @@ def self.get(key)
end

private
end
end
end # module Wlog

3 changes: 1 addition & 2 deletions lib/wlog/domain/log_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require 'wlog/tech/text_filters'

module Wlog
# Author :: Simon Symeonidis
# Author :: Simon Symeonidis
# Active Record Domain object for a log entry
class LogEntry < ActiveRecord::Base
include TextFilters
Expand All @@ -27,4 +27,3 @@ def to_s
private
end
end # module Wlog

1 change: 0 additions & 1 deletion lib/wlog/domain/static_configurations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ module StaticConfigurations
ConfigFile = "#{AppDirectory}config"
end
end # module Wlog

5 changes: 2 additions & 3 deletions lib/wlog/domain/sys_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ def self.read_attributes
terms.each do |term_tuple| # [term, value]
values[term_tuple[0]] = term_tuple[1]
end
values
values
rescue Errno::ENOENT
$stderr.puts "#{self.class.name}: Problem opening file #{ConfigFile}"
# Minimum guarantee: disable ansi colors
# Minimum guarantee: disable ansi colors
{'ansi' => 'no'}
end

Expand All @@ -96,4 +96,3 @@ def self.read_attributes

end
end # module Wlog

4 changes: 2 additions & 2 deletions lib/wlog/domain/template_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

module Wlog
# Bunlde helper functions for templates here
# @author Simon Symeonidis
# @author Simon Symeonidis
class TemplateHelper
include StaticConfigurations
include StaticConfigurations
# @return absolute path to the template the user has set
def self.template_file
num = KeyValue.get('template') || 1
Expand Down
2 changes: 1 addition & 1 deletion lib/wlog/domain/timelog_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.parse(str)
self.calculate_time(loggings)
end

# @param time is time in seconds
# @param time is time in seconds
# @return in nice format (2d 1h 20m)
def self.time_to_s(time)
str = ""
Expand Down
9 changes: 4 additions & 5 deletions lib/wlog/migrations/make_standard_tables.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'active_record'
require 'active_record'

module Wlog
# Migrations to replace the raw sql from turntables
# @author Simon Symeonidis
class MakeStandardTables < ActiveRecord::Migration
def change
def change
create_table :issues do |t|
t.text :description
t.datetime :due_date
Expand All @@ -23,7 +23,7 @@ def change
end

create_table :attachments do |t|
t.text :filename
t.text :filename
t.text :given_name
t.text :data
t.datetime :created_at
Expand All @@ -42,5 +42,4 @@ def change
end
end
end
end

end
1 change: 0 additions & 1 deletion lib/wlog/tech/ansi_colors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ module AnsiColors
White = 37
end
end

28 changes: 14 additions & 14 deletions lib/wlog/tech/git_commit_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ class GitCommitParser
# @param log_s is the string obtained from running a `git log` command
# @return a list of GitCommit objects
def self.parse(log_s)
cur = nil
inmessage = false
gitlogs = []
log_s.lines.each do |line|
cur = nil
inmessage = false
gitlogs = []

log_s.lines.each do |line|
case line
when /^commit/i
inmessage = false
inmessage = false
gitlogs.push cur if cur
cur = GitCommit.new
cur.commit = line.split[1].strip

when /^author/i
next unless cur
cur.author = line.split[1].strip

when /^date/i, /^\n$/
next
else

else
next unless cur
if inmessage
cur.message.concat(line)
cur.message.strip!
else
cur.shortlog = line
cur.shortlog.strip!
cur.shortlog.strip!
inmessage = true
end
end
end

end

# if commits have no hash, discard them
gitlogs.reject! { |e| e.commit == "" }
gitlogs.push cur if cur
Expand Down
8 changes: 4 additions & 4 deletions lib/wlog/tech/git_commit_printer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module Wlog
module GitCommitPrinter

def print_git_commits(commit_a)
sm = SysConfig.string_decorator
commit_a.each do |commit|
sm = SysConfig.string_decorator

commit_a.each do |commit|
print ' '
print sm.blue(commit.commit)
print ' '
print ' '
puts sm.green(commit.shortlog[0..50] + ' ...')
end
nil end
Expand Down
2 changes: 1 addition & 1 deletion lib/wlog/tech/uncolored_string.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Wlog
# Use this if the system does not support colored strings.
# @author Simon Symeonidis
# @author Simon Symeonidis
class UncoloredString # :nodoc:
def self.red(str); str end
def self.yellow(str); str end
Expand Down
2 changes: 1 addition & 1 deletion lib/wlog/tech/wlog_string.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'wlog/tech/ansi_colors'

module Wlog
# This should take care of multiplatform color stuff.
# This should take care of multiplatform color stuff.
# @author Simon Symeonidis
class WlogString
include AnsiColors
Expand Down

0 comments on commit 17551e1

Please sign in to comment.