Top Level Namespace

Defined Under Namespace

Modules: ActionCableRedisListenerPatch, Fly, FlyIoRails, Fly_io Classes: FlyIoRailtie

Instance Method Summary collapse

Instance Method Details

#build_gemsObject



37
38
39
40
41
42
# File 'lib/fly.io-rails/deploy.rb', line 37

def build_gems
  check_git
  dump_config

  system 'rake -f lib/tasks/fly.rake fly:build_gems'
end

#check_gitObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fly.io-rails/deploy.rb', line 7

def check_git
  return if Dir.exist? '/srv/fly.io-rails/lib'

  spec = Bundler::Definition.build('Gemfile', nil, []).dependencies.
  find {|spec| spec.name == 'fly.io-rails'}

  if spec.git
    if `which git`.empty? and File.exist? '/etc/debian_version'
      system 'apt-get update'
      system 'apt-get install -y git'
    end

    system `git clone --depth 1 #{spec.git} /srv/fly.io-rails`
    exit 1 unless Dir.exist? '/srv/fly.io-rails/lib'
    ENV['RUBYLIB'] = '/srv/fly.io-rails/lib'
    exec "ruby -r fly.io-rails/deploy -e #{caller_locations(1,1)[0].label}"
  end
end

#dump_configObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/fly.io-rails/deploy.rb', line 26

def dump_config
  action = Fly::Actions.new

  config = {}
  action.instance_variables.sort.each do |name|
    config[name] = action.instance_variable_get(name)
  end

  File.open('/srv/config', 'w') {|file| PP.pp(config, file)}
end