devlog 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c73d853e2efa2ac11ed176cba155f5becb5f42ca
4
+ data.tar.gz: 9637207647c3d22eb992d833ccba38bf213e2f3f
5
+ SHA512:
6
+ metadata.gz: 200ae38781dfe68f90d555ed693658b4f81218255a83e5e311cc2b7d32caa5b67c6147fbd0742b674e89f39edac70a8b120fc129a51d2de856c61f23c3c2d188
7
+ data.tar.gz: 047b48557381dc74e79fce46b106f92f833c09c0d23bb744a01b6e399d99633c80b37c683f738a3367d7cdb299bca21c8b887f74b6fa9566f618d67ebe01d1ae
data/.ruby-gemset ADDED
@@ -0,0 +1,2 @@
1
+ devlog
2
+
data/.ruby-version ADDED
@@ -0,0 +1,3 @@
1
+ ruby-2.0.0
2
+
3
+
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Miha Plohl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ devlog
2
+ ======
3
+
4
+ the headless standup programmer's development log writing tool
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "devlog"
8
+ gem.summary = %Q{takes devlog.markdown and gives info}
9
+ gem.description = %Q{devlog.markdown time&space extractor}
10
+ gem.email = "kitschmaster@gmail.com"
11
+ gem.homepage = "http://github.com/mihael/devlog"
12
+ gem.authors = ["mihael"]
13
+ gem.executables = ["devlog"]
14
+ gem.license = 'MIT'
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/*_test.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/*_test.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+ task :test => :check_dependencies
43
+
44
+ task :default => :test
45
+
46
+ require 'rdoc/task'
47
+ Rake::RDocTask.new do |rdoc|
48
+ if File.exist?('VERSION')
49
+ version = File.read('VERSION')
50
+ else
51
+ version = ""
52
+ end
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "devlog #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
data/bin/devlog ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ require 'benchmark'
3
+ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib devlog.rb]))
4
+ USAGE= <<-EOF
5
+ #{Devlog.display_version}
6
+
7
+ This software is intended to parse and present information within devlog.markdown development logs.
8
+
9
+ #{'Use it as You'.green} #{'dodo'.pur}.
10
+
11
+ Usage:
12
+
13
+ #{'devlog'.red} /path/to/devlog.markdown
14
+
15
+ EOF
16
+ #arguments
17
+ $:.unshift File.join(File.dirname(__FILE__))
18
+ @in_file = ARGV[0]
19
+ def print_usage
20
+ puts USAGE
21
+ exit
22
+ end
23
+ def dodo
24
+ if @in_file
25
+ include Devlog
26
+ time = Benchmark.realtime do
27
+ t = parse_devlog(@in_file)
28
+ puts "\nSession::Times:\n"
29
+ puts("\nCodingSession::Time = %.1f [h]" % t.coding_session_time)
30
+ puts("\nComSession::Time = %.1f [h]" % t.com_session_time)
31
+ puts("\nCharge::Time = #{(t.coding_session_time + t.com_session_time).round} [h]")
32
+ puts("\nUnpayed::Time = #{(t.coding_session_time + t.com_session_time + t.payed_time).round} [h]\n\n")
33
+ end
34
+ puts "\nRealtime used : #{time}sec"
35
+ end
36
+ end
37
+ if ARGV.size > 0
38
+ dodo
39
+ else
40
+ print_usage
41
+ end
data/devlog.gemspec ADDED
@@ -0,0 +1,41 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: devlog 0.0.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "devlog"
9
+ s.version = "0.0.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["mihael"]
13
+ s.date = "2014-01-19"
14
+ s.description = "devlog.markdown time&space extractor"
15
+ s.email = "kitschmaster@gmail.com"
16
+ s.executables = ["devlog"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ ".ruby-gemset",
23
+ ".ruby-version",
24
+ "LICENSE",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/devlog",
29
+ "devlog.gemspec",
30
+ "devlog.markdown",
31
+ "lib/devlog.rb",
32
+ "test/devlog_test.rb",
33
+ "test/test_helper.rb"
34
+ ]
35
+ s.homepage = "http://github.com/mihael/devlog"
36
+ s.licenses = ["MIT"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = "2.1.11"
39
+ s.summary = "takes devlog.markdown and gives info"
40
+ end
41
+
data/devlog.markdown ADDED
@@ -0,0 +1,61 @@
1
+ #19.01.2014 13:54:16 CodingSession::END
2
+
3
+ adding some simple testing :)
4
+
5
+ the devlog is always written in real time,
6
+
7
+ it starts and stops the coding session,
8
+
9
+ ii begin coding by entering begin+Tab inside Sublime Text,
10
+ this gives me CodingSession::BEGIN,
11
+ then ii type ctrl+alt+T and ii get the current date time inserted like this: #19.01.2014 13:48:44
12
+ when ii am done with work ii simly enter end+Tab and CodingSessin::END is inserted...
13
+
14
+ it is a very simple proces, quick to do, the file is always in the editor, You can use it to record any thing project related,
15
+
16
+ currently it is up to You to present the devlog to a customer, ii usually use a markdown parser and show the html version of the log,
17
+ You can even insert links and have the devlog inside a git repository, pushing it to Your customer or Your website...
18
+
19
+ there are endless options for devlogs... any project can have a nice devlog... :D
20
+
21
+ #19.01.2014 13:40:15 CodingSession::BEGIN
22
+
23
+ #19.01.2014 13:40:06 ComSession::END
24
+
25
+ an exemplary communication session... what should we communicate about, ah, why this development log is written?
26
+
27
+ this one is for testing and for documenting the development of the development log writing tool, or shortly the devlog parser gem.
28
+
29
+ but usually ii use such a development log to give my customer the ability to follow along and to also have everything documented for the my self. it is an open perspective, time is tracked exactly as it happens, ii am using simple key bindings in my editor to insert begin and end DSL commands for the parser to read and so forth...
30
+
31
+ the parser then writes out a summary of the devlog information, giving exact coding time, communication time and even time payed...
32
+
33
+ let me pay for all the development hours of this work in advance like this:
34
+ -3000h
35
+ +3000000000000$
36
+
37
+ the +300...$ is an optional entry, the parser does not yet parse money, it only parses + hours and - hours, integers, ii can add two more hours like this:
38
+ +2h
39
+
40
+ or subtract three:
41
+ -3h
42
+
43
+ the parser will know and give accurate result in the Tajm object which is reuturned from the parse_devlog method...
44
+
45
+ #19.01.2014 13:33:53 ComSession::BEGIN
46
+
47
+ #19.01.2014 13:33:42 CodingSession::END
48
+
49
+ preparing repo at github to publish first version: 0.0.0...
50
+
51
+ #19.01.2014 13:18:20 CodingSession::BEGIN
52
+
53
+ #19.01.2014 13:18:14 CodingSession::END
54
+
55
+ ii have been using this little devlog script for many years now, ii could upgrade it with many features, but ii always ended up not doing that to stay simple.
56
+
57
+ the time has come to add these features, slowly, naturally.
58
+
59
+ so here is the initial devlog entry for the development of the devlog tool writing software.
60
+
61
+ #19.01.2014 10:16:08 CodingSession::BEGIN
data/lib/devlog.rb ADDED
@@ -0,0 +1,114 @@
1
+ require "date"
2
+ class String
3
+ def red; colorize(self, "\e[1m\e[31m"); end
4
+ def green; colorize(self, "\e[1m\e[32m"); end
5
+ def dark_green; colorize(self, "\e[32m"); end
6
+ def yellow; colorize(self, "\e[1m\e[33m"); end
7
+ def blue; colorize(self, "\e[1m\e[34m"); end
8
+ def dark_blue; colorize(self, "\e[34m"); end
9
+ def pur; colorize(self, "\e[1m\e[35m"); end
10
+ def colorize(text, color_code) "#{color_code}#{text}\e[0m" end
11
+ end
12
+ module Devlog
13
+ # :stopdoc:
14
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
15
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
16
+ VERSION = File.open(File.join(File.dirname(__FILE__), %w[.. VERSION]), 'r')
17
+ # :startdoc:
18
+ # Returns the version string for the library.
19
+ #
20
+ def self.version
21
+ VERSION
22
+ end
23
+ # Returns the library path for the module. If any arguments are given,
24
+ # they will be joined to the end of the libray path using
25
+ # <tt>File.join</tt>.
26
+ #
27
+ def self.libpath( *args )
28
+ args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
29
+ end
30
+ # Returns the lpath for the module. If any arguments are given,
31
+ # they will be joined to the end of the path using
32
+ # <tt>File.join</tt>.
33
+ #
34
+ def self.path( *args )
35
+ args.empty? ? PATH : ::File.join(PATH, args.flatten)
36
+ end
37
+ # Utility method used to require all files ending in .rb that lie in the
38
+ # directory below this file that has the same name as the filename passed
39
+ # in. Optionally, a specific _directory_ name can be passed in such that
40
+ # the _filename_ does not have to be equivalent to the directory.
41
+ #
42
+ def self.require_all_libs_relative_to( fname, dir = nil )
43
+ dir ||= ::File.basename(fname, '.*')
44
+ search_me = ::File.expand_path(
45
+ ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
46
+
47
+ Dir.glob(search_me).sort.each {|rb| require rb}
48
+ end
49
+ def self.display_version
50
+ "\n#{'Devlog'.green} v#{Devlog.version}\n\n"
51
+ end
52
+ # Write siple console log
53
+ def self.log(txt)
54
+ puts "#{txt}"
55
+ end
56
+
57
+ class Tajm
58
+ attr_accessor :coding_session_time, :com_session_time, :payed_time
59
+ def initialize
60
+ @coding_session_time = 0.0
61
+ @com_session_time = 0.0
62
+ @payed_time = 0.0
63
+ end
64
+ end
65
+
66
+ def parse_datetime(line)
67
+ parts = line[1..-1].split
68
+ DateTime.strptime("#{parts[0]} #{parts[1]}","%d.%m.%Y %H:%M:%S")
69
+ end
70
+
71
+ def parse_devlog(devlog=nil)
72
+ t = Tajm.new
73
+ return t unless devlog
74
+
75
+ timeEnd = nil
76
+ timeBegin = nil
77
+ in_session = false
78
+
79
+ File.open(devlog, "r").each do |line|
80
+ if line =~ /-NOCHARGE/
81
+ in_session = false #do not count nocharge sessions
82
+ elsif line =~ /\A#/ && line =~ /CodingSession::END/
83
+ in_session = true
84
+ timeEnd = parse_datetime(line)
85
+ elsif line =~ /\A#/ && line =~ /CodingSession::BEGIN/
86
+ if in_session
87
+ in_session = false
88
+ timeBegin = parse_datetime(line)
89
+ #cs_time += (timeEnd - timeBegin).to_f * 24 #hours *60 #minutes *60 #seconds
90
+ t.coding_session_time += (timeEnd - timeBegin).to_f * 24 #hours *60 #minutes *60 #seconds
91
+ end
92
+ elsif line =~ /\A#/ && line =~ /ComSession::END/
93
+ in_session = true
94
+ timeEnd = parse_datetime(line)
95
+ elsif line =~ /\A#/ && line =~ /ComSession::BEGIN/
96
+ if in_session
97
+ in_session = false
98
+ timeBegin = parse_datetime(line)
99
+ t.com_session_time += (timeEnd - timeBegin).to_f * 24
100
+ end
101
+ elsif line =~ /\A\+[0-9]+[h]/
102
+ t.com_session_time += line.to_f
103
+ elsif line =~ /\A\+[0-9]+[m]/
104
+ t.com_session_time += (line.to_f / 60)
105
+ elsif line =~ /\A\-[0-9]+[h]/
106
+ t.payed_time += (line.to_f)
107
+ end
108
+
109
+ end
110
+ #return the T object
111
+ t
112
+ end
113
+
114
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class DevlogTest < Test::Unit::TestCase
4
+ def test_devlog
5
+ t = parse_devlog(File.join(File.dirname(__FILE__), '..', 'devlog.markdown'))
6
+ puts "#{t.coding_session_time} #{t.com_session_time} #{t.payed_time}"
7
+ assert(t.coding_session_time>0, "no time no money no love")
8
+ assert(t.com_session_time>0, "no selftalk")
9
+ assert(t.payed_time<0, "no selfpay")
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require 'devlog'
7
+
8
+ class Test::Unit::TestCase
9
+ include Devlog
10
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devlog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - mihael
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: devlog.markdown time&space extractor
14
+ email: kitschmaster@gmail.com
15
+ executables:
16
+ - devlog
17
+ extensions: []
18
+ extra_rdoc_files:
19
+ - LICENSE
20
+ - README.md
21
+ files:
22
+ - .ruby-gemset
23
+ - .ruby-version
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - VERSION
28
+ - bin/devlog
29
+ - devlog.gemspec
30
+ - devlog.markdown
31
+ - lib/devlog.rb
32
+ - test/devlog_test.rb
33
+ - test/test_helper.rb
34
+ homepage: http://github.com/mihael/devlog
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.1.11
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: takes devlog.markdown and gives info
58
+ test_files: []