Class: ProjectUtility
- Inherits:
-
Object
- Object
- ProjectUtility
- Includes:
- CLIHelper, FilesHelper, RegExpHelper
- Defined in:
- lib/joe_utils/utils/project_utility.rb
Constant Summary collapse
- HELP_TEXT =
'Project utility: executes basic administrative tasks with project, so far supported options: s for skipping tests, g for pushing to github, e for pushing to heroku, b for building a gem, notice, you need to be in the folder which is called as the .gemspec file of the gem, p for pushing it to rubygems.org, i for installing it locally, h for help, you can combine the options when it makes sense. Text behind the command will be considered a message for git.'
Constants included from RegExpHelper
RegExpHelper::CLI_MESSAGE_INPUT, RegExpHelper::NO_SUCCESS
Constants included from CLIHelper
Instance Method Summary collapse
Methods included from FilesHelper
#add_to_open_zip, #catch_errno_enoent, #create_dir, #create_file, #create_file_by_template, #dir_exists?, #edit_file, #file_exists?, #find_in_all, #for_all_in_dir, #get_current_address, #get_current_folder, #load_file_text, #remove_dir, #replace_in_all, #unzip, #zip, #zip_folder
Methods included from CLIHelper
#build_gem, #commit_git, #commit_github, #deploy_heroku, #execute, #install_gem, #install_jgem, #push_rubygems, #rake_test
Instance Method Details
#process_input(input, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/joe_utils/utils/project_utility.rb', line 21 def process_input(input, = {}) input.each do |arg| if arg[0..1] == '--' case arg[2..-1] when 'build' [:gem_name] ||= get_current_folder when 'install' [:install] = true when 'push' [:push] = true when 'heroku' [:heroku] = true when 'github' [:github] = true else puts HELP_TEXT exit end elsif arg[0] == '-' arg[1..-1].each_char do |letter| case letter when 's' [:skip_tests] = true when 'g' [:github] = true when 'e' [:heroku] = true when 'b' [:gem_name] ||= get_current_folder when 'i' [:install] = true [:gem_name] ||= get_current_folder when 'p' [:push] = true [:gem_name] ||= get_current_folder else puts HELP_TEXT exit end end else [:message] = arg end end end |
#run(input = nil) ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/joe_utils/utils/project_utility.rb', line 68 def run(input = nil) = process_input(input || ARGV) success = true success = rake_test unless [:skip_tests] success &&= commit_git([:message]) success &&= commit_github if [:github] success &&= deploy_heroku if [:heroku] success &&= build_gem([:gem_name], ) if [:gem_name] success end |