redgit 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +6 -0
- data/README.rdoc +64 -0
- data/Rakefile +1 -0
- data/bin/redgit +229 -0
- data/lib/redgit/version.rb +3 -0
- data/redgit.gemspec +28 -0
- metadata +121 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: fef0a73c73e825205012d1a9577440e65f81d9ac
|
|
4
|
+
data.tar.gz: 8ba1e1fd65defe44ed849cf3d74464a6995be815
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 40ee82e2e88a2388312d4ea847aa180a677060033666e0dd8f9649c0daf58b85c36f31e20554602baacd45b78ac61a2814e8037f70146188212fc97c0f72fd4b
|
|
7
|
+
data.tar.gz: d07c3bdabdbe5cb361e7a63fc4dbc7c771b5cbf58d688a5cb7b9368cbd8359fd3bd65cdd443c9964ff194dc004fa5de59427fd0ae41b5d52d54a1933ee7511a6
|
data/Gemfile
ADDED
data/README.rdoc
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
= Jumping Words
|
|
2
|
+
The program speaks and displays in the pop-up window the word or phrase and the word's translation or phrase.
|
|
3
|
+
After end of list back to the start.
|
|
4
|
+
|
|
5
|
+
Supports OS MAC OS X 10.8 or higher or Ubuntu
|
|
6
|
+
|
|
7
|
+
== Dependencies
|
|
8
|
+
For linux
|
|
9
|
+
sudo apt-get install libnotify-bin
|
|
10
|
+
|
|
11
|
+
On MAC OS X before you start, you should add to your system the voices for words and translates.
|
|
12
|
+
To enable the speech recognition ability and use speech commands on your Mac, the first thing you have to do is open the Speech menu from System Preferences.
|
|
13
|
+
|
|
14
|
+
For example for Russian you should install the Milena voice.
|
|
15
|
+
|
|
16
|
+
== Config
|
|
17
|
+
Default:
|
|
18
|
+
Show message: true
|
|
19
|
+
Timeout between a word and translate: 3 sec.
|
|
20
|
+
Timeout to start list: 10 sec.
|
|
21
|
+
MAC OS X word voice: Vicki.
|
|
22
|
+
MAC OS X translate voice: Milena.
|
|
23
|
+
|
|
24
|
+
More:
|
|
25
|
+
jwords -h
|
|
26
|
+
|
|
27
|
+
== Actions
|
|
28
|
+
Starting
|
|
29
|
+
jwords start
|
|
30
|
+
or
|
|
31
|
+
jwords -v Fiona -t Milena -i5 start
|
|
32
|
+
|
|
33
|
+
Stoping
|
|
34
|
+
ctrl+c
|
|
35
|
+
|
|
36
|
+
View a list of words
|
|
37
|
+
jwords list
|
|
38
|
+
|
|
39
|
+
1 convenient: удобный | 7
|
|
40
|
+
2 If I were you: на твоем месте | 6
|
|
41
|
+
3 in turns: по очереди | 5
|
|
42
|
+
4 endurance: выносливость | 2
|
|
43
|
+
5 spoil, spoilt, spoilt: портиться, испортилось | 2
|
|
44
|
+
6 to lead, led, led: приводить, привели | 2
|
|
45
|
+
7 to achieve: достигать | 2
|
|
46
|
+
...
|
|
47
|
+
|
|
48
|
+
Adding words to the database
|
|
49
|
+
jwords -a root: корень
|
|
50
|
+
jwords -a to play: играть
|
|
51
|
+
|
|
52
|
+
Delete a word from the database (indicated by the index of the word in the list)
|
|
53
|
+
jwords -d 1
|
|
54
|
+
|
|
55
|
+
If you want to change words in directly in CSV find .jwords directory in your home directory, then open jumping_words_db.csv. After saving the file restart the script.
|
|
56
|
+
|
|
57
|
+
== Install
|
|
58
|
+
gem install jumping_words
|
|
59
|
+
|
|
60
|
+
For OS X users: you also should install the https://github.com/alloy/terminal-notifier for notifications.
|
|
61
|
+
brew install terminal-notifier
|
|
62
|
+
|
|
63
|
+
== ToDo
|
|
64
|
+
For Ubuntu users give config for changing language system voice.
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/redgit
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'logger'
|
|
5
|
+
require 'restclient'
|
|
6
|
+
require 'awesome_print'
|
|
7
|
+
require 'uri'
|
|
8
|
+
require 'pp'
|
|
9
|
+
require 'rack'
|
|
10
|
+
require 'term/ansicolor'
|
|
11
|
+
require 'active_record'
|
|
12
|
+
require 'active_support/core_ext/hash'
|
|
13
|
+
include Term::ANSIColor
|
|
14
|
+
|
|
15
|
+
def die text
|
|
16
|
+
puts "Отменено: #{red(text)}"
|
|
17
|
+
exit 1
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class IssueManager
|
|
22
|
+
|
|
23
|
+
INPROGRESS=[1, 2, 3]
|
|
24
|
+
|
|
25
|
+
attr_accessor :host, :project, :apikey, :last
|
|
26
|
+
|
|
27
|
+
def initialize
|
|
28
|
+
@host=`git config redmine.host`.strip
|
|
29
|
+
@host=(@host.empty?) ? 'http://rk.rnds.pro' : @host
|
|
30
|
+
|
|
31
|
+
@project=`git config redmine.project`.strip
|
|
32
|
+
@apikey=`git config redmine.key`.strip
|
|
33
|
+
|
|
34
|
+
if @project.empty? or @apikey.empty?
|
|
35
|
+
puts "Используйте: #{$0} setup <project> <api-key> [host = http://rk.rnds.pro]"
|
|
36
|
+
die "Не задан проект или API-ключ."
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# RestClient.log = Logger.new(STDOUT)
|
|
40
|
+
|
|
41
|
+
@client = RestClient::Resource.new("#{@host}/projects/#{@project}",
|
|
42
|
+
headers: {
|
|
43
|
+
'X-Redmine-API-Key' => @apikey,
|
|
44
|
+
accept: :json
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def dump_last_issue
|
|
50
|
+
`git config redmine.last.id "#{@last['id']}"`
|
|
51
|
+
`git config redmine.last.subject "#{@last['subject'].strip}"`
|
|
52
|
+
`git config redmine.last.updated "#{@last['updated_on']}"`
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def restore_last_issue
|
|
56
|
+
@last ||= {
|
|
57
|
+
id: `git config redmine.last.id`.strip,
|
|
58
|
+
subject: `git config redmine.last.subject`.strip,
|
|
59
|
+
updated_on: `git config redmine.last.updated`.strip,
|
|
60
|
+
}.with_indifferent_access
|
|
61
|
+
raise "error" if @last[:id].empty? or @last[:subject].empty? or @last[:updated_on].empty?
|
|
62
|
+
return @last
|
|
63
|
+
rescue => e
|
|
64
|
+
@last = nil
|
|
65
|
+
return @last
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def issues options = {}
|
|
69
|
+
|
|
70
|
+
# params = {
|
|
71
|
+
# limit: (options[:limit] || 6),
|
|
72
|
+
# f: [:status_id, :assigned_to_id, ''],
|
|
73
|
+
# op: {status_id: '=', assigned_to_id: '='},
|
|
74
|
+
# v: {status_id: INPROGRESS, assigned_to_id: ['me']},
|
|
75
|
+
# sort: "updated_on:desc,id:desc"
|
|
76
|
+
# }
|
|
77
|
+
|
|
78
|
+
params = {
|
|
79
|
+
limit: 20,
|
|
80
|
+
status_id: 'opened',
|
|
81
|
+
assigned_to_id: 'me',
|
|
82
|
+
sort: "updated_on:desc,id:desc",
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#query = Rack::Utils.build_nested_query params
|
|
86
|
+
|
|
87
|
+
#return JSON.parse(@client['/issues.json' + "?#{query}"].get)['issues'].map{|i| i.with_indifferent_access}
|
|
88
|
+
raw_issues = JSON.parse(@client['/issues.json'].get(params: params))['issues']
|
|
89
|
+
raw_issues.select!{|i| INPROGRESS.include?(i['status']['id'].to_i)}
|
|
90
|
+
return raw_issues.first(options[:limit] || 6).map{|i| i.with_indifferent_access}
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def print_issue idx, issue
|
|
94
|
+
# puts " [%s] %s #%s %s %s %s" % [
|
|
95
|
+
puts " [%s] %s #%s %s %s" % [
|
|
96
|
+
green(idx),
|
|
97
|
+
I18n.l(DateTime.parse(issue['updated_on']), format: :short),
|
|
98
|
+
cyan(issue['id'].to_s),
|
|
99
|
+
"(#{yellow(issue['status']['name']) rescue yellow('НЕТ')})".ljust(20),
|
|
100
|
+
#{}"(#{yellow(issue['assigned_to']['name']) rescue yellow('НЕТ')})".ljust(27),
|
|
101
|
+
issue['subject'],
|
|
102
|
+
]
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def print_issues issues
|
|
106
|
+
issues.each_with_index do |issue, i|
|
|
107
|
+
print_issue (i + 2).to_s, issue
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def select_issue issues
|
|
112
|
+
puts "Выберите задачу".center(45, '=')
|
|
113
|
+
if restore_last_issue
|
|
114
|
+
puts yellow("Последняя:")
|
|
115
|
+
print_issue '1', @last
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
puts yellow("Открытые:")
|
|
119
|
+
print_issues issues
|
|
120
|
+
while true
|
|
121
|
+
print "> "
|
|
122
|
+
cmd = $stdin.gets.strip
|
|
123
|
+
die "выход" if cmd == "q" or cmd == "quit"
|
|
124
|
+
|
|
125
|
+
idx = cmd.to_i
|
|
126
|
+
|
|
127
|
+
issue = if idx == 1
|
|
128
|
+
@last
|
|
129
|
+
elsif (idx >= 2 and idx <= (issues.count + 1))
|
|
130
|
+
issues[idx - 2]
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
break if issue
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
@last = issue
|
|
137
|
+
dump_last_issue
|
|
138
|
+
@last
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def commit_msg
|
|
144
|
+
message_file = ARGV[0]
|
|
145
|
+
message = File.read(message_file).strip
|
|
146
|
+
|
|
147
|
+
regex = /(refs[ ]*#(\d+)|fixes[ ]*#(\d+))/
|
|
148
|
+
|
|
149
|
+
if message.empty?
|
|
150
|
+
die "Сообщение не может быть пустым"
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if !regex.match(message)
|
|
154
|
+
|
|
155
|
+
puts red("В сообщении не указан номер задачи в виде refs #XXX или fixes #XXX")
|
|
156
|
+
|
|
157
|
+
STDIN.reopen('/dev/tty')
|
|
158
|
+
|
|
159
|
+
im = IssueManager.new
|
|
160
|
+
|
|
161
|
+
puts "".center(45, '=')
|
|
162
|
+
puts "Трекер: " + yellow(im.host) + " Проект: " + yellow(im.project)
|
|
163
|
+
|
|
164
|
+
issues = im.issues
|
|
165
|
+
issue = im.select_issue issues
|
|
166
|
+
message += " refs ##{issue[:id]}\n"
|
|
167
|
+
|
|
168
|
+
File.write(message_file, message)
|
|
169
|
+
|
|
170
|
+
STDIN.close
|
|
171
|
+
|
|
172
|
+
exit 0
|
|
173
|
+
else
|
|
174
|
+
exit 0
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def git_root
|
|
179
|
+
root = `git rev-parse --show-toplevel`.strip
|
|
180
|
+
|
|
181
|
+
if $? != 0 or root.empty?
|
|
182
|
+
die "Убедитесь что вы находитесь в рабочей папке git-репозитория"
|
|
183
|
+
end
|
|
184
|
+
return root
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if ARGV[0] == "setup"
|
|
188
|
+
root = git_root
|
|
189
|
+
|
|
190
|
+
if ARGV[1].to_s.empty? or ARGV[2].to_s.empty?
|
|
191
|
+
puts "Используйте: #{$0} setup <project> <api-key> [host = http://rk.rnds.pro]"
|
|
192
|
+
die "Не задан проект или API-ключ."
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
`mkdir #{root}/.git/hooks &> /dev/null`
|
|
196
|
+
`cp #{$0} #{root}/.git/hooks/commit-msg`
|
|
197
|
+
die '' if $? != 0
|
|
198
|
+
`chmod 777 #{root}/.git/hooks/commit-msg`
|
|
199
|
+
die '' if $? != 0
|
|
200
|
+
|
|
201
|
+
`git config redmine.project #{ARGV[1]}`
|
|
202
|
+
`git config redmine.key #{ARGV[2]}`
|
|
203
|
+
`git config redmine.host #{ARGV[3]}` if !ARGV[3].to_s.empty?
|
|
204
|
+
exit 1
|
|
205
|
+
elsif ARGV[0] == "issues"
|
|
206
|
+
root = git_root
|
|
207
|
+
im = IssueManager.new
|
|
208
|
+
im.print_issues im.issues
|
|
209
|
+
|
|
210
|
+
exit 0
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
begin
|
|
214
|
+
if File.basename($0) == "commit-msg"
|
|
215
|
+
commit_msg
|
|
216
|
+
else
|
|
217
|
+
im = IssueManager.new
|
|
218
|
+
issues = im.issues
|
|
219
|
+
i = im.select_issue issues
|
|
220
|
+
end
|
|
221
|
+
rescue => e
|
|
222
|
+
ap e
|
|
223
|
+
puts e.backtrace
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
die "ошибка"
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
data/redgit.gemspec
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "redgit/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "redgit"
|
|
7
|
+
s.version = Redgit::VERSION
|
|
8
|
+
s.authors = ["Samoilenko Yuri"]
|
|
9
|
+
s.email = ["kinnalru@gmail.com"]
|
|
10
|
+
#s.homepage = "https://github.com/sunchess/jumping_words"
|
|
11
|
+
s.summary = %q{Redgit is gem for commit-msg git hook redmine integration}
|
|
12
|
+
s.description = %q{Redgit is gem for commit-msg git hook redmine integration.}
|
|
13
|
+
|
|
14
|
+
s.files = `git ls-files`.split("\n")
|
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
17
|
+
s.require_paths = ["lib"]
|
|
18
|
+
|
|
19
|
+
# specify any dependencies here; for example:
|
|
20
|
+
# s.add_development_dependency "rspec"
|
|
21
|
+
s.add_runtime_dependency "rest-client"
|
|
22
|
+
s.add_runtime_dependency "term-ansicolor"
|
|
23
|
+
s.add_runtime_dependency "activerecord"
|
|
24
|
+
s.add_runtime_dependency 'awesome_print'
|
|
25
|
+
s.add_runtime_dependency 'rack'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: redgit
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Samoilenko Yuri
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-08-04 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rest-client
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: term-ansicolor
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: activerecord
|
|
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: awesome_print
|
|
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
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rack
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
description: Redgit is gem for commit-msg git hook redmine integration.
|
|
84
|
+
email:
|
|
85
|
+
- kinnalru@gmail.com
|
|
86
|
+
executables:
|
|
87
|
+
- redgit
|
|
88
|
+
extensions: []
|
|
89
|
+
extra_rdoc_files: []
|
|
90
|
+
files:
|
|
91
|
+
- ".gitignore"
|
|
92
|
+
- Gemfile
|
|
93
|
+
- README.rdoc
|
|
94
|
+
- Rakefile
|
|
95
|
+
- bin/redgit
|
|
96
|
+
- lib/redgit/version.rb
|
|
97
|
+
- redgit.gemspec
|
|
98
|
+
homepage:
|
|
99
|
+
licenses: []
|
|
100
|
+
metadata: {}
|
|
101
|
+
post_install_message:
|
|
102
|
+
rdoc_options: []
|
|
103
|
+
require_paths:
|
|
104
|
+
- lib
|
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
|
+
requirements:
|
|
112
|
+
- - ">="
|
|
113
|
+
- !ruby/object:Gem::Version
|
|
114
|
+
version: '0'
|
|
115
|
+
requirements: []
|
|
116
|
+
rubyforge_project:
|
|
117
|
+
rubygems_version: 2.4.6
|
|
118
|
+
signing_key:
|
|
119
|
+
specification_version: 4
|
|
120
|
+
summary: Redgit is gem for commit-msg git hook redmine integration
|
|
121
|
+
test_files: []
|