Class: Jdt::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/jdt/cli.rb,
lib/jdt/commands/new.rb,
lib/jdt/commands/bump.rb,
lib/jdt/commands/build.rb,
lib/jdt/commands/secure.rb,
lib/jdt/commands/status.rb,
lib/jdt/commands/install.rb,
lib/jdt/commands/version.rb,
lib/jdt/commands/validate.rb,
lib/jdt/commands/pretty_print.rb

Instance Method Summary collapse

Instance Method Details

#buildObject



11
12
13
14
15
# File 'lib/jdt/commands/build.rb', line 11

def build
  handle_errors do
    say "Build created at: #{Manifest.find(options[:location]).build}"
  end
end

#bumpObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/jdt/commands/bump.rb', line 13

def bump
  handle_errors do
    # find manifest
    manifest = Manifest.find(options[:location])

    # determine what is to be bumped
    if (options.major?)
      bump_option = :major
    elsif (options.minor?)
      bump_option = :minor
    else
      bump_option = :patch
    end

    # bump
    manifest.bump!(bump_option)

    # inform user
    say "Bumped version to #{manifest.version} (bumped #{bump_option.to_s})"
  end
end

#installObject



11
12
13
14
15
16
# File 'lib/jdt/commands/install.rb', line 11

def install
  handle_errors do
    manifest = Manifest.find(options[:location])
  end

end

#manifestObject



8
9
10
11
12
# File 'lib/jdt/commands/pretty_print.rb', line 8

def manifest
  handle_errors do
    say Jdt::Manifest.find(options[:location]).to_xml
  end
end

#new(type, name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jdt/commands/new.rb', line 12

def new(type, name)

  handle_errors do

    begin
      generator = Generator.find(type.to_sym, name)
      generator.location = options[:location]
      generator.generate
    rescue Jdt::ExtensionTypeNotFoundError
      say("Given type is no Joomla extension type. Chose one of the available Joomla extension types:")
      say("Extension types: #{Generator::GENERATORS.join(" ")}")
    end

  end
  
end

#releaseObject



20
21
22
23
24
# File 'lib/jdt/commands/build.rb', line 20

def release
  handle_errors do
    say "Release created at: #{Manifest.find(options[:location]).release}"
  end
end

#secureObject



12
13
14
15
16
17
# File 'lib/jdt/commands/secure.rb', line 12

def secure ()
  handle_errors do
    Manifest.find(options[:location]).secure
  end

end

#statusObject



11
12
13
14
15
16
17
# File 'lib/jdt/commands/status.rb', line 11

def status

  handle_errors do
    manifest = Manifest.find(options[:location])
    say("Extension #{manifest.prefixed_name_with_version}")
  end
end

#validateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/jdt/commands/validate.rb', line 10

def validate

  handle_errors do

    manifest = Manifest.find(options[:location])
    if (manifest.valid?)
      say "Manifest (#{manifest.file}) is valid"
    else
      say "Manifest (#{manifest.file}) is NOT valid"
      manifest.errors.each do |error|
        say "ERR: #{error}"
      end
    end

    if (not manifest.warnings.empty?)
      manifest.warnings.each do |warning|
        say "WARN: #{warning}"
      end
    end
  end
end

#versionObject



11
12
13
# File 'lib/jdt/commands/version.rb', line 11

def version()
  say "#{Jdt::VERSION}"
end