Class: Dotenv::Sync::CommandLine

Inherits:
Thor
  • Object
show all
Defined in:
lib/dotenv/sync/command_line.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handle_no_command_error(command) ⇒ Object

Raises:



63
64
65
# File 'lib/dotenv/sync/command_line.rb', line 63

def self.handle_no_command_error(command)
  raise CommandNotFound.new
end

.start(args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dotenv/sync/command_line.rb', line 9

def self.start(args)
  begin
    super(args)
  rescue Dotenv::Sync::CommandNotFound => e
    begin
      require "dotenv/cli"
      Dotenv::CLI.new(ARGV).run
    rescue Exception
      puts "dotenv gem not installed, falling back to dotenv-sync"
      super(["--help"])
    end
  end
end

Instance Method Details

#anyObject



24
25
26
# File 'lib/dotenv/sync/command_line.rb', line 24

def any()
  raise NotImplementedError.new
end

#generate_keyObject



59
60
61
# File 'lib/dotenv/sync/command_line.rb', line 59

def generate_key
  Syncer.new(options).generate_key
end

#mergeObject



45
46
47
# File 'lib/dotenv/sync/command_line.rb', line 45

def merge
  Syncer.new(options).merge
end

#pullObject



37
38
39
# File 'lib/dotenv/sync/command_line.rb', line 37

def pull
  Syncer.new(options).pull
end

#pushObject



53
54
55
# File 'lib/dotenv/sync/command_line.rb', line 53

def push
  Syncer.new(options).push
end

#sort(filename = Dotenv::Sync::Syncer::DEFAULT_SORT_FILE) ⇒ Object



29
30
31
# File 'lib/dotenv/sync/command_line.rb', line 29

def sort(filename = Dotenv::Sync::Syncer::DEFAULT_SORT_FILE)
  Syncer.new.sort(filename)
end