pantograph 0.1.14 → 0.1.15
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/README.md +1 -1
- data/pantograph/lib/assets/custom_action_template.rb +18 -14
- data/pantograph/lib/pantograph/action.rb +1 -1
- data/pantograph/lib/pantograph/action_collector.rb +1 -1
- data/pantograph/lib/pantograph/actions/actions_helper.rb +2 -2
- data/pantograph/lib/pantograph/actions/bundle_install.rb +120 -84
- data/pantograph/lib/pantograph/actions/cloc.rb +64 -49
- data/pantograph/lib/pantograph/actions/create_pull_request.rb +1 -1
- data/pantograph/lib/pantograph/actions/danger.rb +103 -82
- data/pantograph/lib/pantograph/actions/debug.rb +2 -2
- data/pantograph/lib/pantograph/actions/default_platform.rb +5 -3
- data/pantograph/lib/pantograph/actions/download.rb +10 -9
- data/pantograph/lib/pantograph/actions/echo.rb +1 -1
- data/pantograph/lib/pantograph/actions/ensure_bundle_exec.rb +18 -10
- data/pantograph/lib/pantograph/actions/ensure_env_vars.rb +16 -17
- data/pantograph/lib/pantograph/actions/ensure_git_branch.rb +14 -14
- data/pantograph/lib/pantograph/actions/ensure_git_status_clean.rb +18 -34
- data/pantograph/lib/pantograph/actions/get_github_release.rb +1 -1
- data/pantograph/lib/pantograph/actions/git_branch.rb +6 -7
- data/pantograph/lib/pantograph/actions/git_commit.rb +21 -13
- data/pantograph/lib/pantograph/actions/git_pull.rb +4 -23
- data/pantograph/lib/pantograph/actions/git_pull_tags.rb +31 -0
- data/pantograph/lib/pantograph/actions/git_submodule_update.rb +23 -16
- data/pantograph/lib/pantograph/actions/git_tag_exists.rb +21 -25
- data/pantograph/lib/pantograph/actions/gradle.rb +82 -58
- data/pantograph/lib/pantograph/actions/import.rb +1 -1
- data/pantograph/lib/pantograph/actions/import_from_git.rb +48 -31
- data/pantograph/lib/pantograph/actions/is_ci.rb +1 -1
- data/pantograph/lib/pantograph/actions/is_verbose.rb +77 -0
- data/pantograph/lib/pantograph/actions/jira.rb +50 -55
- data/pantograph/lib/pantograph/actions/lane_context.rb +6 -6
- data/pantograph/lib/pantograph/actions/last_git_commit.rb +3 -3
- data/pantograph/lib/pantograph/actions/min_pantograph_version.rb +19 -25
- data/pantograph/lib/pantograph/actions/number_of_commits.rb +34 -30
- data/pantograph/lib/pantograph/actions/opt_out_usage.rb +15 -9
- data/pantograph/lib/pantograph/actions/pantograph_version.rb +2 -2
- data/pantograph/lib/pantograph/actions/println.rb +1 -1
- data/pantograph/lib/pantograph/actions/prompt.rb +31 -22
- data/pantograph/lib/pantograph/actions/prompt_secure.rb +128 -0
- data/pantograph/lib/pantograph/actions/reset_git_repo.rb +1 -1
- data/pantograph/lib/pantograph/actions/set_github_release.rb +4 -4
- data/pantograph/lib/pantograph/actions/sh.rb +3 -3
- data/pantograph/lib/pantograph/commands_generator.rb +1 -1
- data/pantograph/lib/pantograph/helper/git_helper.rb +29 -0
- data/pantograph/lib/pantograph/lane_manager.rb +1 -1
- data/pantograph/lib/pantograph/pant_file.rb +22 -16
- data/pantograph/lib/pantograph/plugins/template/README.md.erb +1 -1
- data/pantograph/lib/pantograph/setup/setup.rb +6 -17
- data/pantograph/lib/pantograph/version.rb +1 -1
- data/pantograph_core/lib/pantograph_core/configuration/commander_generator.rb +1 -1
- data/pantograph_core/lib/pantograph_core/globals.rb +1 -2
- data/pantograph_core/lib/pantograph_core/helper.rb +19 -6
- data/pantograph_core/lib/pantograph_core/ui/implementations/shell.rb +1 -4
- metadata +19 -5
- data/pantograph/lib/pantograph/actions/git_add.rb +0 -93
- data/pantograph/lib/pantograph/actions/make_changelog_from_jenkins.rb +0 -81
- data/pantograph/lib/pantograph/actions/nexus_upload.rb +0 -230
| @@ -1,230 +0,0 @@ | |
| 1 | 
            -
            module Pantograph
         | 
