mystro-common 0.1.0 → 0.1.2
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.
- data/Rakefile +0 -50
- data/lib/mystro/common/version.rb +1 -1
- data/lib/mystro/plugin.rb +55 -4
- metadata +2 -2
data/Rakefile
CHANGED
@@ -1,51 +1 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
def changelog(last=nil, single=false)
|
4
|
-
command="git --no-pager log --format='%an::::%h::::%s'"
|
5
|
-
|
6
|
-
list = `git tag`
|
7
|
-
|
8
|
-
puts "# Changelog"
|
9
|
-
puts
|
10
|
-
|
11
|
-
ordered = list.lines.sort_by {|e| (a,b,c) = e.gsub(/^v/,"").split("."); "%3d%3d%3d" % [a, b, c]}
|
12
|
-
|
13
|
-
ordered.reject{|e| (a,b,c,d) = e.split("."); !d.nil?}.reverse_each do |t|
|
14
|
-
tag = t.chomp
|
15
|
-
|
16
|
-
if last
|
17
|
-
check = { }
|
18
|
-
out = []
|
19
|
-
log = `#{command} #{last}...#{tag}`
|
20
|
-
log.lines.each do |line|
|
21
|
-
(who, hash, msg) = line.split('::::')
|
22
|
-
unless check[msg]
|
23
|
-
unless msg =~ /^Merge branch/ || msg =~ /CHANGELOG/ || msg =~ /^(v|version|changes for|preparing|ready for release|ready to release|bump version)*\s*(v|version)*\d+\.\d+\.\d+/
|
24
|
-
msg.gsub(" *", "\n*").gsub(/^\*\*/, " *").lines.each do |l|
|
25
|
-
line = l =~ /^(\s+)*\*/ ? l : "* #{l}"
|
26
|
-
out << line
|
27
|
-
end
|
28
|
-
check[msg] = hash
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
puts "## #{last}:"
|
33
|
-
out.each { |e| puts e }
|
34
|
-
#puts log
|
35
|
-
puts
|
36
|
-
end
|
37
|
-
|
38
|
-
last = tag
|
39
|
-
exit if single
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
desc "generate changelog output"
|
44
|
-
task :changelog do
|
45
|
-
changelog
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "show current changes (changelog output from HEAD to most recent tag)"
|
49
|
-
task :current do
|
50
|
-
changelog("HEAD",true)
|
51
|
-
end
|
data/lib/mystro/plugin.rb
CHANGED
@@ -35,10 +35,51 @@ module Mystro
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def register(
|
38
|
+
def register(key, opts={})
|
39
39
|
@plugins ||= {}
|
40
|
-
@plugins[
|
41
|
-
|
40
|
+
@plugins[key] = opts
|
41
|
+
name = key.to_s.capitalize
|
42
|
+
@plugins[key][:name] = name
|
43
|
+
end
|
44
|
+
|
45
|
+
def ui
|
46
|
+
@ui ||= begin
|
47
|
+
ui = {}
|
48
|
+
@plugins.each do |key, opts|
|
49
|
+
if opts[:ui]
|
50
|
+
n = opts[:name]
|
51
|
+
ui[n] = opts[:ui]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
ui
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def jobs
|
59
|
+
@jobs ||= begin
|
60
|
+
jobs = []
|
61
|
+
@plugins.each do |key, opts|
|
62
|
+
if opts[:jobs]
|
63
|
+
jobs << opts[:jobs]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
jobs.flatten
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def schedule
|
71
|
+
@schedule ||= begin
|
72
|
+
s = {}
|
73
|
+
@plugins.each do |key, opts|
|
74
|
+
if opts[:schedule]
|
75
|
+
opts[:schedule].each do |w, o|
|
76
|
+
n = w.to_s.capitalize + "Worker"
|
77
|
+
s[n] = { "cron" => o}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
s
|
82
|
+
end
|
42
83
|
end
|
43
84
|
end
|
44
85
|
|
@@ -57,6 +98,16 @@ module Mystro
|
|
57
98
|
Mystro::Plugin.on(self, event, &block)
|
58
99
|
end
|
59
100
|
|
101
|
+
def register(opts={})
|
102
|
+
key = self.name.split('::').last.downcase.to_sym
|
103
|
+
Mystro::Plugin.register(key, opts)
|
104
|
+
end
|
105
|
+
|
106
|
+
#def ui(path)
|
107
|
+
# name = self.name.split('::').last
|
108
|
+
# Mystro::Plugin.register_ui(name, path)
|
109
|
+
#end
|
110
|
+
|
60
111
|
def command(name, desc, klass=nil, &block)
|
61
112
|
on "commands:loaded" do |args|
|
62
113
|
Mystro::Log.debug "loading commands for #{name}"
|
@@ -70,4 +121,4 @@ module Mystro
|
|
70
121
|
end
|
71
122
|
end
|
72
123
|
end
|
73
|
-
end
|
124
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mystro-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|