winci-updater 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -7
- data/lib/winci-updater.rb +8 -0
- data/lib/winci-updater/git.rb +2 -7
- data/lib/winci-updater/gui.rb +39 -38
- data/lib/winci-updater/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -2,11 +2,6 @@ winci-updater
|
|
2
2
|
======
|
3
3
|
|
4
4
|
[WinCI-updater] File updater capable of downloading files over Git (supports SSH).
|
5
|
-
|
6
|
-
Install
|
7
|
-
=======
|
8
|
-
|
9
|
-
gem install winci-updater
|
10
5
|
|
11
6
|
Introduction
|
12
7
|
=======
|
@@ -33,11 +28,27 @@ from the server, extracted locally and replaced with the old one, each time a ne
|
|
33
28
|
|
34
29
|
The solution is to incorporate into provisioning a VCS or DVCS such like Git and this project is realization of this solution.
|
35
30
|
|
31
|
+
Install
|
32
|
+
=======
|
33
|
+
|
34
|
+
gem install winci-updater
|
35
|
+
|
36
36
|
Usage
|
37
37
|
=====
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
require "rubygems"
|
40
|
+
require "bundler/setup"
|
41
|
+
|
42
|
+
require "winci-updater"
|
43
|
+
|
44
|
+
@git = WinCI::Updater::Git.new "_config.yaml"
|
45
|
+
@git.setup_ssh_key "key"
|
46
|
+
|
47
|
+
@updater_res = @git.provide File.expand_path('..'), 'files', true
|
48
|
+
|
49
|
+
Also take a look at test suite (Cucumber stories and RSpec examples in features and spec directories) for examples of usage.
|
50
|
+
|
51
|
+
For real world example look at its usage in WinCI-server ( WinCI-server/fixtures/updater ).
|
41
52
|
|
42
53
|
Developer Instructions
|
43
54
|
======================
|
data/lib/winci-updater.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
module WinCI
|
2
2
|
module Updater
|
3
|
+
require 'winci-updater/core_ext/string'
|
4
|
+
require 'winci-updater/git_ext/git'
|
5
|
+
require 'winci-updater/git_ext/lib'
|
6
|
+
require 'winci-updater/git_ext/base'
|
7
|
+
|
3
8
|
require 'winci-updater/version'
|
9
|
+
require 'winci-updater/const'
|
10
|
+
require 'winci-updater/logger'
|
11
|
+
require 'winci-updater/gui'
|
4
12
|
require 'winci-updater/git'
|
5
13
|
end
|
6
14
|
end
|
data/lib/winci-updater/git.rb
CHANGED
@@ -8,16 +8,11 @@ require "pathname"
|
|
8
8
|
require "fileutils"
|
9
9
|
require "git"
|
10
10
|
|
11
|
-
require 'winci-updater/git_ext/git'
|
12
|
-
require 'winci-updater/git_ext/lib'
|
13
|
-
require 'winci-updater/git_ext/base'
|
14
|
-
require 'winci-updater/core_ext/string'
|
15
|
-
require 'winci-updater/const'
|
16
|
-
require 'winci-updater/logger'
|
17
|
-
|
18
11
|
module WinCI
|
19
12
|
module Updater
|
20
13
|
class Git
|
14
|
+
include Gui
|
15
|
+
|
21
16
|
def initialize config_path="_config.yaml"
|
22
17
|
@config = YAML.load_file(config_path)
|
23
18
|
|
data/lib/winci-updater/gui.rb
CHANGED
@@ -1,47 +1,48 @@
|
|
1
1
|
module WinCI
|
2
2
|
module Updater
|
3
|
+
module Gui
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
def message_box(txt, title='Ruby', buttons=MB_OK | MB_SETFOREGROUND)
|
6
|
+
user32 = DL.dlopen('user32')
|
7
|
+
msgbox = user32['MessageBoxA', 'ILSSI']
|
8
|
+
r, rs = msgbox.call(0, txt, title, buttons)
|
9
|
+
return r
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
def inputbox(message, title="Message from #{__FILE__}")
|
13
|
+
# returns nil if 'cancel' is clicked
|
14
|
+
# returns a (possibly empty) string otherwise
|
15
|
+
require 'win32ole'
|
16
|
+
# hammer the arguments to vb-script style
|
17
|
+
vb_msg = %Q| "#{message.gsub("\n", '"& vbcrlf &"')}"|
|
18
|
+
vb_msg.gsub!("\t", '"& vbtab &"')
|
19
|
+
vb_msg.gsub!('&""&', '&')
|
20
|
+
vb_title = %Q|"#{title}"|
|
21
|
+
# go!
|
22
|
+
sc = WIN32OLE.new("ScriptControl")
|
23
|
+
sc.language = "VBScript"
|
24
|
+
sc.eval(%Q|Inputbox(#{vb_msg}, #{vb_title})|)
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
def popup(message)
|
28
|
+
require 'win32ole'
|
29
|
+
wsh = WIN32OLE.new('WScript.Shell')
|
30
|
+
wsh.popup(message, 0, __FILE__)
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
33
|
+
def prompt_user(msgRequest, msgWrong)
|
34
|
+
answer = ''
|
35
|
+
# prompt user to select destination installation disk
|
36
|
+
i = 0
|
37
|
+
begin
|
38
|
+
puts msgWrong if i > 0
|
39
|
+
answer = inputbox msgRequest
|
40
|
+
exit if not answer
|
41
|
+
answer = answer.upcase[0].chr if answer.length > 0
|
42
|
+
i = i + 1
|
43
|
+
end while !answer or (answer !~ /\A[A-Z]\Z/)
|
44
|
+
answer
|
45
|
+
end
|
44
46
|
end
|
45
|
-
|
46
47
|
end
|
47
48
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winci-updater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kamil Sobieraj
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-03 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|