[www] Fixing rake www:release task

After moving the www tasks into the www directory, the release
task needed to be updated to run certain commands from the repo
root such that the newly-built web content was in the repo root
of the gh-pages branch, rather than the www/ directory.

Also updating the www Gemfile.lock with the new inspec release.

Signed-off-by: Adam Leff <adam@leff.co>
This commit is contained in:
Adam Leff 2017-03-30 14:27:18 -04:00
parent 1dd3066feb
commit beadeff679
No known key found for this signature in database
GPG key ID: 7A5136DE1C1112F8
2 changed files with 81 additions and 86 deletions

View file

@ -1,7 +1,8 @@
PATH
remote: /Users/aleff/projects/inspec
specs:
inspec (1.17.0)
inspec (1.18.0)
addressable (~> 2.5)
faraday (>= 0.9.0)
hashie (~> 3.4)
json (>= 1.8, < 3.0)
@ -22,25 +23,24 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.7.1)
activesupport (5.0.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
autoprefixer-rails (6.4.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
autoprefixer-rails (6.7.7.1)
execjs
backports (3.6.8)
backports (3.7.0)
blankslate (2.1.2.4)
builder (3.2.3)
charlock_holmes (0.7.3)
chunky_png (1.3.7)
chunky_png (1.3.8)
coderay (1.1.1)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
coffee-script-source (1.12.2)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
@ -53,34 +53,26 @@ GEM
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
concurrent-ruby (1.0.2)
concurrent-ruby (1.0.5)
contracts (0.13.0)
diff-lcs (1.3)
docker-api (1.33.2)
excon (>= 0.38.0)
json
dotenv (2.1.1)
dotenv (2.2.0)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
escape_utils (1.1.1)
eventmachine (1.2.0.1)
eventmachine (1.2.3)
excon (0.55.0)
execjs (2.7.0)
faraday (0.9.2)
faraday (0.11.0)
multipart-post (>= 1.2, < 3)
fast_blank (1.0.0)
fastimage (2.0.0)
addressable (~> 2)
ffi (1.9.14)
github-linguist (5.0.8)
charlock_holmes (~> 0.7.3)
escape_utils (~> 1.1.0)
mime-types (>= 1.19)
rugged (>= 0.25.1)
github-markup (1.4.8)
github-linguist (~> 5.0, >= 5.0.8)
fastimage (2.1.0)
ffi (1.9.18)
github-markup (1.5.0)
rinku
gssapi (1.2.0)
ffi (>= 1.0.1)
@ -90,14 +82,14 @@ GEM
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.4.4)
hashie (3.5.5)
http_parser.rb (0.6.0)
httpclient (2.7.2)
httpclient (2.8.3)
i18n (0.7.0)
inquirer (0.2.1)
term-ansicolor (>= 1.2.2)
json (1.8.3)
kramdown (1.12.0)
json (2.0.3)
kramdown (1.13.2)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
@ -107,24 +99,24 @@ GEM
multi_json (~> 1.10)
memoist (0.15.0)
method_source (0.8.2)
middleman (4.1.10)
middleman (4.2.1)
coffee-script (~> 2.2)
compass-import-once (= 1.0.5)
haml (>= 4.0.5)
kramdown (~> 1.2)
middleman-cli (= 4.1.10)
middleman-core (= 4.1.10)
middleman-cli (= 4.2.1)
middleman-core (= 4.2.1)
sass (>= 3.4.0, < 4.0)
middleman-autoprefixer (2.7.0)
autoprefixer-rails (>= 6.3.1, < 7.0.0)
middleman-autoprefixer (2.7.1)
autoprefixer-rails (>= 6.5.2, < 7.0.0)
middleman-core (>= 3.3.3)
middleman-cli (4.1.10)
middleman-cli (4.2.1)
thor (>= 0.17.0, < 2.0)
middleman-compass (4.0.1)
compass (>= 1.0.0, < 2.0.0)
middleman-core (>= 4.0.0)
middleman-core (4.1.10)
activesupport (~> 4.2)
middleman-core (4.2.1)
activesupport (>= 4.2, < 5.1)
addressable (~> 2.3)
backports (~> 3.6)
bundler (~> 1.1)
@ -141,26 +133,23 @@ GEM
memoist (~> 0.14)
padrino-helpers (~> 0.13.0)
parallel
rack (>= 1.4.5, < 2.0)
rack (>= 1.4.5, < 3)
sass (>= 3.4)
servolux
tilt (~> 1.4.1)
tilt (~> 2.0)
uglifier (~> 3.0)
middleman-livereload (3.4.6)
em-websocket (~> 0.5.1)
middleman-core (>= 3.3)
rack-livereload (~> 0.3.15)
middleman-sprockets (4.0.0)
middleman-sprockets (4.1.0)
middleman-core (~> 4.0)
sprockets (>= 3.0)
middleman-syntax (3.0.0)
middleman-core (>= 3.2)
rouge (~> 2.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.0)
minitest (5.10.1)
mixlib-log (1.7.1)
mixlib-shellout (2.2.7)
multi_json (1.12.1)
@ -171,30 +160,31 @@ GEM
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
nori (2.6.0)
padrino-helpers (0.13.3.2)
padrino-helpers (0.13.3.3)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.2)
padrino-support (= 0.13.3.3)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.2)
padrino-support (0.13.3.3)
activesupport (>= 3.1)
parallel (1.9.0)
parallel (1.11.1)
parslet (1.5.0)
blankslate (~> 2.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.6.4)
public_suffix (2.0.5)
rack (2.0.1)
rack-livereload (0.3.16)
rack
rainbow (2.2.1)
rake (10.5.0)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
rake (12.0.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
redcarpet (3.3.4)
redcarpet (3.4.0)
rinku (2.0.2)
rouge (2.0.6)
rouge (2.0.7)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
@ -214,27 +204,26 @@ GEM
ruby-progressbar (1.8.1)
rubyntlm (0.6.1)
rubyzip (1.2.1)
rugged (0.25.1.1)
sass (3.4.22)
servolux (0.12.0)
sass (3.4.23)
servolux (0.13.0)
slim (3.0.7)
temple (~> 0.7.6)
tilt (>= 1.3.3, < 2.1)
slop (3.6.0)
sprockets (3.7.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sslshake (1.0.13)
sslshake (1.1.0)
temple (0.7.7)
term-ansicolor (1.4.0)
term-ansicolor (1.5.0)
tins (~> 1.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.7)
tins (1.13.2)
toml (0.1.2)
parslet (~> 1.5.0)
train (0.22.1)
train (0.23.0)
docker-api (~> 1.26)
json (>= 1.8, < 3.0)
mixlib-shellout (~> 2.0)
@ -242,9 +231,9 @@ GEM
net-ssh (>= 2.9, < 5.0)
winrm (~> 2.0)
winrm-fs (~> 1.0)
tzinfo (1.2.2)
tzinfo (1.2.3)
thread_safe (~> 0.1)
uglifier (3.0.2)
uglifier (3.1.11)
execjs (>= 0.3.0, < 3)
winrm (2.1.3)
builder (>= 2.1.2)

View file

@ -86,9 +86,9 @@ namespace :www do
raise 'Please make sure you have no uncommitted changes in this repository.'
end
File.write('build/CNAME', 'inspec.io')
file_count = Dir['build/*'].length
file_size = `du -hs build`.sub(/\s+.*$/m, '')
File.write(File.join(dst, 'CNAME'), 'inspec.io')
file_count = Dir[File.join(dst, '*')].length
file_size = `du -hs #{dst}`.sub(/\s+.*$/m, '')
if system('git rev-parse --verify gh-pages')
Log.info 'Remove local gh-pages branch'
@ -103,28 +103,34 @@ namespace :www do
Log.info 'Create empty gh-pages branch'
sh('git checkout --orphan gh-pages')
Log.info 'Clear out all local git files!'
sh('git rm -rf .')
# this rest of this task needs to be run from the root of the inspec repo
# so it can properly move and clean files in the gh-pages branch
Dir.chdir(File.join(Dir.pwd, '..')) do
dst_from_root = File.join('www', dst)
Log.info "Add the built files in #{dst}"
sh("git add #{dst}")
Log.info 'Clear out all local git files!'
sh('git rm -rf .')
Log.info 'Remove all other files in this empty branch'
sh('git clean -df')
Log.info "Add the built files in #{dst_from_root}"
sh("git add #{dst_from_root}")
Log.info 'Move the site to the root directory'
sh("git mv #{File.join(dst, '*')} .")
Log.info 'Remove all other files in this empty branch'
sh('git clean -df')
Log.info 'Commit to gh-pages'
sh("git commit -m 'website update'")
Log.info 'Move the site to the root directory'
sh("git mv #{File.join(dst_from_root, '*')} .")
require 'inquirer'
if Ask.confirm("Ready to go, I have #{file_count} files at #{file_size}. "\
'Do you want to push this live?', default: false)
Log.info 'push to origin, this may take a moment'
sh('git push -u origin --force-with-lease gh-pages')
else
puts 'Aborted.'
Log.info 'Commit to gh-pages'
sh("git commit -m 'website update'")
require 'inquirer'
if Ask.confirm("Ready to go, I have #{file_count} files at #{file_size}. "\
'Do you want to push this live?', default: false)
Log.info 'push to origin, this may take a moment'
sh('git push -u origin --force-with-lease gh-pages')
else
puts 'Aborted.'
end
end
sh("git checkout #{current_branch}")