shiftzilla 0.2.18 → 0.2.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/shiftzilla +11 -1
- data/lib/shiftzilla/engine.rb +12 -12
- data/lib/shiftzilla/helpers.rb +19 -15
- data/lib/shiftzilla/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae4dbe018b36c63cdd3bb19d6c565bfed278e2f2b2ff5fef0b1df41ae675acd8
|
4
|
+
data.tar.gz: dbab134260f9393364479e4ee6ad6f5a32f5e11c9265996316f366e8cd0b5246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71239194891c4c9ace39e0d1365f103b507ce2543588f313a53fbe7cf711fc7998e147d35c93e827f25c689aa7e6f68e4ebfe1cf2b81af9bb9dbf780a501c7ab
|
7
|
+
data.tar.gz: b9f876b0802f27c1d08b48cba882f69251a8f5dd2e63ebed7d4bb2b4ffc97d0e424570faa972dadd61eab22e901f7498db737030e59badfa89b843a7b4f38f34
|
data/bin/shiftzilla
CHANGED
@@ -45,7 +45,8 @@ Description:
|
|
45
45
|
|
46
46
|
Options:
|
47
47
|
EOF
|
48
|
-
opt :purge, "After querying for bug data - if we already have data
|
48
|
+
opt :purge, "After querying for bug data - if we already have data for today, clear it out before loading new data", :default => false
|
49
|
+
opt :configdir, "Specify a config directory for shiftzilla to use.", :default => DEFAULT_DIR
|
49
50
|
end
|
50
51
|
when 'build'
|
51
52
|
Trollop::options do
|
@@ -61,6 +62,7 @@ Options:
|
|
61
62
|
EOF
|
62
63
|
opt :local_preview, "Don't publish, just show the report locally", :default => false
|
63
64
|
opt :quiet, "For cron use; don't print anything to STDOUT.", :default => false
|
65
|
+
opt :configdir, "Specify a config directory for shiftzilla to use.", :default => DEFAULT_DIR
|
64
66
|
end
|
65
67
|
when 'purge'
|
66
68
|
Trollop::options do
|
@@ -73,6 +75,7 @@ Description:
|
|
73
75
|
|
74
76
|
Options:
|
75
77
|
EOF
|
78
|
+
opt :configdir, "Specify a config directory for shiftzilla to use.", :default => DEFAULT_DIR
|
76
79
|
end
|
77
80
|
when 'triage'
|
78
81
|
Trollop::options do
|
@@ -86,6 +89,7 @@ Description:
|
|
86
89
|
|
87
90
|
Options:
|
88
91
|
EOF
|
92
|
+
opt :configdir, "Specify a config directory for shiftzilla to use.", :default => DEFAULT_DIR
|
89
93
|
end
|
90
94
|
when 'help'
|
91
95
|
Trollop::educate
|
@@ -94,6 +98,12 @@ when 'version'
|
|
94
98
|
exit 0
|
95
99
|
end
|
96
100
|
|
101
|
+
if cmd_opts.has_key?(:configdir)
|
102
|
+
set_sza_dir(cmd_opts[:configdir])
|
103
|
+
else
|
104
|
+
set_sza_dir(DEFAULT_DIR)
|
105
|
+
end
|
106
|
+
|
97
107
|
# Check for the config info
|
98
108
|
check_config
|
99
109
|
|
data/lib/shiftzilla/engine.rb
CHANGED
@@ -10,14 +10,14 @@ include Shiftzilla::Helpers
|
|
10
10
|
module Shiftzilla
|
11
11
|
module Engine
|
12
12
|
def check_config
|
13
|
-
if not File.directory?(SZA_DIR)
|
13
|
+
if not File.directory?(Shiftzilla::SZA_DIR)
|
14
14
|
choose do |menu|
|
15
|
-
menu.header =
|
15
|
+
menu.header = "You don't have a Shiftzilla config directory at #{Shiftzilla::SZA_DIR}. Should I create one?"
|
16
16
|
menu.prompt = 'Choice?'
|
17
17
|
menu.choice(:yes) {
|
18
18
|
say('Okay. Creating config directory.')
|
19
|
-
Dir.mkdir(SZA_DIR)
|
20
|
-
Dir.mkdir(ARCH_DIR)
|
19
|
+
Dir.mkdir(Shiftzilla::SZA_DIR)
|
20
|
+
Dir.mkdir(Shiftzilla::ARCH_DIR)
|
21
21
|
}
|
22
22
|
menu.choice(:no) {
|
23
23
|
say('Okay. Exiting Shiftzilla.')
|
@@ -25,17 +25,17 @@ module Shiftzilla
|
|
25
25
|
}
|
26
26
|
end
|
27
27
|
end
|
28
|
-
if not File.directory?(ARCH_DIR)
|
29
|
-
puts
|
30
|
-
Dir.mkdir(ARCH_DIR)
|
28
|
+
if not File.directory?(Shiftzilla::ARCH_DIR)
|
29
|
+
puts "You don't have an archive directory at #{Shiftzilla::ARCH_DIR}. Creating it."
|
30
|
+
Dir.mkdir(Shiftzilla::ARCH_DIR)
|
31
31
|
end
|
32
|
-
if not File.exists?(CFG_FILE)
|
32
|
+
if not File.exists?(Shiftzilla::CFG_FILE)
|
33
33
|
choose do |menu|
|
34
|
-
menu.header = "\nYou don't have a shiftzilla_cfg.yml file in
|
34
|
+
menu.header = "\nYou don't have a shiftzilla_cfg.yml file in #{Shiftzilla::SZA_DIR}. Should I create one?"
|
35
35
|
menu.prompt = 'Choice?'
|
36
36
|
menu.choice(:yes) {
|
37
37
|
say('Okay. Creating shiftzilla_cfg.yml')
|
38
|
-
FileUtils.cp(CFG_TMPL,CFG_FILE)
|
38
|
+
FileUtils.cp(CFG_TMPL,Shiftzilla::CFG_FILE)
|
39
39
|
}
|
40
40
|
menu.choice(:no) {
|
41
41
|
say('Okay. Exiting Shiftzilla.')
|
@@ -43,9 +43,9 @@ module Shiftzilla
|
|
43
43
|
}
|
44
44
|
end
|
45
45
|
end
|
46
|
-
if not File.exists?(DB_FPATH)
|
46
|
+
if not File.exists?(Shiftzilla::DB_FPATH)
|
47
47
|
choose do |menu|
|
48
|
-
menu.header = "\nYou don't have a shiftzilla.sqlite file in
|
48
|
+
menu.header = "\nYou don't have a shiftzilla.sqlite file in #{Shiftzilla::SZA_DIR}.\nI can create it for you, but it is very important for you to\nconfigure Shiftzilla by puttng the proper settings in\n#{Shiftzilla::CFG_FILE} first.\nDo you want me to proceed with creating the database?"
|
49
49
|
menu.prompt = 'Choice?'
|
50
50
|
menu.choice(:yes) {
|
51
51
|
say('Okay. Creating shiftzilla.sqlite')
|
data/lib/shiftzilla/helpers.rb
CHANGED
@@ -8,17 +8,14 @@ require 'yaml'
|
|
8
8
|
|
9
9
|
module Shiftzilla
|
10
10
|
module Helpers
|
11
|
-
BZ_URL
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
CFG_TMPL = File.expand_path(File.join(File.dirname(THIS_PATH), '../../shiftzilla_cfg.yml.tmpl'))
|
20
|
-
SQL_TMPL = File.expand_path(File.join(File.dirname(THIS_PATH), '../../shiftzilla.sql.tmpl'))
|
21
|
-
VENDOR_DIR = File.expand_path(File.join(File.dirname(THIS_PATH), '../../vendor'))
|
11
|
+
BZ_URL = 'https://bugzilla.redhat.com/show_bug.cgi?id='
|
12
|
+
DB_FNAME = 'shiftzilla.sqlite'
|
13
|
+
DEFAULT_DIR = File.join(ENV['HOME'],'.shiftzilla')
|
14
|
+
THIS_PATH = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
|
15
|
+
HAML_TMPL = File.expand_path(File.join(File.dirname(THIS_PATH), '../../template.haml'))
|
16
|
+
CFG_TMPL = File.expand_path(File.join(File.dirname(THIS_PATH), '../../shiftzilla_cfg.yml.tmpl'))
|
17
|
+
SQL_TMPL = File.expand_path(File.join(File.dirname(THIS_PATH), '../../shiftzilla.sql.tmpl'))
|
18
|
+
VENDOR_DIR = File.expand_path(File.join(File.dirname(THIS_PATH), '../../vendor'))
|
22
19
|
|
23
20
|
GRAPH_DIMENSIONS = '800x400'
|
24
21
|
GRAPH_THEME = {
|
@@ -38,16 +35,23 @@ module Shiftzilla
|
|
38
35
|
:background_image => nil,
|
39
36
|
}
|
40
37
|
|
38
|
+
def set_sza_dir(sza_dir)
|
39
|
+
Shiftzilla.const_set('SZA_DIR',sza_dir)
|
40
|
+
Shiftzilla.const_set('ARCH_DIR',File.join(Shiftzilla::SZA_DIR,'archive'))
|
41
|
+
Shiftzilla.const_set('CFG_FILE',File.join(Shiftzilla::SZA_DIR,'shiftzilla_cfg.yml'))
|
42
|
+
Shiftzilla.const_set('DB_FPATH',File.join(Shiftzilla::SZA_DIR,DB_FNAME))
|
43
|
+
end
|
44
|
+
|
41
45
|
def tmp_dir
|
42
46
|
@tmp_dir ||= Dir.mktmpdir('shiftzilla-reports-')
|
43
47
|
end
|
44
48
|
|
45
49
|
def cfg_file
|
46
|
-
@cfg_file ||= validated_config_file(YAML.load_file(CFG_FILE))
|
50
|
+
@cfg_file ||= validated_config_file(YAML.load_file(Shiftzilla::CFG_FILE))
|
47
51
|
end
|
48
52
|
|
49
53
|
def dbh
|
50
|
-
@dbh ||= SQLite3::Database.new(DB_FPATH)
|
54
|
+
@dbh ||= SQLite3::Database.new(Shiftzilla::DB_FPATH)
|
51
55
|
end
|
52
56
|
|
53
57
|
def haml_engine
|
@@ -67,7 +71,7 @@ module Shiftzilla
|
|
67
71
|
def backup_db
|
68
72
|
unless db_backed_up
|
69
73
|
today = Date.today.strftime('%Y-%m-%d')
|
70
|
-
tpath = File.join(ARCH_DIR,today)
|
74
|
+
tpath = File.join(Shiftzilla::ARCH_DIR,today)
|
71
75
|
unless Dir.exists?(tpath)
|
72
76
|
Dir.mkdir(tpath)
|
73
77
|
end
|
@@ -79,7 +83,7 @@ module Shiftzilla
|
|
79
83
|
break unless File.exists?(apath)
|
80
84
|
copy_idx += 1
|
81
85
|
end
|
82
|
-
FileUtils.cp DB_FPATH, apath
|
86
|
+
FileUtils.cp Shiftzilla::DB_FPATH, apath
|
83
87
|
puts "Backed up the database."
|
84
88
|
@db_backed_up = true
|
85
89
|
end
|
data/lib/shiftzilla/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shiftzilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- N. Harrison Ripps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|