| 2 | 
            -
              module Actions
         | 
| 3 | 
            -
                class NexusUploadAction < Action
         | 
| 4 | 
            -
                  def self.run(params)
         | 
| 5 | 
            -
                    command = []
         | 
| 6 | 
            -
                    command << "curl"
         | 
| 7 | 
            -
                    command << verbose(params)
         | 
| 8 | 
            -
                    command += ssl_options(params)
         | 
| 9 | 
            -
                    command += proxy_options(params)
         | 
| 10 | 
            -
                    command += upload_options(params)
         | 
| 11 | 
            -
                    command << upload_url(params)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                    Pantograph::Actions.sh(command.join(' '), log: params[:verbose])
         | 
| 14 | 
            -
                  end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                  def self.upload_url(params)
         | 
| 17 | 
            -
                    url = "#{params[:endpoint]}#{params[:mount_path]}"
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                    if params[:nexus_version] == 2
         | 
| 20 | 
            -
                      url << "/service/local/artifact/maven/content"
         | 
| 21 | 
            -
                    else
         | 
| 22 | 
            -
                      file_extension = File.extname(params[:file]).shellescape
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                      url << "/repository/#{params[:repo_id]}"
         | 
| 25 | 
            -
                      url << "/#{params[:repo_group_id].gsub('.', '/')}"
         | 
| 26 | 
            -
                      url << "/#{params[:repo_project_name]}"
         | 
| 27 | 
            -
                      url << "/#{params[:repo_project_version]}"
         | 
| 28 | 
            -
                      url << "/#{params[:repo_project_name]}-#{params[:repo_project_version]}"
         | 
| 29 | 
            -
                      url << "-#{params[:repo_classifier]}" if params[:repo_classifier]
         | 
| 30 | 
            -
                      url << file_extension.to_s
         | 
| 31 | 
            -
                    end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                    url.shellescape
         | 
| 34 | 
            -
                  end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                  def self.verbose(params)
         | 
| 37 | 
            -
                    params[:verbose] ? "--verbose" : "--silent"
         | 
| 38 | 
            -
                  end
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                  def self.upload_options(params)
         | 
| 41 | 
            -
                    file_path = File.expand_path(params[:file]).shellescape
         | 
| 42 | 
            -
                    file_extension = file_path.split('.').last.shellescape
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                    options = []
         | 
| 45 | 
            -
                    if params[:nexus_version] == 2
         | 
| 46 | 
            -
                      options << "-F p=zip"
         | 
| 47 | 
            -
                      options << "-F hasPom=false"
         | 
| 48 | 
            -
                      options << "-F r=#{params[:repo_id].shellescape}"
         | 
| 49 | 
            -
                      options << "-F g=#{params[:repo_group_id].shellescape}"
         | 
| 50 | 
            -
                      options << "-F a=#{params[:repo_project_name].shellescape}"
         | 
| 51 | 
            -
                      options << "-F v=#{params[:repo_project_version].shellescape}"
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                      if params[:repo_classifier]
         | 
| 54 | 
            -
                        options << "-F c=#{params[:repo_classifier].shellescape}"
         | 
| 55 | 
            -
                      end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                      options << "-F e=#{file_extension}"
         | 
| 58 | 
            -
                      options << "-F file=@#{file_path}"
         | 
| 59 | 
            -
                    else
         | 
| 60 | 
            -
                      options << "--upload-file #{file_path}"
         | 
| 61 | 
            -
                    end
         | 
