six-launcher 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.
Files changed (5) hide show
  1. data/LICENSE +3 -0
  2. data/README +3 -0
  3. data/Rakefile +45 -0
  4. data/lib/six/launcher-app.rb +153 -0
  5. metadata +59 -0
data/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ == six-setup
2
+
3
+ Put appropriate LICENSE for your project here.
data/README ADDED
@@ -0,0 +1,3 @@
1
+ == six-setup
2
+
3
+ You should document your project here.
@@ -0,0 +1,45 @@
1
+ #
2
+ # To change this template, choose Tools | Templates
3
+ # and open the template in the editor.
4
+
5
+
6
+ require 'rubygems'
7
+ require 'rake'
8
+ require 'rake/clean'
9
+ require 'rake/gempackagetask'
10
+ require 'rake/rdoctask'
11
+ require 'rake/testtask'
12
+
13
+ spec = Gem::Specification.new do |s|
14
+ s.name = 'six-launcher'
15
+ s.version = '0.0.1'
16
+ s.has_rdoc = true
17
+ s.extra_rdoc_files = ['README', 'LICENSE']
18
+ s.summary = 'Your summary here'
19
+ s.description = s.summary
20
+ s.author = ''
21
+ s.email = ''
22
+ # s.executables = ['your_executable_here']
23
+ s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,spec}/**/*") + Dir.glob("lib/*/**/*.rb")
24
+ s.require_path = "lib"
25
+ s.bindir = "bin"
26
+ end
27
+
28
+ Rake::GemPackageTask.new(spec) do |p|
29
+ p.gem_spec = spec
30
+ p.need_tar = true
31
+ p.need_zip = true
32
+ end
33
+
34
+ Rake::RDocTask.new do |rdoc|
35
+ files =['README', 'LICENSE', 'lib/**/*.rb']
36
+ rdoc.rdoc_files.add(files)
37
+ rdoc.main = "README" # page to start on
38
+ rdoc.title = "six-launcher Docs"
39
+ rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
40
+ rdoc.options << '--line-numbers'
41
+ end
42
+
43
+ Rake::TestTask.new do |t|
44
+ t.test_files = FileList['test/**/*.rb']
45
+ end
@@ -0,0 +1,153 @@
1
+ # encoding: UTF-8
2
+
3
+ # Fix for Ocra
4
+ #$LOAD_PATH.unshift File.dirname(__FILE__)
5
+ #gem 'win32-process'
6
+ require 'win32/process'
7
+ #require 'singleton'
8
+
9
+ class Setup
10
+ RUBY = "tools/ruby/bin/ruby.exe"
11
+ GEM = "tools/ruby/bin/gem"
12
+ #include Singleton
13
+
14
+ BASE_PATH = if ENV['OCRA_EXECUTABLE']
15
+ if ENV['OCRA_EXECUTABLE'][/(.*)[\/|\\].*/]
16
+ p = $1
17
+ p.gsub!('\\', '/')
18
+ p
19
+ else
20
+ p = Dir.pwd
21
+ p.gsub!('\\', '/')
22
+ p
23
+ end
24
+ elsif defined?(TAR2RUBYSCRIPT)
25
+ if oldlocation
26
+ oldlocation
27
+ else
28
+ Dir.pwd
29
+ end
30
+ else
31
+ p = Dir.pwd
32
+ p.gsub!('\\', '/')
33
+ p
34
+ end
35
+ TOOL_PATH = File.join(BASE_PATH, 'tools')
36
+ RUBY_PATH = File.join(TOOL_PATH, 'ruby')
37
+
38
+ def initialize(b = nil)
39
+ Dir.chdir BASE_PATH
40
+ options
41
+ if b
42
+ action(b)
43
+ else
44
+ while ((code = gets.strip) != "exit")
45
+ action(code)
46
+ options
47
+ end
48
+ end
49
+ end
50
+
51
+ def rubycheck
52
+ update_ruby unless File.exists?(File.join(RUBY_PATH, 'bin', 'ruby.exe'))
53
+ end
54
+
55
+ def bla
56
+ puts
57
+ puts "Please press enter to continue"
58
+ STDIN.gets
59
+ end
60
+
61
+ def update_ruby
62
+ puts "Updating Ruby"
63
+ system "#{RUBY} tools/six-downloader.rb tools/six-downloader_ruby.yml"
64
+ system "tools/7z.exe x -y tools/ruby.7z -otools"
65
+ end
66
+
67
+ def update_gems
68
+ rubycheck
69
+ puts "Updating Ruby Gems"
70
+ system "#{RUBY} #{GEM} install *.gem" if Dir["*.gem"].size > 0
71
+ system "#{RUBY} #{GEM} update"
72
+ end
73
+
74
+ def start_updater_web(cl = nil)
75
+ rubycheck
76
+ update_gems
77
+ puts "Starting Updater-web..."
78
+ b = "-U -rubygems six-updater-web.rb"
79
+ cl = if cl
80
+ "#{b} #{cl}"
81
+ else
82
+ b
83
+ end
84
+ system "#{RUBY} tools/six-downloader.rb tools/six-downloader_updater_web.yml --output \"#{BASE_PATH}\""
85
+ detached(File.join(RUBY_PATH, 'bin', 'ruby.exe'), cl, BASE_PATH)
86
+ end
87
+
88
+ def start_updater
89
+ rubycheck
90
+ update_gems
91
+ puts "Starting Updater..."
92
+ system "#{RUBY} tools/six-downloader.rb tools/six-downloader.yml --output \"#{BASE_PATH}\""
93
+ detached(File.join(RUBY_PATH, 'bin', 'ruby.exe'), "-U -rubygems six-updater.rb", BASE_PATH)
94
+ end
95
+
96
+ def detached(app, cl, path)
97
+ begin
98
+ app.gsub!("/", "\\")
99
+ cl = "/C \"#{app}\" #{cl}"
100
+ struct = Process.create(
101
+ :app_name => File.join(ENV['WINDIR'], 'system32', 'cmd.exe'),
102
+ :command_line => cl,
103
+ :creation_flags => Process::DETACHED_PROCESS,
104
+ :process_inherit => false,
105
+ :thread_inherit => false,
106
+ :cwd => path,
107
+ :inherit => false
108
+ #:environment => ""
109
+ )
110
+ rescue
111
+ puts "WARNING: Something went wrong starting the app: #{app}"
112
+ end
113
+ end
114
+
115
+ def action(code)
116
+ case code
117
+ when "100"
118
+ update_ruby
119
+ when "101"
120
+ update_gems
121
+ when "1"
122
+ start_updater_web
123
+ when "2"
124
+ start_updater
125
+ when "51"
126
+ start_updater_web("--bind 0.0.0.0")
127
+ end
128
+ bla
129
+ end
130
+
131
+ def options
132
+ puts
133
+ puts "WARNING: If you use Windows Vista/7 with UAC,"
134
+ puts "please make sure you run this program 'As Administrator'"
135
+ puts "-----"
136
+ puts "1 - Start updater-web"
137
+ puts "2 - Start updater"
138
+ puts "51 - Start updater-web on public interface"
139
+ puts "-----"
140
+ puts "100 - Install/Update Ruby"
141
+ puts "101 - Install/Update Ruby Gems"
142
+ puts
143
+ puts "Please enter your choice and press enter. Or press CTRL+C to abort"
144
+ end
145
+ end
146
+
147
+ if not defined?(Ocra)
148
+ if ARGV[0]
149
+ Setup.new(ARGV[0])
150
+ else
151
+ Setup.new
152
+ end
153
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: six-launcher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - ""
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-30 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Your summary here
17
+ email: ""
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - LICENSE
25
+ files:
26
+ - LICENSE
27
+ - README
28
+ - Rakefile
29
+ - lib/six/launcher-app.rb
30
+ has_rdoc: true
31
+ homepage:
32
+ licenses: []
33
+
34
+ post_install_message:
35
+ rdoc_options: []
36
+
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ requirements: []
52
+
53
+ rubyforge_project:
54
+ rubygems_version: 1.3.5
55
+ signing_key:
56
+ specification_version: 3
57
+ summary: Your summary here
58
+ test_files: []
59
+