Sha256: 4590aecd654e6beb7aeb95ba67f4b53c5a0a595f7280fd5328342d185ddec932

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

begin
  require 'bundler/setup'
rescue LoadError
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'socket'
require 'active_support/core_ext/string/strip'
require 'rake/testtask'

EXPANDED_CWD = File.expand_path(File.dirname(__FILE__))

Rake::TestTask.new(:test) do |t|
  t.libs << 'lib'
  t.libs << 'test'
  t.pattern = 'test/**/*_test.rb'
  t.verbose = false
end

# Just ignore this if rake is not runned from the current directory, as is the
# case with docker's container. BUNDLE_GEMFILE won't do for our case, since the
# Gemfile references gemspec.
Bundler::GemHelper.install_tasks if defined? Bundler::GemHelper

namespace :docker do
  task :sync do
    Dir.chdir(EXPANDED_CWD) do
     sh 'git fetch && git reset --hard origin/master', verbose: false
    end
  end

  task run: :sync do
    # Generally, the first ipv4 private address is how we would access the
    # docker container from the current machine.
    container_ip = Socket.ip_address_list.find(&:ipv4_private?).ip_address

    puts <<-NOTICE.strip_heredoc
      Go to http://#{container_ip}:3000/console to preview web-console.
      If it's not showing, please give a few seconds for the server to start.
    NOTICE

    Dir.chdir("#{EXPANDED_CWD}/test/dummy") do
      sh 'rails server', verbose: false
    end
  end
end

task default: :test

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
web-console-rails3-1.0.1 Rakefile
web-console-1.0.1 Rakefile
web-console-rails3-1.0.0 Rakefile
web-console-1.0.0 Rakefile
web-console-rails3-0.4.1 Rakefile
web-console-0.4.0 Rakefile