| 62 | 
            -
             | 
| 63 | 
            -
                    options << "-u #{params[:username].shellescape}:#{params[:password].shellescape}"
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                    options
         | 
| 66 | 
            -
                  end
         | 
| 67 | 
            -
             | 
| 68 | 
            -
                  def self.ssl_options(params)
         | 
| 69 | 
            -
                    options = []
         | 
| 70 | 
            -
                    unless params[:ssl_verify]
         | 
| 71 | 
            -
                      options << "--insecure"
         | 
| 72 | 
            -
                    end
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                    options
         | 
| 75 | 
            -
                  end
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                  def self.proxy_options(params)
         | 
| 78 | 
            -
                    options = []
         | 
| 79 | 
            -
                    if params[:proxy_address] && params[:proxy_port] && params[:proxy_username] && params[:proxy_password]
         | 
| 80 | 
            -
                      options << "-x #{params[:proxy_address].shellescape}:#{params[:proxy_port].shellescape}"
         | 
| 81 | 
            -
                      options << "--proxy-user #{params[:proxy_username].shellescape}:#{params[:proxy_password].shellescape}"
         | 
| 82 | 
            -
                    end
         | 
| 83 | 
            -
             | 
| 84 | 
            -
                    options
         | 
| 85 | 
            -
                  end
         | 
| 86 | 
            -
             | 
| 87 | 
            -
                  #####################################################
         | 
| 88 | 
            -
                  # @!group Documentation
         | 
| 89 | 
            -
                  #####################################################
         | 
| 90 | 
            -
             | 
| 91 | 
            -
                  def self.description
         | 
| 92 | 
            -
                    'Upload a file to [Sonatype Nexus platform](https://www.sonatype.com)'
         | 
| 93 | 
            -
                  end
         | 
| 94 | 
            -
             | 
| 95 | 
            -
                  def self.available_options
         | 
