six-updater-web 0.12.7 → 0.13.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.
- data/Rakefile +1 -1
- data/lib/common.rb +4 -3
- data/lib/config/environment.rb +18 -0
- data/lib/config/six-updater-web.rb +8 -23
- data/lib/init.rb +20 -11
- metadata +3 -3
data/Rakefile
CHANGED
data/lib/common.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module SixUpdaterWeb
|
2
|
-
DEFAULT_PORT = 16333
|
3
|
-
DEFAULT_IP = '127.0.0.1'
|
4
4
|
OLDLOCATION = if defined?(TAR2RUBYSCRIPT)
|
5
5
|
oldlocation
|
6
6
|
else
|
@@ -12,7 +12,6 @@ module SixUpdaterWeb
|
|
12
12
|
end
|
13
13
|
|
14
14
|
SPECIAL = true
|
15
|
-
|
16
15
|
SIX_ADMIN = true
|
17
16
|
end
|
18
17
|
|
@@ -47,3 +46,5 @@ rescue
|
|
47
46
|
end
|
48
47
|
|
49
48
|
ENV["RAILS_ENV"] = "production"
|
49
|
+
|
50
|
+
require 'config/six-updater-web'
|
data/lib/config/environment.rb
CHANGED
@@ -8,6 +8,24 @@ require File.join(File.dirname(__FILE__), 'boot')
|
|
8
8
|
|
9
9
|
require 'config/six-updater-web'
|
10
10
|
|
11
|
+
if defined?(SixUpdaterWeb::OLDLOCATION)
|
12
|
+
module Rails
|
13
|
+
class Configuration
|
14
|
+
def database_configuration
|
15
|
+
conf = File.open(database_configuration_file, 'r') {|file| YAML::load(file)}
|
16
|
+
conf.each do |k, v|
|
17
|
+
if v["adapter"] =~ /^sqlite/
|
18
|
+
v["database"] = File.join(SixUpdaterWeb::DATA_PATH, v["database"]) if v.include?("database")
|
19
|
+
v["dbfile"] = File.join(SixUpdaterWeb::DATA_PATH, v["dbfile"]) if v.include?("dbfile")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
conf
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|
11
29
|
Rails::Initializer.run do |config|
|
12
30
|
# Settings in config/environments/* take precedence over those specified here.
|
13
31
|
# Application configuration should go into files in config/initializers
|
@@ -19,7 +19,7 @@ case RUBY_VERSION
|
|
19
19
|
end
|
20
20
|
|
21
21
|
module SixUpdaterWeb
|
22
|
-
VERSION = "0.
|
22
|
+
VERSION = "0.13.1"
|
23
23
|
|
24
24
|
COMPONENT = "six-updater-web"
|
25
25
|
SIX_PORT = 3000 unless defined?(SIX_PORT)
|
@@ -131,7 +131,13 @@ module SixUpdaterWeb
|
|
131
131
|
df = File.join(DATA_PATH, "db")
|
132
132
|
FileUtils.mkdir_p(df) unless File.directory?(df)
|
133
133
|
db = File.join(DATA_PATH, "db", "production.sqlite3")
|
134
|
-
|
134
|
+
|
135
|
+
unless File.exists?(db)
|
136
|
+
puts "Database Missing, creating and loading default schema and system data..."
|
137
|
+
File.open(db, 'w') {|f| }
|
138
|
+
system "ruby -rubygems \"_rake.rb\" db:schema:load sync:system"
|
139
|
+
#FileUtils.cp(File.join(BASE_PATH, "db", "production.sqlite3"), db)
|
140
|
+
end
|
135
141
|
end
|
136
142
|
|
137
143
|
def print_info
|
@@ -203,24 +209,3 @@ module SixUpdaterWeb
|
|
203
209
|
end
|
204
210
|
end
|
205
211
|
end
|
206
|
-
|
207
|
-
SixUpdaterWeb.print_info
|
208
|
-
|
209
|
-
if defined?(SixUpdaterWeb::OLDLOCATION)
|
210
|
-
SixUpdaterWeb.prepare_data_path
|
211
|
-
|
212
|
-
module Rails
|
213
|
-
class Configuration
|
214
|
-
def database_configuration
|
215
|
-
conf = File.open(database_configuration_file, 'r') {|file| YAML::load(file)}
|
216
|
-
conf.each do |k, v|
|
217
|
-
if v["adapter"] =~ /^sqlite/
|
218
|
-
v["database"] = File.join(SixUpdaterWeb::DATA_PATH, v["database"]) if v.include?("database")
|
219
|
-
v["dbfile"] = File.join(SixUpdaterWeb::DATA_PATH, v["dbfile"]) if v.include?("dbfile")
|
220
|
-
end
|
221
|
-
end
|
222
|
-
conf
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
data/lib/init.rb
CHANGED
@@ -1,33 +1,42 @@
|
|
1
1
|
# $stdout, $stderr = # File or String in Memory (any cleanup measures?)
|
2
2
|
#require 'RubyGems'
|
3
3
|
|
4
|
-
puts "Starting the web client... please be patient..."
|
5
|
-
puts "This window needs to remain running during GUI operations"
|
6
|
-
puts ""
|
7
|
-
|
8
|
-
require 'common'
|
9
|
-
|
10
4
|
module SixUpdaterWeb
|
5
|
+
DEFAULT_PORT = 16333
|
6
|
+
DEFAULT_IP = '127.0.0.1'
|
7
|
+
|
11
8
|
OPEN_BROWSER = true
|
12
9
|
SIX_PORT = if ARGV.to_s[/--port=([0-9]*)|-p/]
|
13
|
-
|
10
|
+
$1
|
14
11
|
else
|
15
|
-
|
16
|
-
|
12
|
+
ARGV << "--port=#{DEFAULT_PORT}"
|
13
|
+
DEFAULT_PORT
|
17
14
|
end
|
18
15
|
|
19
16
|
unless ARGV.to_s[/--binding=|-b/]
|
20
|
-
|
17
|
+
# TODO: SIX_HOST?
|
18
|
+
ARGV << "--binding=#{DEFAULT_IP}"
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
24
|
-
|
22
|
+
require 'common'
|
25
23
|
|
24
|
+
puts ""
|
25
|
+
SixUpdaterWeb.print_info
|
26
|
+
puts "This window needs to remain running during GUI operations"
|
27
|
+
puts ""
|
28
|
+
|
29
|
+
#if defined?(SixUpdaterWeb::OLDLOCATION)
|
30
|
+
SixUpdaterWeb.prepare_data_path
|
31
|
+
#end
|
32
|
+
|
33
|
+
puts "Checking for required Database migrations..."
|
26
34
|
Dir.chdir(File.dirname(__FILE__)) do
|
27
35
|
system "ruby -rubygems \"_rake.rb\" db:migrate" # goldberg:migrate
|
28
36
|
end
|
29
37
|
|
30
38
|
puts ""
|
39
|
+
puts "Starting the web client..."
|
31
40
|
|
32
41
|
# Kick off Rails
|
33
42
|
load 'script/server'
|