maven-helper-script 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32e0eb8d94acdfc491bfe72d993c7728347808f7
4
- data.tar.gz: b21c4d26dc61246561aff83e26dbc5358418243a
3
+ metadata.gz: 6735e925cc7aea71a4d75e1388edc202fd61c25a
4
+ data.tar.gz: 6b03de03bbad10422f62f02ce6c31edb30248476
5
5
  SHA512:
6
- metadata.gz: 1089ce43818f07268b4699ac4c5ef674262ff5c61a94abc88bc9c22cbc99f6522edcf87bfceb91c7418d4d0768982125e4c0b378de14f844ef9003f84f850c3f
7
- data.tar.gz: cb17b31d1f076d310cd20fbb82693023d3e9121d00e1ab00da65e238a5e9e6462cca48e0a78d6ef522da4c62886f2e96306be2b527740cdde12042583414745f
6
+ metadata.gz: e5cd565157132dbb1bcb0fe0d65a0a05171ef911e5473f0624ebba20aadec7fc745d2aa499aeec2f87821cb1e0891b31151a36a680a49eeb9d9548c96eb962df
7
+ data.tar.gz: 34a6b4cb3854e3c907f1b9dc5b7687152b9e9fe651188ba57f581183f4b8d37ee68612a3789f626aa6719268c999482bfd9d39a9111b1d1f999e26b03c629e9a
data/README.rdoc CHANGED
@@ -1,6 +1,7 @@
1
1
  = Maven Helper Script
2
2
 
