Class: Isomorfeus::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/isomorfeus/cli.rb

Instance Method Summary collapse

Instance Method Details

#consoleObject



64
65
66
# File 'lib/isomorfeus/cli.rb', line 64

def console
  Isomorfeus::Console.new.run
end

#new(project_name) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/isomorfeus/cli.rb', line 18

def new(project_name)
  Isomorfeus::Installer.set_project_names(project_name)
  Isomorfeus::Installer.options = options
  begin
    puts "Creating project directory #{Isomorfeus::Installer.project_dir}"
    Dir.mkdir(Isomorfeus::Installer.project_dir)
  rescue
    if Dir.exist?(Isomorfeus::Installer.project_dir) && Gem.win_platform?
      # this is a workaround for Windows being unable to delete existing app directories of test_apps
      # because of some node_modules
      puts "Using existing directory #{Isomorfeus::Installer.project_dir}!"
    else
      puts "Directory #{Isomorfeus::Installer.project_dir} could not be created!"
    exit 1
  end
  end
  Dir.chdir(Isomorfeus::Installer.project_dir)
  puts "within the project directory:"
  Isomorfeus::Installer::NewProject.execute
  Isomorfeus::Installer::InstallTargets.execute
  Isomorfeus::Installer::Gemfile.execute
  Isomorfeus::Installer::Bundle.execute
  Dir.chdir('..')
end

#test_appObject



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/isomorfeus/cli.rb', line 93

def test_app
  Isomorfeus::Installer.set_project_names('test_app')
  Isomorfeus::Installer.options = options
  begin
    Dir.mkdir(Isomorfeus::Installer.project_dir)
    Dir.chdir(Isomorfeus::Installer.project_dir)
  rescue
    puts "Directory #{installer.project_dir} could not be created!"
    exit 1
  end
  Isomorfeus::Installer::NewProject.execute
  Isomorfeus::Installer::InstallTargets.execute
  Isomorfeus::Installer::Gemfile.execute
  Isomorfeus::Installer::TestAppFiles.execute
  Isomorfeus::Installer::Bundle.execute
  Dir.chdir('..')
end

#versionsObject



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/isomorfeus/cli.rb', line 69

def versions
  output = "isomorfeus command version #{Isomorfeus::VERSION}\nProject gem versions:\n"
  %w[isomorfeus-asset-manager isomorfeus-ferret isomorfeus-redux isomorfeus-preact
     isomorfeus-puppetmaster isomorfeus-speednode isomorfeus-data isomorfeus-i18n isomorfeus-mailer
     isomorfeus-operation isomorfeus-policy isomorfeus-transport isomorfeus iodine opal-zeitwerk opal].each do |gem|
    o = `bundle info #{gem} 2>&1`
    o.each_line do |line|
      output << line if line.include?('*') && line.include?(gem)
    end
  end
  puts output
end