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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 152a77a9bf2759dee53158b75e850e5fa7eac445ffc96c1640f63994afa95657
4
- data.tar.gz: fa39e2749400e54807d883f106e0a79371633f471d7ad0eb84d54254b4f586d8
3
+ metadata.gz: 6af19a193f7add3438d8bebacbd17cf430ac898eddaab5c82f7fa98e8b794509
4
+ data.tar.gz: ef126fee122ede38c05e8adc9ba12d57733b15d94ba35ec263b64ec2eb551562
5
5
  SHA512:
6
- metadata.gz: 3240402228afcfe9dc9d8826f96b0a3e3579604e3d3ff139a66c9f8dc65562d03218ee66886c03fc468c1382b81b3d347f30a513c1a0e486f42f8f4d4b7c927f
7
- data.tar.gz: '080462e56cd322f1af89edf7053ff912b8f9cc0a90dc4c36c2d35839a93abdcf45243b5af2dcb724a6f960e826b53312b362a1703ea6f79cd7f38830da184857'
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
@@ -1,3 +1 @@
1
- 2.3.0
2
-
3
-
1
+ 3.3.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.4.0] - 2024-10-17
4
+
5
+ - Bump to ruby 3, which is now a dependency
6
+ - Timezone support with the .devlog.yml setting
7
+ - Remove Jeweler in favor of Bundler
data/Gemfile CHANGED
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- # gemspec # jeweler 2.0.1 adds 'devlog' it self as a dependency for some reason, which results in Travis failing
4
- gem "activesupport", "> 4.1"
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", "~> 3.1"
8
- gem "jeweler", "~> 2.0"
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
- #DD.MM.YYYY HH:MM:SS CodingSession::END
33
+ devlog text...
33
34
 
34
- devlog text...
35
+ #DD.MM.YYYY HH:MM:SS CodingSession::BEGIN
35
36
 
36
- #DD.MM.YYYY HH:MM:SS CodingSession::BEGIN
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
- require 'rubygems'
2
- require 'rake'
1
+ # frozen_string_literal: true
3
2
 
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
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
28
5
 
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
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 :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
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/devlog.gemspec CHANGED
@@ -1,38 +1,53 @@
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.3.3 ruby lib
1
+ # frozen_string_literal: true
6
2
 
7
- Gem::Specification.new do |s|
8
- s.name = "devlog".freeze
9
- s.version = "0.3.3"
3
+ require_relative "lib/devlog/version"
10
4
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib".freeze]
13
- s.authors = ["mihael".freeze]
14
- s.date = "2019-10-19"
15
- s.description = "devlog.markdown time&space extractor".freeze
16
- s.email = "kitschmaster@gmail.com".freeze
17
- s.executables = ["devlog".freeze]
18
- s.extra_rdoc_files = [
19
- "LICENSE",
20
- "README.md"
21
- ]
22
- s.files = [
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
- "VERSION",
31
- "bin/devlog",
41
+ "bin/console",
42
+ "bin/setup",
43
+ "exe/devlog",
32
44
  "devlog.gemspec",
33
45
  "devlog.markdown",
34
46
  "lib/devlog.rb",
35
- "lib/devlog_settings.rb",
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
- if s.respond_to? :specification_version then
71
- s.specification_version = 4
81
+ spec.bindir = "exe"
82
+ spec.executables = ["devlog"]
83
+ spec.require_paths = ["lib"]
72
84
 
73
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
74
- s.add_runtime_dependency(%q<activesupport>.freeze, ["> 4.1"])
75
- s.add_development_dependency(%q<test-unit>.freeze, ["~> 3.1"])
76
- s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.0"])
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
@@ -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
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Devlog
4
+ VERSION = "0.4.0"
5
+ end