joe_utils 0.0.3 → 0.0.4
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 +4 -4
- data/.gitignore +2 -0
- data/.idea/compiler.xml +23 -0
- data/.idea/copyright/profiles_settings.xml +3 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +6 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/bin/gem_util.sh +59 -0
- data/joe_utils-0.0.3.gem +0 -0
- data/joe_utils.gemspec +20 -0
- data/lib/joe_utils/config_helper.rb +27 -0
- metadata +18 -20
- /data/lib/joe_utils/{script.rb → Script.rb} +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: aa4d8f07f99b5152860a4eaea1279e1b0bcb10af
         | 
| 4 | 
            +
              data.tar.gz: cd2481097bd9c3e1a3e2b9fb3213d043522ec525
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: effbbefc73f79be9e001d0fe3ed868f3573971f50bb7f89583debd15047d1d535bad535ca9a4a3751fecf39c150c6ee2790764379d1f88f56075f329a058ba78
         | 
| 7 | 
            +
              data.tar.gz: cb61dc7d60cdcbfe3783b29cc5e9eac8bd3da4423e917ad6839e10256b483bd70543a8462f5d42f498f212a0abadf81cf9442c657a17a2db31b756bac07e42ef
         | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.idea/compiler.xml
    ADDED
    
    | @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="UTF-8"?>
         | 
| 2 | 
            +
            <project version="4">
         | 
| 3 | 
            +
              <component name="CompilerConfiguration">
         | 
| 4 | 
            +
                <option name="DEFAULT_COMPILER" value="Javac" />
         | 
| 5 | 
            +
                <resourceExtensions />
         | 
| 6 | 
            +
                <wildcardResourcePatterns>
         | 
| 7 | 
            +
                  <entry name="!?*.java" />
         | 
| 8 | 
            +
                  <entry name="!?*.form" />
         | 
| 9 | 
            +
                  <entry name="!?*.class" />
         | 
| 10 | 
            +
                  <entry name="!?*.groovy" />
         | 
| 11 | 
            +
                  <entry name="!?*.scala" />
         | 
| 12 | 
            +
                  <entry name="!?*.flex" />
         | 
| 13 | 
            +
                  <entry name="!?*.kt" />
         | 
| 14 | 
            +
                  <entry name="!?*.clj" />
         | 
| 15 | 
            +
                </wildcardResourcePatterns>
         | 
| 16 | 
            +
                <annotationProcessing>
         | 
| 17 | 
            +
                  <profile default="true" name="Default" enabled="false">
         | 
| 18 | 
            +
                    <processorPath useClasspath="true" />
         | 
| 19 | 
            +
                  </profile>
         | 
| 20 | 
            +
                </annotationProcessing>
         | 
| 21 | 
            +
              </component>
         | 
| 22 | 
            +
            </project>
         | 
| 23 | 
            +
             | 
    
        data/.idea/encodings.xml
    ADDED
    
    
    
        data/.idea/misc.xml
    ADDED
    
    | @@ -0,0 +1,6 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="UTF-8"?>
         | 
| 2 | 
            +
            <project version="4">
         | 
| 3 | 
            +
              <component name="IdProvider" IDEtalkID="068A575A346E210E0B65612CDF9339A2" />
         | 
| 4 | 
            +
              <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" />
         | 
| 5 | 
            +
            </project>
         | 
| 6 | 
            +
             | 
    
        data/.idea/modules.xml
    ADDED
    
    | @@ -0,0 +1,9 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="UTF-8"?>
         | 
| 2 | 
            +
            <project version="4">
         | 
| 3 | 
            +
              <component name="ProjectModuleManager">
         | 
| 4 | 
            +
                <modules>
         | 
| 5 | 
            +
                  <module fileurl="file://$PROJECT_DIR$/.idea/joe_utils.iml" filepath="$PROJECT_DIR$/.idea/joe_utils.iml" />
         | 
| 6 | 
            +
                </modules>
         | 
| 7 | 
            +
              </component>
         | 
| 8 | 
            +
            </project>
         | 
| 9 | 
            +
             | 
    
        data/.idea/vcs.xml
    ADDED
    
    
    
        data/bin/gem_util.sh
    ADDED
    
    | @@ -0,0 +1,59 @@ | |
| 1 | 
            +
            #!/bin/sh
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Create a Ruby gem and push it to rubygems.org and update it locally
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            GEMSPEC_SUFFIX=".gemspec"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            function usage
         | 
