devlog 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/devlog_test.yml +30 -0
- data/.ruby-version +1 -3
- data/CHANGELOG.md +7 -0
- data/Gemfile +9 -6
- data/LICENSE.txt +21 -0
- data/README.md +21 -6
- data/Rakefile +8 -54
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/devlog.gemspec +50 -49
- data/devlog.markdown +16 -1
- data/{bin → exe}/devlog +4 -0
- data/lib/devlog/date_time_ago_in_words.rb +34 -0
- data/lib/{devlog_settings.rb → devlog/settings.rb} +11 -1
- data/lib/devlog/utils.rb +18 -0
- data/lib/devlog/version.rb +5 -0
- data/lib/devlog.rb +118 -90
- data/test/devlog_settings_test.rb +2 -0
- data/test/devlog_test.rb +50 -18
- data/test/test_devlogs/.devlog.yml +2 -1
- data/test/test_devlogs/test_invalid_date_devlog.markdown +1 -1
- data/test/test_devlogs/test_settings.yml +1 -1
- data/test/test_helper.rb +46 -48
- metadata +44 -47
- data/.travis.yml +0 -8
- data/LICENSE +0 -3
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6af19a193f7add3438d8bebacbd17cf430ac898eddaab5c82f7fa98e8b794509
|
4
|
+
data.tar.gz: ef126fee122ede38c05e8adc9ba12d57733b15d94ba35ec263b64ec2eb551562
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ca17bbc8140aa2ae11ffa43f95fb3e95eb2cdf8fb0e3c7232a4392a8e78978b1dbe8831f7d7483025eca13407f7913e1836ed3ea0e9b70dd41971b82001cae1
|
7
|
+
data.tar.gz: b725512cc215e70eec1eb327d4700d2aba3199c4042d1f60ccb932d2c83716bed828d2fc44b2697b7f55fbc2ee521b9a2f11159231724d9577573158af1d9aef
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: devlog CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
strategy:
|
18
|
+
matrix:
|
19
|
+
ruby-version: ['3.2.2', '3.0.1']
|
20
|
+
os: [ubuntu-latest, macOS-latest]
|
21
|
+
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v4
|
24
|
+
- name: Set up Ruby ${{ runner.os }}-§${{ matrix.ruby-version }}
|
25
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby-version }}
|
28
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
29
|
+
- name: Run tests
|
30
|
+
run: bundle exec rake
|
data/.ruby-version
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "https://rubygems.org"
|
2
4
|
|
3
|
-
#
|
4
|
-
|
5
|
+
# Specify your gem's dependencies in devlog.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
gem "activesupport"
|
5
10
|
|
6
11
|
group :development, :test do
|
7
|
-
gem "test-unit"
|
8
|
-
|
9
|
-
gem "nokogiri", "~> 1.8" # jeweler 2.0.1 depends on 1.5.10, but that has sec issue
|
10
|
-
end
|
12
|
+
gem "test-unit"
|
13
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 mihael
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -28,15 +28,14 @@ like a book, top down, but always start a new session on top of the file, so tha
|
|
28
28
|
devlog DSL
|
29
29
|
==========
|
30
30
|
|
31
|
+
#DD.MM.YYYY HH:MM:SS CodingSession::END
|
31
32
|
|
32
|
-
|
33
|
+
devlog text...
|
33
34
|
|
34
|
-
|
35
|
+
#DD.MM.YYYY HH:MM:SS CodingSession::BEGIN
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
using the devlog binary
|
39
|
-
===================
|
37
|
+
using the devlog CLI
|
38
|
+
====================
|
40
39
|
|
41
40
|
to parse a devlog file explicitly:
|
42
41
|
|
@@ -106,3 +105,19 @@ devlog_file: ../info/devlog.markdown
|
|
106
105
|
weekly_timesheet_template: ../info/weekly_timesheet.erb.html
|
107
106
|
convert_to_pdf_command: wkhtmltopdf --dpi 400 --viewport-size 600x800 --orientation Landscape
|
108
107
|
```
|
108
|
+
|
109
|
+
development
|
110
|
+
===========
|
111
|
+
|
112
|
+
Run test suite:
|
113
|
+
|
114
|
+
```
|
115
|
+
rake test
|
116
|
+
```
|
117
|
+
|
118
|
+
Build and install gem locally:
|
119
|
+
|
120
|
+
```
|
121
|
+
rake build
|
122
|
+
rake install
|
123
|
+
```
|
data/Rakefile
CHANGED
@@ -1,58 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'rake'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
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
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
28
5
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
40
10
|
end
|
41
11
|
|
42
|
-
task :
|
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
|
12
|
+
task default: :test
|
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "devlog"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
require "irb"
|
11
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/devlog.gemspec
CHANGED
@@ -1,38 +1,53 @@
|
|
1
|
-
#
|
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.3.3 ruby lib
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
7
|
-
|
8
|
-
s.name = "devlog".freeze
|
9
|
-
s.version = "0.3.3"
|
3
|
+
require_relative "lib/devlog/version"
|
10
4
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "devlog"
|
7
|
+
spec.version = Devlog::VERSION
|
8
|
+
spec.authors = ["mihael"]
|
9
|
+
spec.email = ["kitschmaster@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Write a development log while also easily track time spent in coding sessions using just a markdown text file and a few CLI commands."
|
12
|
+
spec.description = "devlog.markdown time&space extractor ~ Track the time spent in coding sessions and money payed to you, while also writing a development log. Export a timesheet for your bills."
|
13
|
+
spec.homepage = "https://manitu.si/devlog"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 3.0.0"
|
16
|
+
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/mihael/devlog"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/mihael/devlog/blob/main/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
# gemspec = File.basename(__FILE__)
|
26
|
+
# spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
|
27
|
+
# ls.readlines("\x0", chomp: true).reject do |f|
|
28
|
+
# (f == gemspec) ||
|
29
|
+
# f.start_with?(*%w[bin/ lib/ sublime_text/ templates/ test/ .git .github .gitignore .ruby-gemset .ruby-version devlog.gemspec devlog.markdown Gemfile LICENSE.txt CHANGELOG.md README.md Rakefile tmp/.gitignore])
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
spec.files = [
|
33
|
+
".github/workflows/devlog_test.yml",
|
23
34
|
".ruby-gemset",
|
24
35
|
".ruby-version",
|
25
|
-
".travis.yml",
|
26
36
|
"Gemfile",
|
27
|
-
"LICENSE",
|
37
|
+
"LICENSE.txt",
|
28
38
|
"README.md",
|
39
|
+
"CHANGELOG.md",
|
29
40
|
"Rakefile",
|
30
|
-
"
|
31
|
-
"bin/
|
41
|
+
"bin/console",
|
42
|
+
"bin/setup",
|
43
|
+
"exe/devlog",
|
32
44
|
"devlog.gemspec",
|
33
45
|
"devlog.markdown",
|
34
46
|
"lib/devlog.rb",
|
35
|
-
"lib/
|
47
|
+
"lib/devlog/utils.rb",
|
48
|
+
"lib/devlog/date_time_ago_in_words.rb",
|
49
|
+
"lib/devlog/settings.rb",
|
50
|
+
"lib/devlog/version.rb",
|
36
51
|
"sublime_text/devlog.tmbundle/Snippets/begin.tmSnippet",
|
37
52
|
"sublime_text/devlog.tmbundle/Snippets/combegin.tmSnippet",
|
38
53
|
"sublime_text/devlog.tmbundle/Snippets/comend.tmSnippet",
|
@@ -62,30 +77,16 @@ Gem::Specification.new do |s|
|
|
62
77
|
"test/test_helper.rb",
|
63
78
|
"tmp/.gitignore"
|
64
79
|
]
|
65
|
-
s.homepage = "http://github.com/mihael/devlog".freeze
|
66
|
-
s.licenses = ["MIT".freeze]
|
67
|
-
s.rubygems_version = "3.0.6".freeze
|
68
|
-
s.summary = "takes devlog.markdown and gives info".freeze
|
69
80
|
|
70
|
-
|
71
|
-
|
81
|
+
spec.bindir = "exe"
|
82
|
+
spec.executables = ["devlog"]
|
83
|
+
spec.require_paths = ["lib"]
|
72
84
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
s.add_development_dependency(%q<nokogiri>.freeze, ["~> 1.8"])
|
78
|
-
else
|
79
|
-
s.add_dependency(%q<activesupport>.freeze, ["> 4.1"])
|
80
|
-
s.add_dependency(%q<test-unit>.freeze, ["~> 3.1"])
|
81
|
-
s.add_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
82
|
-
s.add_dependency(%q<nokogiri>.freeze, ["~> 1.8"])
|
83
|
-
end
|
84
|
-
else
|
85
|
-
s.add_dependency(%q<activesupport>.freeze, ["> 4.1"])
|
86
|
-
s.add_dependency(%q<test-unit>.freeze, ["~> 3.1"])
|
87
|
-
s.add_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
88
|
-
s.add_dependency(%q<nokogiri>.freeze, ["~> 1.8"])
|
89
|
-
end
|
90
|
-
end
|
85
|
+
# Dependencies
|
86
|
+
spec.add_dependency "activesupport"
|
87
|
+
spec.add_development_dependency "test-unit"
|
88
|
+
spec.add_development_dependency "nokogiri"
|
91
89
|
|
90
|
+
# For more information and examples about making a new gem, check out our
|
91
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
92
|
+
end
|
data/devlog.markdown
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#17.10.2024 09:10:08 CodingSession::END
|
2
|
+
|
3
|
+
Fixing up for ruby 3 and doing some minor cleanup.
|
4
|
+
|
5
|
+
Ditching jeweler for bundler to package and release gem.
|
6
|
+
|
7
|
+
The tasks to work with the gem are now:
|
8
|
+
|
9
|
+
rake build
|
10
|
+
rake install
|
11
|
+
rake release
|
12
|
+
|
13
|
+
More here: https://bundler.io/guides/creating_gem.html
|
14
|
+
|
15
|
+
#17.10.2024 05:20:32 CodingSession::BEGIN
|
16
|
+
|
1
17
|
#23.09.2019 23:08:08 CodingSession::END
|
2
18
|
|
3
19
|
some quick adjustments...
|
@@ -130,7 +146,6 @@ aha... no comment haha...
|
|
130
146
|
|
131
147
|
#09.02.2015 15:41:09 CodingSession::BEGIN
|
132
148
|
|
133
|
-
|
134
149
|
#02.02.2015 17:53:20 CodingSession::END
|
135
150
|
|
136
151
|
cleaning up a little... enhancing the devlog executable features...
|
data/{bin → exe}/devlog
RENAMED
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'benchmark'
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib devlog.rb]))
|
4
|
+
require "active_support/configurable"
|
5
|
+
|
4
6
|
USAGE = <<-EOF
|
5
7
|
#{Devlog.display_version}
|
6
8
|
This software is intended to parse and present information within devlog.markdown development logs. It also helps You to write the devlog.
|
@@ -68,6 +70,8 @@ include Devlog
|
|
68
70
|
|
69
71
|
def dodo
|
70
72
|
load_settings('.devlog.yml')
|
73
|
+
tz = devlog_timezone_setting
|
74
|
+
puts "Timezone: {tz}"
|
71
75
|
default_devlog_file = devlog_file_setting
|
72
76
|
time = Benchmark.realtime do
|
73
77
|
if @in_file_or_cmd =~ /.(markdown|md)$/ # devlog_file is passed directly via CLI
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "active_support/all"
|
2
|
+
|
3
|
+
module DateTimeAgoInWords
|
4
|
+
def ago_in_words
|
5
|
+
return 'a very very long time ago' if self.year < 1800
|
6
|
+
secs = Time.now - self
|
7
|
+
return 'just over' if secs > -1 && secs < 1
|
8
|
+
return 'now' if secs <= -1
|
9
|
+
pair = ago_in_words_pair(secs)
|
10
|
+
ary = ago_in_words_singularize(pair)
|
11
|
+
ary.size == 0 ? '' : ary.join(' and ') << ' ago'
|
12
|
+
end
|
13
|
+
private
|
14
|
+
def ago_in_words_pair(secs)
|
15
|
+
[[60, :seconds], [60, :minutes], [24, :hours], [100_000, :days]].map{ |count, name|
|
16
|
+
if secs > 0
|
17
|
+
secs, n = secs.divmod(count)
|
18
|
+
"#{n.to_i} #{name}"
|
19
|
+
end
|
20
|
+
}.compact.reverse[0..1]
|
21
|
+
end
|
22
|
+
def ago_in_words_singularize(pair)
|
23
|
+
if pair.size == 1
|
24
|
+
pair.map! {|part| part[0, 2].to_i == 1 ? part.chomp('s') : part }
|
25
|
+
else
|
26
|
+
pair.map! {|part| part[0, 2].to_i == 1 ? part.chomp('s') : part[0, 2].to_i == 0 ? nil : part }
|
27
|
+
end
|
28
|
+
pair.compact
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class ActiveSupport::TimeWithZone
|
33
|
+
include DateTimeAgoInWords
|
34
|
+
end
|
@@ -2,7 +2,7 @@ require 'yaml'
|
|
2
2
|
require 'ostruct'
|
3
3
|
# require 'pry'
|
4
4
|
|
5
|
-
#
|
5
|
+
# Devlog settings
|
6
6
|
module Devlog
|
7
7
|
# Settings - keeping it simple.
|
8
8
|
# Allow settings.key besides settings[:key]
|
@@ -49,4 +49,14 @@ module Devlog
|
|
49
49
|
DEVLOG_FILE
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
def devlog_timezone_setting
|
54
|
+
return 'Amsterdam' unless settings
|
55
|
+
devlog_timezone_setting = settings['timezone']
|
56
|
+
if devlog_timezone_setting.present?
|
57
|
+
devlog_timezone_setting
|
58
|
+
else
|
59
|
+
'Amsterdam'
|
60
|
+
end
|
61
|
+
end
|
52
62
|
end
|
data/lib/devlog/utils.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Colors for devlog
|
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
|
+
|
13
|
+
# Rounding seconds to hours
|
14
|
+
class Float
|
15
|
+
def rounded_hours
|
16
|
+
(self / 60.0 / 60.0).round(2)
|
17
|
+
end
|
18
|
+
end
|