3
3
  {<img src="https://secure.travis-ci.org/benkiefer/maven-helper-script.png" />}[http://travis-ci.org/benkiefer/maven-helper-script]
4
+ {<img src="https://badge.fury.io/rb/maven-helper-script.svg" alt="Gem Version" />}[http://badge.fury.io/rb/maven-helper-script]
4
5
 
5
6
  == What is it?
6
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -1,52 +1,52 @@
1
- require_relative 'configuration_checker'
1
+ require 'configuration_checker'
2
2
 
3
3
  module MavenHelperScript
4
4
 
5
5
  class ArgumentParser
6
6
  def initialize(file)
7
- @projectPom = File.join(file, "pom.xml")
8
- @configChecker = MavenHelperScript::ConfigurationChecker.new(file, 'm.yml')
7
+ @project_pom = File.join(file, "pom.xml")
8
+ @config_checker = MavenHelperScript::ConfigurationChecker.new(file, 'm.yml')
9
9
  end
10
10
 
11
11
  public
12
12
  def parse(args)
13
- resultingCommands = Array[]
14
- specialtyCommands = @configChecker.checkForArguments()
13
+ resulting_commands = Array[]
14
+ specialty_commands = @config_checker.check_for_arguments
15
15
  result = ""
16
- processingCommand = true
16
+ processing_command = true
17
17
 
18
18
  args.each do |arg|
19
- if isSpecialtyCommand arg
20
- specialtyCommands << arg
19
+ if is_specialty_command arg
20
+ specialty_commands << arg
21
21
  else
22
- if processingCommand
23
- result << "mvn " << @configChecker.checkForCommand(arg)
24
- processingCommand = false
22
+ if processing_command
23
+ result << "mvn " << @config_checker.check_for_command(arg)
24
+ processing_command = false
25
25
  else
26
- foundModule = @configChecker.checkForModule(arg)
27
- result << " -pl " << foundModule << " -f " << @projectPom
28
- resultingCommands << result
26
+ found_module = @config_checker.check_for_module(arg)
27
+ result << " -pl " << found_module << " -f " << @project_pom
28
+ resulting_commands << result
29
29
  result = ""
30
- processingCommand = true
30
+ processing_command = true
31
31
  end
32
32
  end
33
33
  end
34
34
 
35
- applySpecialtyCommandsTo(specialtyCommands, resultingCommands)
35
+ apply_specialty_commands_to(specialty_commands, resulting_commands)
36
36
 
37
- resultingCommands
37
+ resulting_commands
38
38
  end
39
39
 
40
40
  private
41
- def applySpecialtyCommandsTo(specialtyCommands, resultingCommands)
42
- specialtyCommands.each do |command|
43
- resultingCommands.each do |it|
41
+ def apply_specialty_commands_to(specialty_commands, resulting_commands)
42
+ specialty_commands.each do |command|
43
+ resulting_commands.each do |it|
44
44
  it = it << " " << command
45
45
  end
46
46
  end
47
47
  end
48
48
 
49
- def isSpecialtyCommand(command)
49
+ def is_specialty_command(command)
50
50
  if command.start_with?('-')
51
51
  return true
52
52
  end
@@ -1,30 +1,30 @@
1
1
  require 'yaml'
2
- require_relative 'invalid_command_exception'
2
+ require 'invalid_command_exception'
3
3
 
4
4
  module MavenHelperScript
5
5
 
6
6
  class ConfigurationChecker
7
- def initialize(file, configFileName)
8
- @yml = YAML::load_file(File.join(file, configFileName))
9
- @commands = buildCommandKeys()
7
+ def initialize(file, config_file_name)
8
+ @yml = YAML::load_file(File.join(file, config_file_name))
9
+ @commands = build_command_keys
10
10
  end
11
11
 
12
12
  public
13
- def checkForArguments()
13
+ def check_for_arguments
14
14
  @yml['arguments'] || Array[]
15
15
  end
16
16
 
17
- def checkForModule(mapping)
17
+ def check_for_module(mapping)
18
18
  @yml['modules'][mapping] || mapping
19
19
  end
20
20
 
21
- def checkForCommand(mapping)
21
+ def check_for_command(mapping)
22
22
  result = @commands[mapping]
23
23
 
24
- if !result
24
+ unless result
25
25
  result = ""
26
26
  mapping.each_char do |character|
27
- command = findCommandFor(character)
27
+ command = find_command_for(character)
28
28
  if !command || command.empty?
29
29
  raise MavenHelperScript::InvalidCommandException.new(@commands, mapping)
30
30
  end
@@ -37,29 +37,29 @@ module MavenHelperScript
37
37
  end
38
38
 
39
39
  private
40
- def buildCommandKeys()
40
+ def build_command_keys
41
41
  if @yml['commands'].class == Hash
42
42
  #They are a map so you don't need to break them up.
43
43
  return @yml['commands']
44
44
  else
45
45
  #Break the list up into a map keyed off the possible command values
46
- commandKeys = Hash.new()
46
+ command_keys = Hash.new
47
47
  @yml['commands'].each do |phase|
48
48
  if phase.include? ':'
49
49
  key = ""
50
50
  phase.split(':').each do |part|
51
51
  key << part[0]
52
52
  end
53
- commandKeys[key] = phase
53
+ command_keys[key] = phase
54
54
  else
55
- commandKeys[phase[0]] = phase
55
+ command_keys[phase[0]] = phase
56
56
  end
57
57
  end
58
- return commandKeys
58
+ return command_keys
59
59
  end
60
60
  end
61
61
 
62
- def findCommandFor(mapping)
62
+ def find_command_for(mapping)
63
63
  @commands[mapping] || ""
64
64
  end
65
65
 
@@ -1,9 +1,9 @@
1
1
  module MavenHelperScript
2
2
 
3
3
  class InvalidCommandException < Exception
4
- def initialize(commands, failedCommand)
4
+ def initialize(commands, failed_command)
5
5
  @commands = commands
6
- @failedCommand = failedCommand
6
+ @failed_command = failed_command
7
7
  end
8
8
 
9
9
  def commands
@@ -11,7 +11,7 @@ module MavenHelperScript
11
11
  end
12
12
 
13
13
  def failedCommand
14
- return @failedCommand
14
+ return @failed_command
15
15
  end
16
16
 
17
17
  end
@@ -4,15 +4,15 @@ module MavenHelperScript
4
4
 
5
5
  class ProjectHomeFinder
6
6
  public
7
- def findProjectDirectory(file)
8
- @originalPath = Pathname.new(File.expand_path(file))
9
- @path = @originalPath
7
+ def find_project_directory(file)
8
+ @original_path = Pathname.new(File.expand_path(file))
9
+ @path = @original_path
10
10
  found = false
11
11
 
12
- while !found
13
- found = foundProjectArtifacts(File.join(@path))
14
- if !found
15
- if !outOfDirectoriesToCheck @path
12
+ until found
13
+ found = found_project_artifacts(File.join(@path))
14
+ unless found
15
+ if !out_of_directories_to_check @path
16
16
  @path = @path.parent
17
17
  else
18
18
  raise MavenHelperScript::MissingProjectFolderException.new
@@ -24,11 +24,11 @@ module MavenHelperScript
24
24
  end
25
25
 
26
26
  private
27
- def outOfDirectoriesToCheck(currentPath)
28
- currentPath == currentPath.parent
27
+ def out_of_directories_to_check(current_path)
28
+ current_path == current_path.parent
29
29
  end
30
30
 
31
- def foundProjectArtifacts(file)
31
+ def found_project_artifacts(file)
32
32
  FileTest.exist?(File.join(file, 'm.yml')) && FileTest.exist?(File.join(file, 'pom.xml'))
33
33
  end
34
34
 
data/lib/script_runner.rb CHANGED
@@ -10,9 +10,9 @@ module MavenHelperScript
10
10
  finder = MavenHelperScript::ProjectHomeFinder.new
11
11
 
12
12
  file = File.expand_path(".")
13
- projectFolder = finder.findProjectDirectory(file)
13
+ project_folder = finder.find_project_directory(file)
14
14
 
15
- parser = MavenHelperScript::ArgumentParser.new(projectFolder)
15
+ parser = MavenHelperScript::ArgumentParser.new(project_folder)
16
16
 
17
17
  commands = parser.parse(args)
18
18
 
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: maven-helper-script 0.2.1 ruby lib
5
+ # stub: maven-helper-script 0.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "maven-helper-script"
9
- s.version = "0.2.1"
9
+ s.version = "0.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maven-helper-script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - benkiefer