limer 0.0.3 → 0.0.4
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/.gitignore +2 -1
- data/lib/limer/gitpt.rb +40 -26
- data/lib/limer/version.rb +1 -1
- metadata +2 -2
data/.gitignore
CHANGED
data/lib/limer/gitpt.rb
CHANGED
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
|
7
7
|
module Limer
|
8
8
|
class Gitpt
|
9
|
-
attr_reader :token, :highline, :
|
9
|
+
attr_reader :token, :highline, :name, :memberships, :applicable_stories, :setting_file
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
@highline = HighLine.new
|
@@ -24,13 +24,17 @@ module Limer
|
|
24
24
|
bold HighLine::BLUE + string
|
25
25
|
end
|
26
26
|
|
27
|
+
def missing string
|
28
|
+
bold HighLine::RED + string
|
29
|
+
end
|
30
|
+
|
27
31
|
def bold string
|
28
32
|
HighLine::BOLD + string + HighLine::RESET
|
29
33
|
end
|
30
34
|
|
31
35
|
def hello
|
32
|
-
highline.say HighLine::RESET
|
33
|
-
highline.say "Welcome to #{bold '
|
36
|
+
@highline.say HighLine::RESET
|
37
|
+
@highline.say "Welcome to #{bold 'Limer'}.\n\n"
|
34
38
|
end
|
35
39
|
|
36
40
|
def settings_valid?
|
@@ -38,7 +42,7 @@ module Limer
|
|
38
42
|
end
|
39
43
|
|
40
44
|
def stored
|
41
|
-
highline.say "
|
45
|
+
@highline.say "
|
42
46
|
Thank you. Your settings have been stored at #{highlight @settings_file}
|
43
47
|
You may remove that file for the wizard to reappear.
|
44
48
|
|
@@ -48,7 +52,7 @@ module Limer
|
|
48
52
|
def load_setting
|
49
53
|
if File.exists? setting_file
|
50
54
|
settings = YAML.load(File.read setting_file)
|
51
|
-
@
|
55
|
+
@name= settings[:name]
|
52
56
|
@token = settings[:token]
|
53
57
|
else
|
54
58
|
end
|
@@ -60,10 +64,10 @@ module Limer
|
|
60
64
|
project_ids = File.read(project_id_file).split(/[\s]+/).map(&:to_i)
|
61
65
|
end
|
62
66
|
unless project_ids and project_ids.size > 0
|
63
|
-
highline.say "
|
67
|
+
@highline.say "Project id олдсонгүй." + bold(".pt_project_id") + " файлд хадгалана уу"
|
64
68
|
exit 1
|
65
69
|
end
|
66
|
-
loading '
|
70
|
+
loading 'Pivotal Tracker холболт хийгдэж байна: ... ' do
|
67
71
|
projects = project_ids.collect do |project_id|
|
68
72
|
PivotalTracker::Project.find(project_id)
|
69
73
|
end
|
@@ -85,13 +89,13 @@ module Limer
|
|
85
89
|
end
|
86
90
|
|
87
91
|
def request_settings
|
88
|
-
highline.say
|
89
|
-
highline.say "
|
90
|
-
token = highline.ask bold("
|
91
|
-
|
92
|
-
highline.say "\n"
|
92
|
+
@highline.say missing('Тохиргооны файл байхгүй байна.')
|
93
|
+
@highline.say "Pivotal Tracker холбогдох тохиргоог хийнэ үү.\n\n"
|
94
|
+
@token = @highline.ask bold("API key: ")
|
95
|
+
@name= @highline.ask bold("Pivotal Tracker дээрх нэр: ")
|
96
|
+
@highline.say "\n"
|
93
97
|
|
94
|
-
settings = { :token => token, :
|
98
|
+
settings = { :token => @token, :name=> @name}
|
95
99
|
|
96
100
|
File.open setting_file, 'w' do |file|
|
97
101
|
file.write settings.to_yaml
|
@@ -103,13 +107,13 @@ module Limer
|
|
103
107
|
def choose_story
|
104
108
|
selected_story = nil
|
105
109
|
|
106
|
-
highline.choose do |menu|
|
107
|
-
menu.header = "
|
108
|
-
applicable_stories.each do |story|
|
110
|
+
@highline.choose do |menu|
|
111
|
+
menu.header = HighLine::BLUE + "Story сонгоно уу" + HighLine::RESET
|
112
|
+
@applicable_stories.each do |story|
|
109
113
|
owner_name = story.owned_by
|
110
114
|
owner = if owner_name
|
111
115
|
owners = memberships.select{|member| member.name == owner_name}
|
112
|
-
owners.first ? owners.first.
|
116
|
+
owners.first ? owners.first.name: '?'
|
113
117
|
else
|
114
118
|
'?'
|
115
119
|
end
|
@@ -120,24 +124,34 @@ module Limer
|
|
120
124
|
elsif state != 'finished'
|
121
125
|
state = HighLine::RED + state + HighLine::RESET
|
122
126
|
end
|
123
|
-
state += HighLine::BOLD if owner ==
|
127
|
+
state += HighLine::BOLD if owner == @name
|
124
128
|
|
125
|
-
label = "(#{owner}, #{state}) #{story.name}"
|
126
|
-
label = bold(label) if owner ==
|
129
|
+
label = "(" + HighLine::YELLOW + "#{owner}"+ HighLine::RESET + ", #{state}) #{story.name} - " + HighLine::BLUE + story.story_type.capitalize + HighLine::RESET
|
130
|
+
label = bold(label) if owner == @name
|
127
131
|
menu.choice(label) { selected_story = story }
|
128
132
|
end
|
133
|
+
menu.choice 'Гарах' do |chosen|
|
134
|
+
exit 1
|
135
|
+
end
|
129
136
|
menu.hidden ''
|
130
137
|
end
|
131
138
|
|
132
139
|
if selected_story
|
133
|
-
message =
|
134
|
-
highline.
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
140
|
+
message = nil
|
141
|
+
@highline.choose do |menu|
|
142
|
+
menu.header = "Төрлөө сонгоно уу"
|
143
|
+
menu.choices "fixed","delivers","Гарах" do |chosen|
|
144
|
+
if chosen == "Гарах"
|
145
|
+
exit 1
|
146
|
+
end
|
147
|
+
message = chosen
|
148
|
+
end
|
149
|
+
menu.hidden ''
|
139
150
|
end
|
140
151
|
|
152
|
+
|
153
|
+
commit_message = "[#{message} ##{selected_story.id}] #{selected_story.name}"
|
154
|
+
# puts commit_message
|
141
155
|
exec('git', 'commit', '-m', commit_message)
|
142
156
|
end
|
143
157
|
end
|
data/lib/limer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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-04
|
12
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|