| 8 | 
            +
            {
         | 
| 9 | 
            +
                echo "usage: system_page [[[-p push] [-i install]] | [-h]]"
         | 
| 10 | 
            +
            }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            # checking options of the script and name of the gem to work with
         | 
| 13 | 
            +
            while [ "$1" != "" ]; do
         | 
| 14 | 
            +
                case $1 in
         | 
| 15 | 
            +
                    -i | --install )        INSTALL=1
         | 
| 16 | 
            +
                                            ;;
         | 
| 17 | 
            +
                    -p | --push )           PUSH=1
         | 
| 18 | 
            +
                                            ;;
         | 
| 19 | 
            +
                    -h | --help )           usage
         | 
| 20 | 
            +
                                            ;;
         | 
| 21 | 
            +
                    -ip )                   INSTALL=1
         | 
| 22 | 
            +
                                            PUSH=1
         | 
| 23 | 
            +
                                            ;;
         | 
| 24 | 
            +
                    * )                     GEM_NAME=$1
         | 
| 25 | 
            +
                esac
         | 
| 26 | 
            +
                shift
         | 
| 27 | 
            +
            done
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            # if the gem name has not been defined, print error message and exit
         | 
| 30 | 
            +
            if [ -z "$GEM_NAME" ]; then
         | 
| 31 | 
            +
                echo "You did not enter a gem name.  Please include it as an argument to the script or hard code it as a variable in the script." >&2
         | 
| 32 | 
            +
                exit 1
         | 
| 33 | 
            +
            fi
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            # run the gem build and parse for the gem release filename
         | 
| 36 | 
            +
            GEM_BUILD_NAME=$(gem build "$GEM_NAME$GEMSPEC_SUFFIX" |  awk '/File/ {print $2}' -)
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            # if the build failed (i.e. no file name obtained above), print error message and exit
         | 
| 39 | 
            +
            if [ -z "$GEM_BUILD_NAME" ]; then
         | 
| 40 | 
            +
                echo "The gem build failed. Please confirm the gem name and try again." >&2
         | 
| 41 | 
            +
                exit 1
         | 
| 42 | 
            +
            else
         | 
| 43 | 
            +
                echo "Built successful"
         | 
| 44 | 
            +
            fi
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            # if above succeeded, then push to rubygems.org using the gem that was compiled
         | 
| 47 | 
            +
            if [ "$PUSH" ]; then
         | 
| 48 | 
            +
                echo "Pushing..."
         | 
| 49 | 
            +
                gem push "$GEM_BUILD_NAME"
         | 
| 50 | 
            +
            fi
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            # install it locally
         | 
| 53 | 
            +
            if [ "$INSTALL" ]; then
         | 
| 54 | 
            +
                echo "Installing..."
         | 
| 55 | 
            +
                gem install "$GEM_BUILD_NAME"
         | 
| 56 | 
            +
                jgem install "$GEM_BUILD_NAME"
         | 
| 57 | 
            +
            fi
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            exit 0
         | 
    
        data/joe_utils-0.0.3.gem
    ADDED
    
    | Binary file | 
    
        data/joe_utils.gemspec
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            Gem::Specification.new do |s|
         | 
| 2 | 
            +
              s.name = 'joe_utils'
         | 
| 3 | 
            +
              s.version = '0.0.4'
         | 
| 4 | 
            +
              s.executables = %w(gem_util.sh)
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
         | 
| 7 | 
            +
              s.authors = ['Josef Erneker']
         | 
| 8 | 
            +
              s.date = %q{2014-12-26}
         | 
| 9 | 
            +
              s.description = %q{Overall personal utils gem}
         | 
| 10 | 
            +
              s.licenses = ['GPL-3.0']
         | 
| 11 | 
            +
              s.email = %q{josef.erneker@gmail.com}
         | 
| 12 | 
            +
              s.files = `git ls-files`.split($\)
         | 
| 13 | 
            +
              s.test_files = s.files.grep(/^test_/)
         | 
