s3_website 2.1.8 → 2.1.9
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 +4 -4
- data/bin/s3_website +34 -26
- data/changelog.md +5 -0
- data/lib/s3_website/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df1cb093bdc6d3949cb078641ce7386c282d682d
|
4
|
+
data.tar.gz: 869a59a879784cc67b29c44841dd48ed340385fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a0a88d0fa9418eb8eb36c4c293499f6368a07b6a1c90da4fe2f058a1e298f01f42ca37f20bfe661177e40514620bc9e5100a29018ae9550f13959a080757ef5
|
7
|
+
data.tar.gz: 1519465c473c2eaae724ef3de7722a68d9d81790680b2cd1c7f8af71a2210ace0b5cce6470dbc9cd3df118d202dd0f4a60e042a955db3485d68fd98de317dcea
|
data/bin/s3_website
CHANGED
@@ -72,29 +72,47 @@ class Cli < Thor
|
|
72
72
|
def push
|
73
73
|
project_root = File.expand_path(File.dirname(__FILE__)+ '/..')
|
74
74
|
logger = Logger.new(options[:verbose])
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
success =
|
76
|
+
if run_with_sbt(project_root)
|
77
|
+
Dir.chdir(project_root) {
|
78
|
+
system './sbt assembly' # Build the jar
|
79
|
+
}
|
80
|
+
system "java -cp #{project_root}/target/scala-2.11/s3_website.jar #{resolve_java_command 'push'}"
|
81
|
+
else
|
82
|
+
# Find the jar
|
83
|
+
jar_file = resolve_jar(project_root, logger)
|
84
|
+
# Then run it
|
85
|
+
run_s3_website_jar(jar_file, logger)
|
86
|
+
end
|
87
|
+
|
88
|
+
if success
|
89
|
+
exit 0
|
90
|
+
else
|
91
|
+
exit 1
|
92
|
+
end
|
79
93
|
end
|
80
94
|
|
81
95
|
desc 'cfg SUBCOMMAND ...ARGS', 'Operate on the config file'
|
82
96
|
subcommand 'cfg', Cfg
|
83
97
|
end
|
84
98
|
|
99
|
+
def run_with_sbt(project_root)
|
100
|
+
File.exists? (project_root + '/project/sbt-launch.jar')
|
101
|
+
end
|
102
|
+
|
103
|
+
def resolve_java_command(command_name)
|
104
|
+
args = ARGV.join(' ').sub(command_name, '')
|
105
|
+
"s3.website.#{command_name.capitalize} #{args}"
|
106
|
+
end
|
107
|
+
|
85
108
|
def run_s3_website_jar(jar_file, logger)
|
86
109
|
java_installed = resolve_exit_status('which java') or resolve_exit_status('java -version')
|
87
110
|
unless java_installed
|
88
111
|
logger.info_msg "Cannot find Java. s3_website push is implemented in Scala, and it needs Java to run."
|
89
112
|
autoinstall_java_or_print_help_and_exit(logger)
|
90
113
|
end
|
91
|
-
args = ARGV.join(' ').sub('push', '')
|
92
114
|
logger.debug_msg "Using #{jar_file}"
|
93
|
-
|
94
|
-
exit 0
|
95
|
-
else
|
96
|
-
exit 1
|
97
|
-
end
|
115
|
+
system("java -cp #{jar_file} #{resolve_java_command 'push'}")
|
98
116
|
end
|
99
117
|
|
100
118
|
def resolve_exit_status(cmd)
|
@@ -146,13 +164,11 @@ def autoinstall_java_or_print_help_and_exit(logger)
|
|
146
164
|
end
|
147
165
|
|
148
166
|
def resolve_jar(project_root, logger)
|
149
|
-
|
150
|
-
project_root + '/target/scala-2.11/s3_website.jar'
|
151
|
-
released_jar_lookup_paths = [
|
167
|
+
jar_lookup_paths = [
|
152
168
|
project_root + "/s3_website-#{S3Website::VERSION}.jar",
|
153
169
|
(ENV['TMPDIR'] || '/tmp') + "/s3_website-#{S3Website::VERSION}.jar"
|
154
170
|
]
|
155
|
-
found_jar =
|
171
|
+
found_jar = jar_lookup_paths.
|
156
172
|
select { |jar_path|
|
157
173
|
File.exists? jar_path
|
158
174
|
}.
|
@@ -171,25 +187,17 @@ def resolve_jar(project_root, logger)
|
|
171
187
|
if found_jar and jar_has_valid_checksum(found_jar, logger)
|
172
188
|
found_jar
|
173
189
|
else
|
174
|
-
|
175
|
-
if is_development
|
176
|
-
Dir.chdir(project_root) {
|
177
|
-
system "./sbt assembly"
|
178
|
-
}
|
179
|
-
development_jar_path
|
180
|
-
else
|
181
|
-
download_jar(released_jar_lookup_paths, logger)
|
182
|
-
end
|
190
|
+
download_jar(jar_lookup_paths, logger)
|
183
191
|
end
|
184
192
|
end
|
185
193
|
|
186
|
-
def download_jar(
|
194
|
+
def download_jar(jar_lookup_paths, logger)
|
187
195
|
tag_name = "v#{S3Website::VERSION}"
|
188
|
-
downloaded_jar =
|
196
|
+
downloaded_jar = jar_lookup_paths.select { |jar_path|
|
189
197
|
File.writable? File.dirname(jar_path)
|
190
198
|
}.first
|
191
199
|
unless downloaded_jar
|
192
|
-
logger.fail_msg "Neither #{
|
200
|
+
logger.fail_msg "Neither #{jar_lookup_paths.join ' or '} is writable. Cannot download s3_website.jar."
|
193
201
|
logger.fail_msg "Set either directory as writable to the current user and try again."
|
194
202
|
exit 1
|
195
203
|
end
|
data/changelog.md
CHANGED
data/lib/s3_website/version.rb
CHANGED