| 96 | 
            -
                    [
         | 
| 97 | 
            -
                      PantographCore::ConfigItem.new(key: :file,
         | 
| 98 | 
            -
                                                   env_name: 'NEXUS_FILE',
         | 
| 99 | 
            -
                                                   description: 'File to be uploaded to Nexus',
         | 
| 100 | 
            -
                                                   optional: false,
         | 
| 101 | 
            -
                                                   verify_block: proc do |value|
         | 
| 102 | 
            -
                                                     file_path = File.expand_path(value)
         | 
| 103 | 
            -
                                                     UI.user_error!("Couldn't find file at path '#{file_path}'") unless File.exist?(file_path)
         | 
| 104 | 
            -
                                                   end),
         | 
| 105 | 
            -
                      PantographCore::ConfigItem.new(key: :repo_id,
         | 
| 106 | 
            -
                                                   env_name: 'NEXUS_REPO_ID',
         | 
| 107 | 
            -
                                                   description: 'Nexus repository id e.g. artefacts',
         | 
| 108 | 
            -
                                                   optional: false),
         | 
| 109 | 
            -
                      PantographCore::ConfigItem.new(key: :repo_group_id,
         | 
| 110 | 
            -
                                                   env_name: 'NEXUS_REPO_GROUP_ID',
         | 
| 111 | 
            -
                                                   description: 'Nexus repository group id e.g. com.company',
         | 
| 112 | 
            -
                                                   optional: false),
         | 
| 113 | 
            -
                      PantographCore::ConfigItem.new(key: :repo_project_name,
         | 
| 114 | 
            -
                                                   env_name: 'NEXUS_REPO_PROJECT_NAME',
         | 
| 115 | 
            -
                                                   description: 'Nexus repository commandect name. Only letters, digits, underscores(_), hyphens(-), and dots(.) are allowed',
         | 
| 116 | 
            -
                                                   optional: false),
         | 
| 117 | 
            -
                      PantographCore::ConfigItem.new(key: :repo_project_version,
         | 
| 118 | 
            -
                                                   env_name: 'NEXUS_REPO_PROJECT_VERSION',
         | 
| 119 | 
            -
                                                   description: 'Nexus repository commandect version',
         | 
| 120 | 
            -
                                                   optional: false),
         | 
| 121 | 
            -
                      PantographCore::ConfigItem.new(key: :repo_classifier,
         | 
| 122 | 
            -
                                                   env_name: 'NEXUS_REPO_CLASSIFIER',
         | 
| 123 | 
            -
                                                   description: 'Nexus repository artifact classifier (optional)',
         | 
| 124 | 
            -
                                                   optional: true),
         | 
| 125 | 
            -
                      PantographCore::ConfigItem.new(key: :endpoint,
         | 
| 126 | 
            -
                                                   env_name: 'NEXUS_ENDPOINT',
         | 
| 127 | 
            -
                                                   description: 'Nexus endpoint e.g. http://nexus:8081',
         | 
| 128 | 
            -
                                                   optional: false),
         | 
| 129 | 
            -
                      PantographCore::ConfigItem.new(key: :mount_path,
         | 
| 130 | 
            -
                                                   env_name: 'NEXUS_MOUNT_PATH',
         | 
| 131 | 
            -
                                                   description: 'Nexus mount path (Nexus 3 instances have this configured as empty by default)',
         | 
| 132 | 
            -
                                                   default_value: '/nexus',
         | 
| 133 | 
            -
                                                   optional: true),
         | 
| 134 | 
            -
                      PantographCore::ConfigItem.new(key: :username,
         | 
| 135 | 
            -
                                                   env_name: 'NEXUS_USERNAME',
         | 
| 136 | 
            -
                                                   description: 'Nexus username',
         | 
| 137 | 
            -
                                                   optional: false),
         | 
| 138 | 
            -
                      PantographCore::ConfigItem.new(key: :password,
         | 
| 139 | 
            -
                                                   env_name: 'NEXUS_PASSWORD',
         | 
| 140 | 
            -
                                                   description: 'Nexus password',
         | 
| 141 | 
            -
                                                   optional: false),
         | 
| 142 | 
            -
                      PantographCore::ConfigItem.new(key: :ssl_verify,
         | 
| 143 | 
            -
                                                   env_name: 'NEXUS_SSL_VERIFY',
         | 
| 144 | 
            -
                                                   description: 'Verify SSL',
         | 
| 145 | 
            -
                                                   is_string: false,
         | 
| 146 | 
            -
                                                   default_value: true,
         | 
| 147 | 
            -
                                                   optional: true),
         | 
| 148 | 
            -
                      PantographCore::ConfigItem.new(key: :nexus_version,
         | 
| 149 | 
            -
                                                   env_name: 'NEXUS_MAJOR_VERSION',
         | 
| 150 | 
            -
                                                   description: 'Nexus major version',
         | 
| 151 | 
            -
                                                   type: Integer,
         | 
| 152 | 
            -
                                                   default_value: 2,
         | 
| 153 | 
            -
                                                   optional: true,
         | 
| 154 | 
            -
                                                   verify_block: proc do |value|
         | 
| 155 | 
            -
                                                     min_version = 2
         | 
| 156 | 
            -
                                                     max_version = 3
         | 
| 157 | 
            -
                                                     UI.user_error!("Unsupported version (#{value}) min. supported version: #{min_version}") unless value >= min_version
         | 
| 158 | 
            -
                                                     UI.user_error!("Unsupported version (#{value}) max. supported version: #{max_version}") unless value <= max_version
         | 
| 159 | 
            -
                                                   end),
         | 
| 160 | 
            -
                      PantographCore::ConfigItem.new(key: :verbose,
         | 
| 161 | 
            -
                                                   env_name: 'NEXUS_VERBOSE',
         | 
| 162 | 
            -
                                                   description: 'Make detailed output',
         | 
| 163 | 
            -
                                                   is_string: false,
         | 
| 164 | 
            -
                                                   default_value: false,
         | 
| 165 | 
            -
                                                   optional: true),
         | 
| 166 | 
            -
                      PantographCore::ConfigItem.new(key: :proxy_username,
         | 
| 167 | 
            -
                                                   env_name: 'NEXUS_PROXY_USERNAME',
         | 
| 168 | 
            -
                                                   description: 'Proxy username',
         | 
| 169 | 
            -
                                                   optional: true),
         | 
| 170 | 
            -
                      PantographCore::ConfigItem.new(key: :proxy_password,
         | 
| 171 | 
            -
                                                   env_name: 'NEXUS_PROXY_PASSWORD',
         | 
| 172 | 
            -
                                                   sensitive: true,
         | 
| 173 | 
            -
                                                   description: 'Proxy password',
         | 
| 174 | 
            -
                                                   optional: true),
         | 
| 175 | 
            -
                      PantographCore::ConfigItem.new(key: :proxy_address,
         | 
| 176 | 
            -
                                                   env_name: 'NEXUS_PROXY_ADDRESS',
         | 
| 177 | 
            -
                                                   description: 'Proxy address',
         | 
| 178 | 
            -
                                                   optional: true),
         | 
| 179 | 
            -
                      PantographCore::ConfigItem.new(key: :proxy_port,
         | 
| 180 | 
            -
                                                   env_name: 'NEXUS_PROXY_PORT',
         | 
| 181 | 
            -
                                                   description: 'Proxy port',
         | 
| 182 | 
            -
                                                   optional: true)
         | 
| 183 | 
            -
                    ]
         | 