| 14 | 
            +
              s.homepage = %q{http://rubygems.org/gems/joeutils}
         | 
| 15 | 
            +
              s.require_paths = ['lib']
         | 
| 16 | 
            +
              s.rubygems_version = %q{1.6.2}
         | 
| 17 | 
            +
              s.summary = %q{Utils for work with files, sockets etc.}
         | 
| 18 | 
            +
              s.add_development_dependency %w(minitest), '~> 0'
         | 
| 19 | 
            +
            end
         | 
| 20 | 
            +
             | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            # encoding: UTF-8
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'json'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module ConfigHelper
         | 
| 6 | 
            +
              def sort_json_file(address)
         | 
| 7 | 
            +
                json_content = File.open(address, 'r') { |f| f.read }
         | 
| 8 | 
            +
                hash = JSON.load(json_content)
         | 
| 9 | 
            +
                structure = hash.sort_by { |key, _| key.to_s }
         | 
| 10 | 
            +
                hash = {}
         | 
| 11 | 
            +
                structure.each {|field| hash[field[0]] = field[1] }
         | 
| 12 | 
            +
                File.open(address, 'w+') { |f| f.write(JSON.pretty_generate(hash)) }
         | 
| 13 | 
            +
                puts 'File hash content has been sorted.'
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              def is_inside_string?()
         | 
| 17 | 
            +
                
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              def get_list_of_constants(file_content)
         | 
| 21 | 
            +
                file_content.match()
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              def select_config_in_file(file_content, config_name)
         | 
| 25 | 
            +
                file_content.match()
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: joe_utils
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Josef Erneker
         | 
| @@ -10,20 +10,6 @@ bindir: bin | |
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 | 
             
            date: 2014-12-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            -
              name: '["zip", "fileutils"]'
         | 
| 15 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            -
                requirements:
         | 
| 17 | 
            -
                - - ~>
         | 
| 18 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: '0'
         | 
| 20 | 
            -
              type: :runtime
         | 
| 21 | 
            -
              prerelease: false
         | 
| 22 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            -
                requirements:
         | 
| 24 | 
            -
                - - ~>
         | 
| 25 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: '0'
         | 
| 27 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 14 | 
             
              name: '["minitest"]'
         | 
| 29 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -40,16 +26,29 @@ dependencies: | |
| 40 26 | 
             
                    version: '0'
         | 
| 41 27 | 
             
            description: Overall personal utils gem
         | 
| 42 28 | 
             
            email: josef.erneker@gmail.com
         | 
| 43 | 
            -
            executables: | 
| 29 | 
            +
            executables:
         | 
| 30 | 
            +
            - gem_util.sh
         | 
| 44 31 | 
             
            extensions: []
         | 
| 45 32 | 
             
            extra_rdoc_files: []
         | 
| 46 33 | 
             
            files:
         | 
| 34 | 
            +
            - .gitignore
         | 
| 35 | 
            +
            - .idea/compiler.xml
         | 
| 36 | 
            +
            - .idea/copyright/profiles_settings.xml
         | 
| 37 | 
            +
            - .idea/encodings.xml
         | 
| 38 | 
            +
            - .idea/misc.xml
         | 
| 39 | 
            +
            - .idea/modules.xml
         | 
| 40 | 
            +
            - .idea/scopes/scope_settings.xml
         | 
| 41 | 
            +
            - .idea/vcs.xml
         | 
| 47 42 | 
             
            - Rakefile
         | 
| 43 | 
            +
            - bin/gem_util.sh
         | 
| 44 | 
            +
            - joe_utils-0.0.3.gem
         | 
| 45 | 
            +
            - joe_utils.gemspec
         | 
| 48 46 | 
             
            - lib/joe_utils.rb
         | 
| 47 | 
            +
            - lib/joe_utils/Script.rb
         | 
| 48 | 
            +
            - lib/joe_utils/config_helper.rb
         | 
| 49 49 | 
             
            - lib/joe_utils/console_helper.rb
         | 
| 50 50 | 
             
            - lib/joe_utils/files_helper.rb
         | 
| 51 51 | 
             
            - lib/joe_utils/name_helper.rb
         | 
| 52 | 
            -
            - lib/joe_utils/script.rb
         | 
| 53 52 | 
             
            - lib/joe_utils/script_editor_helper.rb
         | 
| 54 53 | 
             
            - lib/joe_utils/script_renderer.rb
         | 
| 55 54 | 
             
            - lib/joe_utils/socket_helper.rb
         | 
| @@ -76,7 +75,6 @@ requirements: [] | |
| 76 75 | 
             
            rubyforge_project: 
         | 
| 77 76 | 
             
            rubygems_version: 2.4.5
         | 
| 78 77 | 
             
            signing_key: 
         | 
| 79 | 
            -
            specification_version:  | 
| 78 | 
            +
            specification_version: 4
         | 
| 80 79 | 
             
            summary: Utils for work with files, sockets etc.
         | 
| 81 | 
            -
            test_files:
         | 
| 82 | 
            -
            - test/test_joe_utils.rb
         | 
| 80 | 
            +
            test_files: []
         | 
| 
            File without changes
         |