dailyprogress 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/DailyProgress.gemspec +32 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +70 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/config_loader.rb +30 -0
- data/exe/dailyprogress +12 -0
- data/lib/DailyProgress/version.rb +6 -0
- data/lib/daily_progress.rb +77 -0
- data/lib/main.rb +8 -0
- data/lib/os.rb +27 -0
- data/ruby +0 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f9aa045f9bce70d0d78c11679b3f30d1774415e3a910548a3a5c2b4c1fe89eaa
|
4
|
+
data.tar.gz: 91fee9144a5caadd5456788c4a768b904edab6a0c39b7d7b1167f237e04bb272
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2f57c0252f707cd444ed46b478a6708ef680d51dbe5772067410e4d325f094904ec1da26d39c05e8075e2d471d6470309cc3b2113bc3d5550bcacb6c8ff86850
|
7
|
+
data.tar.gz: 438c465df905987d4ab5406b12517c51a73cabaab81b05c79ca58e41fefcf32a204c24c251ac4d906146565edfac585dd2af9835278ee927713c3853899cf8aa
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at lovepreet@newgenpayments.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "DailyProgress/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dailyprogress"
|
8
|
+
spec.version = DailyProgress::VERSION
|
9
|
+
spec.authors = ["Lovepreet"]
|
10
|
+
spec.email = ["lovepreetkaul23@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Simple Project to create my daily progress emails from Vimwiki}
|
13
|
+
spec.homepage = "https://www.lovepreet.xyz"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", ">= 2.2.10"
|
29
|
+
|
30
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
end
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Lovepreet
|
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
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# DailyProgress
|
2
|
+
|
3
|
+
Simple ruby gem to convert my vimwiki diary entry to daily progress email.
|
4
|
+
|
5
|
+
## Dependencies
|
6
|
+
|
7
|
+
1. `xclip` - Xclip should be installed for Linux systems as it is used to copy over the final content over
|
8
|
+
to the clipboard.
|
9
|
+
|
10
|
+
2. Vimwiki should be installed and generate the diary entry in the following format:
|
11
|
+
|
12
|
+
```text
|
13
|
+
To Do Status.
|
14
|
+
1. [] First Item
|
15
|
+
2. [] Second Item
|
16
|
+
3. [] Third Item
|
17
|
+
```
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'DailyProgress'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install DailyProgress
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
1. Create your Vimwiki entry for today.
|
38
|
+
2. Call the executable. By default it looks for the vimwiki at the path `$HOME/vimwiki/diary`
|
39
|
+
|
40
|
+
```sh
|
41
|
+
lovepreet@home:~$ dailyProgress
|
42
|
+
```
|
43
|
+
|
44
|
+
If you have it somewhere else, add the file path as an argument to the executable. The path can be relative.
|
45
|
+
|
46
|
+
```sh
|
47
|
+
lovepreet@home:~$ dailyProgress /path/to/vimwiki/diary
|
48
|
+
```
|
49
|
+
|
50
|
+
## Development
|
51
|
+
|
52
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
53
|
+
|
54
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
55
|
+
|
56
|
+
## Roadmap
|
57
|
+
|
58
|
+
Further, need to add the functionality to copy the result content into the clipboard. Currently the output is to STDOUT.
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lovepreetkaul/DailyProgress. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
63
|
+
|
64
|
+
## License
|
65
|
+
|
66
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
67
|
+
|
68
|
+
## Code of Conduct
|
69
|
+
|
70
|
+
Everyone interacting in the DailyProgress project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/DailyProgress/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "daily_progress"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
class ConfigLoader
|
6
|
+
def initialize
|
7
|
+
load_config_data
|
8
|
+
end
|
9
|
+
|
10
|
+
def [](name)
|
11
|
+
config_for(name)
|
12
|
+
end
|
13
|
+
|
14
|
+
def config_for(name)
|
15
|
+
@config_data[name]
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def load_config_data
|
21
|
+
config_file_path = 'config/config.yml'
|
22
|
+
begin
|
23
|
+
config_file_contents = File.read(config_file_path)
|
24
|
+
rescue Errno::ENOENT
|
25
|
+
$stderr.puts "missing config file"
|
26
|
+
raise
|
27
|
+
end
|
28
|
+
@config_data = YAML.load(config_file_contents)
|
29
|
+
end
|
30
|
+
end
|
data/exe/dailyprogress
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative '../lib/daily_progress'
|
5
|
+
include DailyProgress
|
6
|
+
|
7
|
+
path = ARGV[0].nil? ? "#{Dir.home}/vimwiki/diary/" : ARGV[0].nil?
|
8
|
+
puts "Configured path: #{path}"
|
9
|
+
DailyProgress.configure(path)
|
10
|
+
content = DailyProgress.progress
|
11
|
+
puts content
|
12
|
+
to_clipboard(content)
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'DailyProgress/version'
|
4
|
+
require_relative 'os'
|
5
|
+
|
6
|
+
# The main module for the gem implementation.
|
7
|
+
module DailyProgress
|
8
|
+
include OS
|
9
|
+
class Error < StandardError; end
|
10
|
+
|
11
|
+
def configure(path)
|
12
|
+
@path = path
|
13
|
+
abort("[FATAL] Today's vimwiki entry not created yet!") unless today_file_exists?
|
14
|
+
end
|
15
|
+
|
16
|
+
def progress
|
17
|
+
time_now = Time.new
|
18
|
+
# Threshold time currently 7 PM
|
19
|
+
time_th = Time.new(time_now.year, time_now.month, time_now.day, 19, 0, 0, '+05:30')
|
20
|
+
text = content
|
21
|
+
if time_now < time_th
|
22
|
+
morning_progress(text)
|
23
|
+
else
|
24
|
+
evening_progress(text)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def list_files
|
29
|
+
Dir["#{@path}*"]
|
30
|
+
end
|
31
|
+
|
32
|
+
def today_filename
|
33
|
+
time = Time.new
|
34
|
+
"#{@path}#{time.strftime('%Y-%m-%d.wiki')}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def today_file_exists?
|
38
|
+
File.file?(today_filename)
|
39
|
+
end
|
40
|
+
|
41
|
+
def content
|
42
|
+
filename = today_filename
|
43
|
+
file = File.open(filename)
|
44
|
+
file_data = file.read
|
45
|
+
file.close
|
46
|
+
file_data
|
47
|
+
end
|
48
|
+
|
49
|
+
def morning_progress(content)
|
50
|
+
content.gsub!('[X]', '')
|
51
|
+
content.gsub!('[-]', '')
|
52
|
+
content.gsub!('[ ]', '')
|
53
|
+
content
|
54
|
+
end
|
55
|
+
|
56
|
+
def evening_progress(content)
|
57
|
+
content.gsub!('[X]', '[Completed]')
|
58
|
+
content.gsub!('[-]', '[On Hold]')
|
59
|
+
content.gsub!('[ ]', '[In Progress]')
|
60
|
+
content
|
61
|
+
end
|
62
|
+
|
63
|
+
def to_clipboard(content)
|
64
|
+
success_msg = "Content copied to clipboard successfully!"
|
65
|
+
if OS.windows?
|
66
|
+
IO.popen('clip', 'w') { |f| f << content.to_s }
|
67
|
+
puts success_msg
|
68
|
+
elsif OS.wsl?
|
69
|
+
puts "Clipboard not implemented for WSL."
|
70
|
+
puts content
|
71
|
+
else OS.linux?
|
72
|
+
IO.popen('xclip -selection clipboard', 'r+') { |f| f.puts content.to_s }
|
73
|
+
puts success_msg
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
data/lib/main.rb
ADDED
data/lib/os.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module OS
|
2
|
+
def OS.windows?
|
3
|
+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
4
|
+
end
|
5
|
+
|
6
|
+
def OS.mac?
|
7
|
+
(/darwin/ =~ RUBY_PLATFORM) != nil
|
8
|
+
end
|
9
|
+
|
10
|
+
def OS.unix?
|
11
|
+
!OS.windows?
|
12
|
+
end
|
13
|
+
|
14
|
+
def OS.linux?
|
15
|
+
OS.unix? and not OS.mac?
|
16
|
+
end
|
17
|
+
|
18
|
+
def OS.jruby?
|
19
|
+
RUBY_ENGINE == 'jruby'
|
20
|
+
end
|
21
|
+
|
22
|
+
def OS.wsl?
|
23
|
+
version = File.read(WSL_VERSION_PATH)
|
24
|
+
OS.linux? and (/microsoft|wsl/ =~ version.downcase) != nil
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/ruby
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dailyprogress
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lovepreet
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-08-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.2.10
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.10
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '13.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '13.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- lovepreetkaul23@gmail.com
|
58
|
+
executables:
|
59
|
+
- dailyprogress
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- DailyProgress.gemspec
|
67
|
+
- Gemfile
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- config/config_loader.rb
|
74
|
+
- exe/dailyprogress
|
75
|
+
- lib/DailyProgress/version.rb
|
76
|
+
- lib/daily_progress.rb
|
77
|
+
- lib/main.rb
|
78
|
+
- lib/os.rb
|
79
|
+
- ruby
|
80
|
+
homepage: https://www.lovepreet.xyz
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubygems_version: 3.2.5
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: Simple Project to create my daily progress emails from Vimwiki
|
103
|
+
test_files: []
|