| 184 | 
            -
                  end
         | 
| 185 | 
            -
             | 
| 186 | 
            -
                  def self.authors
         | 
| 187 | 
            -
                    ['xfreebird', 'mdio']
         | 
| 188 | 
            -
                  end
         | 
| 189 | 
            -
             | 
| 190 | 
            -
                  def self.is_supported?(platform)
         | 
| 191 | 
            -
                    true
         | 
| 192 | 
            -
                  end
         | 
| 193 | 
            -
             | 
| 194 | 
            -
                  def self.example_code
         | 
| 195 | 
            -
                    [
         | 
| 196 | 
            -
                      '# for Nexus 2
         | 
| 197 | 
            -
                      nexus_upload(
         | 
| 198 | 
            -
                        file: "/path/to/file.ipa",
         | 
| 199 | 
            -
                        repo_id: "artefacts",
         | 
| 200 | 
            -
                        repo_group_id: "com.pantograph",
         | 
| 201 | 
            -
                        repo_project_name: "ipa",
         | 
| 202 | 
            -
                        repo_project_version: "1.13",
         | 
| 203 | 
            -
                        repo_classifier: "dSYM", # Optional
         | 
| 204 | 
            -
                        endpoint: "http://localhost:8081",
         | 
| 205 | 
            -
                        username: "admin",
         | 
| 206 | 
            -
                        password: "admin123"
         | 
| 207 | 
            -
                      )',
         | 
| 208 | 
            -
                      '# for Nexus 3
         | 
| 209 | 
            -
                      nexus_upload(
         | 
| 210 | 
            -
                        nexus_version: 3,
         | 
| 211 | 
            -
                        mount_path: "",
         | 
| 212 | 
            -
                        file: "/path/to/file.ipa",
         | 
| 213 | 
            -
                        repo_id: "artefacts",
         | 
| 214 | 
            -
                        repo_group_id: "com.pantograph",
         | 
| 215 | 
            -
                        repo_project_name: "ipa",
         | 
| 216 | 
            -
                        repo_project_version: "1.13",
         | 
| 217 | 
            -
                        repo_classifier: "dSYM", # Optional
         | 
| 218 | 
            -
                        endpoint: "http://localhost:8081",
         | 
| 219 | 
            -
                        username: "admin",
         | 
| 220 | 
            -
                        password: "admin123"
         | 
| 221 | 
            -
                      )'
         | 
| 222 | 
            -
                    ]
         | 
| 223 | 
            -
                  end
         | 
| 224 | 
            -
             | 
| 225 | 
            -
                  def self.category
         | 
| 226 | 
            -
                    :beta
         | 
| 227 | 
            -
                  end
         | 
| 228 | 
            -
                end
         | 
| 229 | 
            -
              end
         | 
| 230 | 
            -
            end
         |