rkhal 0.0.1.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +14 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/rkhal +12 -0
- data/lib/rkhal.rb +6 -0
- data/lib/rkhal/extensions.rb +22 -0
- data/lib/rkhal/rkhal.rb +61 -0
- data/lib/rkhal/version.rb +3 -0
- data/rkhal.gemspec +25 -0
- data/rkhal.yaml.sample +3 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 10317eccb2abfad93152e98bae6df0ab57c7f0c1
|
4
|
+
data.tar.gz: 2302a40e01a6f8e5361ce7b291b9850dd54e8e92
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2cd5b4b014fb75dda09e919e7bddb34b49f4d02810dce0283b82b809801f7c444779bf9bb0d5888e352c9469cdc82605c7543c87cad43c97cad4b6cf8e73f3ca
|
7
|
+
data.tar.gz: 21d484a036f3f48af32bcdc98ecd122e40bc3c85a2203e1c1047dca8aea746c89992b6c5bdfed4742c07f28b5e5966dbad2ac950bb2ac8521f66e864476ac922
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Patrik Pettersson
|
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,14 @@
|
|
1
|
+
Ruby Console Calendar
|
2
|
+
---------------------
|
3
|
+
|
4
|
+
Simple console application to show the exchange calendar events of the week.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ bundle install
|
9
|
+
|
10
|
+
copy `rkhal.yaml.sample` to `rkhal.yaml` and edit
|
11
|
+
|
12
|
+
## Running
|
13
|
+
|
14
|
+
$ ruby rkhal.rb
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rkhal"
|
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
|
data/bin/setup
ADDED
data/exe/rkhal
ADDED
data/lib/rkhal.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class String
|
2
|
+
def black; "\033[30m#{self}\033[0m" end
|
3
|
+
def red; "\033[31m#{self}\033[0m" end
|
4
|
+
def green; "\033[32m#{self}\033[0m" end
|
5
|
+
def brown; "\033[33m#{self}\033[0m" end
|
6
|
+
def blue; "\033[34m#{self}\033[0m" end
|
7
|
+
def magenta; "\033[35m#{self}\033[0m" end
|
8
|
+
def cyan; "\033[36m#{self}\033[0m" end
|
9
|
+
def gray; "\033[37m#{self}\033[0m" end
|
10
|
+
def bg_black; "\033[40m#{self}\033[0m" end
|
11
|
+
def bg_red; "\033[41m#{self}\033[0m" end
|
12
|
+
def bg_green; "\033[42m#{self}\033[0m" end
|
13
|
+
def bg_brown; "\033[43m#{self}\033[0m" end
|
14
|
+
def bg_blue; "\033[44m#{self}\033[0m" end
|
15
|
+
def bg_magenta; "\033[45m#{self}\033[0m" end
|
16
|
+
def bg_cyan; "\033[46m#{self}\033[0m" end
|
17
|
+
def bg_gray; "\033[47m#{self}\033[0m" end
|
18
|
+
def bold; "\033[1m#{self}\033[22m" end
|
19
|
+
def reverse_color; "\033[7m#{self}\033[27m" end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
data/lib/rkhal/rkhal.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'active_support/all'
|
3
|
+
require 'viewpoint'
|
4
|
+
include Viewpoint::EWS
|
5
|
+
|
6
|
+
module Rkhal
|
7
|
+
def get_body(item)
|
8
|
+
body=""
|
9
|
+
if item.body_type == "HTML"
|
10
|
+
IO.popen('lynx -stdin -dump','r+') do |io|
|
11
|
+
io.write item.body
|
12
|
+
io.close_write
|
13
|
+
body = io.read
|
14
|
+
end
|
15
|
+
end
|
16
|
+
body.red
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def init
|
21
|
+
begin
|
22
|
+
$config = YAML.load_file(File.join(ENV['HOME'], '.rkhal.yaml'))
|
23
|
+
$conn = Viewpoint::EWSClient.new $config['endpoint'], $config['username'], $config['password']
|
24
|
+
rescue
|
25
|
+
puts "Could not load config file".red
|
26
|
+
puts "please make sure to create #{File.join(ENV['HOME'], '.rkhal.yaml')}"
|
27
|
+
exit 1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def this_week
|
33
|
+
start_date = Date.today.at_beginning_of_week
|
34
|
+
end_date = Date.today.at_end_of_week
|
35
|
+
|
36
|
+
today = $conn.find_items({:folder_id => :calendar,
|
37
|
+
:calendar_view => {
|
38
|
+
:start_date => start_date.to_datetime,
|
39
|
+
:end_date => end_date.to_datetime}})
|
40
|
+
|
41
|
+
day = ''
|
42
|
+
str =""
|
43
|
+
|
44
|
+
today.sort { |a,b| a.start <=> b.start }.each do |i|
|
45
|
+
curr_day = i.start.to_date.strftime('%A')
|
46
|
+
if curr_day != day
|
47
|
+
str += "\n#{curr_day}\n".bold
|
48
|
+
day = curr_day
|
49
|
+
end
|
50
|
+
|
51
|
+
str += "%s-%s %s %s\n" % [i.start.to_time.to_formatted_s(:time).green,
|
52
|
+
i.end.to_time.to_formatted_s(:time).green,
|
53
|
+
i.subject.gray,
|
54
|
+
(i.location || "") .cyan]
|
55
|
+
#puts get_body(i)
|
56
|
+
end
|
57
|
+
str
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
data/rkhal.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rkhal"
|
7
|
+
spec.version = "0.0.1.beta"
|
8
|
+
spec.authors = ["Patrik Pettersson"]
|
9
|
+
spec.email = ["patrik.pettersson@ericsson.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Simple program to show the weeks agenda from exchange}
|
12
|
+
spec.description = %q{Simple program to show the weeks agenda from exchange}
|
13
|
+
spec.homepage = "https://github.com/kaffepanna/rkhal"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_runtime_dependency 'viewpoint'
|
24
|
+
spec.add_runtime_dependency 'activesupport'
|
25
|
+
end
|
data/rkhal.yaml.sample
ADDED
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rkhal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.beta
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Patrik Pettersson
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-08 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: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: viewpoint
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Simple program to show the weeks agenda from exchange
|
70
|
+
email:
|
71
|
+
- patrik.pettersson@ericsson.com
|
72
|
+
executables:
|
73
|
+
- rkhal
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- exe/rkhal
|
87
|
+
- lib/rkhal.rb
|
88
|
+
- lib/rkhal/extensions.rb
|
89
|
+
- lib/rkhal/rkhal.rb
|
90
|
+
- lib/rkhal/version.rb
|
91
|
+
- rkhal.gemspec
|
92
|
+
- rkhal.yaml.sample
|
93
|
+
homepage: https://github.com/kaffepanna/rkhal
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.3.1
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.4.7
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: Simple program to show the weeks agenda from exchange
|
117
|
+
test_files: []
|