ci-scripts 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ac5e229d85cdef8e918dede6312a3ccf6b90f24
4
- data.tar.gz: c18f8fa9149a1ed9d156f14a9790a24c12f5c0ae
3
+ metadata.gz: 46655709cc0544cba34bfaef732fb69e547ca407
4
+ data.tar.gz: 46b0a3387faf3cd3ca5256449cccf92b14563cf0
5
5
  SHA512:
6
- metadata.gz: 9eed1550a221a800b91d424334ba8874acc6cbe79737972073503826610c489b3037bb16ef221bd29575b963226ed2cab53976c65ec0f49a597fcea77cbf91e4
7
- data.tar.gz: 4276f93e74777fb4af74409208c7da357d855aade6365e8edb3b8adb3a5c162e7330218b25cf0c29be19555b51f1052b21af09b2b10768b89fbb6081a92a2dca
6
+ metadata.gz: 7b35554c348a127b241c0f0577422e3ae1f6e2cf1bf69f60a478220927ec9cf3524ffd7192af283e819bc4c4f2e75b246af3932bfbfe9067d070f763eb18820b
7
+ data.tar.gz: 42b06a920241347602ddf9b866860fd7b50e7b9946ac9b29c12c78f07528c8f9fe4a721f25a896a99004de6a4e0717eaad6307485b1aa31fdf448fd5b9d54909
data/.gitlab-ci.yml CHANGED
@@ -5,12 +5,9 @@ cache:
5
5
  paths:
6
6
  - vendor/ruby
7
7
 
8
- variables:
9
- CI_SCRIPTS_VERSION: git
10
-
11
8
  before_script:
12
9
  - ruby -v # Print out ruby version for debugging
13
- - wget -qO- https://raw.githubusercontent.com/benjamincaldwell/ci-scripts/master/install | bash
10
+ - gem install ci-scripts
14
11
 
15
12
  rubocop:
16
13
  script:
data/README.md CHANGED
@@ -4,7 +4,7 @@ A collection of modular scripts that are commonly run in CI. The goal of this pr
4
4
 
5
5
 
6
6
  ```
7
- wget -qO- https://raw.githubusercontent.com/benjamincaldwell/ci-scripts/master/install | bash
7
+ gem install ci-scripts
8
8
  ci-scripts SCRIPT_NAME
9
9
  ```
10
10
 
data/bin/ci-scripts CHANGED
@@ -1,27 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
- dir = File.join(File.dirname(__FILE__), '..')
3
2
 
4
- unless File.exist? File.join(dir, "lib/base.rb")
5
- dir = if ENV["CI_SCRIPTS_INSTALL_LOCATION"]
6
- ENV["CI_SCRIPTS_INSTALL_LOCATION"]
7
- else
8
- "/opt/ci-scripts"
9
- end
10
- end
11
-
12
- $LOAD_PATH.unshift(dir)
13
-
14
- require "lib/base"
15
- # required for using english versions of ruby globals
16
- # https://github.com/CocoaPods/cocoapods-downloader/issues/28
17
- require "English"
3
+ require "ci_scripts"
18
4
 
19
5
  if ARGV.count <= 0
20
6
  log_error "No script specified"
21
7
  exit 1
22
8
  end
23
9
 
10
+ if ARGV == ["version"]
11
+ puts CIScripts::VERSION
12
+ exit 0
13
+ end
14
+
24
15
  ARGV.each do |script_name|
25
- script_name = script_name.strip
26
- run_script(script_name)
16
+ CIScripts.run_script(script_name)
27
17
  end
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "ci/scripts"
4
+ require "ci_scripts"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -1,7 +1,5 @@
1
1
  # #!/usr/bin/ruby
2
2
 
3
- BASE_SCRIPT_PATH = "https://raw.githubusercontent.com/benjamincaldwell/ci-scripts/master/".freeze
4
-
5
3
  # Logging
6
4
  def log_info(s)
7
5
  puts("\x1b[34m#{s}\x1b[0m")
@@ -75,18 +73,3 @@ def unindent(s)
75
73
  indent = s.split("\n").select { |line| !line.strip.empty? }.map { |line| line.index(/[^\s]/) }.compact.min || 0
76
74
  s.gsub(/^[[:blank:]]{#{indent}}/, '')
77
75
  end
78
-
79
- def run_script(script_name)
80
- require script_name
81
-
82
- script_parts = script_name.split("/")
83
- function_name = script_parts.pop
84
- module_name = ""
85
-
86
- script_parts.each do |part|
87
- module_name += "::" unless module_name.empty?
88
- module_name += classify(part)
89
- end
90
-
91
- Object.const_get(module_name).send(function_name)
92
- end
@@ -1,3 +1,3 @@
1
1
  module CIScripts
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/ci_scripts.rb CHANGED
@@ -1,5 +1,32 @@
1
1
  require "ci_scripts/version"
2
2
 
3
+ require "ci_scripts/helpers"
4
+
5
+ # required for using english versions of ruby globals
6
+ # https://github.com/CocoaPods/cocoapods-downloader/issues/28
7
+ require "English"
8
+
3
9
  module CIScripts
4
- # Your code goes here...
10
+ def self.run_script(script_name)
11
+ script_name = script_name.strip
12
+ full_path = File.join(File.dirname(__FILE__), "scripts", script_name)
13
+
14
+ unless File.exist?("#{full_path}.rb")
15
+ log_error "#{script_name} does not exists"
16
+ return false
17
+ end
18
+
19
+ require full_path
20
+
21
+ script_parts = script_name.split("/")
22
+ function_name = script_parts.pop
23
+ module_name = ""
24
+
25
+ script_parts.each do |part|
26
+ module_name += "::" unless module_name.empty?
27
+ module_name += classify(part)
28
+ end
29
+
30
+ Object.const_get(module_name).send(function_name)
31
+ end
5
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci-scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Caldwell
@@ -73,22 +73,20 @@ files:
73
73
  - bin/console
74
74
  - bin/setup
75
75
  - ci-scripts.gemspec
76
- - docker/build.rb
77
- - docker/herokuish.rb
78
- - docker/login.rb
79
- - docker/push_branch.rb
80
- - docker/push_latest.rb
81
- - exe/ci-scripts
82
- - git/ssh_keys.rb
83
- - go/glide
84
- - go/install
85
- - go/test
86
- - install
87
- - lib/base.rb
88
76
  - lib/ci_scripts.rb
77
+ - lib/ci_scripts/helpers.rb
89
78
  - lib/ci_scripts/version.rb
90
- - ruby/bundler.rb
91
- - ruby/rubocop.rb
79
+ - lib/scripts/docker/build.rb
80
+ - lib/scripts/docker/herokuish.rb
81
+ - lib/scripts/docker/login.rb
82
+ - lib/scripts/docker/push_branch.rb
83
+ - lib/scripts/docker/push_latest.rb
84
+ - lib/scripts/git/ssh_keys.rb
85
+ - lib/scripts/go/glide
86
+ - lib/scripts/go/install
87
+ - lib/scripts/go/test
88
+ - lib/scripts/ruby/bundler.rb
89
+ - lib/scripts/ruby/rubocop.rb
92
90
  homepage: http://github.com/benjamincaldwell/ci-scripts
93
91
  licenses:
94
92
  - MIT
@@ -109,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
107
  version: '0'
110
108
  requirements: []
111
109
  rubyforge_project:
112
- rubygems_version: 2.5.1
110
+ rubygems_version: 2.6.12
113
111
  signing_key:
114
112
  specification_version: 4
115
113
  summary: A collection fo scripts for commomly run scripts in CI.
data/exe/ci-scripts DELETED
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- dir = File.join(File.dirname(__FILE__), '..')
4
-
5
- unless File.exist? File.join(dir, "lib/base.rb")
6
- dir = if ENV["CI_SCRIPTS_INSTALL_LOCATION"]
7
- ENV["CI_SCRIPTS_INSTALL_LOCATION"]
8
- else
9
- "/opt/ci-scripts"
10
- end
11
- end
12
-
13
- $LOAD_PATH.unshift(dir)
14
-
15
- require "lib/base"
16
- # required for using english versions of ruby globals
17
- # https://github.com/CocoaPods/cocoapods-downloader/issues/28
18
- require "English"
19
-
20
- if ARGV.count <= 0
21
- log_error "No script specified"
22
- exit 1
23
- end
24
-
25
- ARGV.each do |script_name|
26
- script_name = script_name.strip
27
- run_script(script_name)
28
- end
data/install DELETED
@@ -1,44 +0,0 @@
1
- #!/usr/bin/bash
2
- set -e
3
-
4
- # set TMPDIR to /tmp if it doesnt exist
5
- if [ -z "$TMPDIR" ]; then
6
- export TMPDIR=/tmp
7
- fi
8
-
9
- install_location=${CI_SCRIPTS_INSTALL_LOCATION:="/opt/ci-scripts"}
10
-
11
- install_version=${CI_SCRIPTS_VERSION:="latest"}
12
-
13
- echo "Installing ci-scripts-${install_version} to ${install_location}"
14
-
15
- _ci_scripts_install_version() {
16
- local tar_file="${TMPDIR}/ci-scripts.tar.gz"
17
- local extracted_folder="${TMPDIR}/ci-scripts-$1"
18
- wget "https://github.com/benjamincaldwell/ci-scripts/archive/v$1.tar.gz" -O "${tar_file}"
19
- tar -zxvf "${tar_file}" -C "${TMPDIR}"
20
- _ci_scripts_sudo mv "${extracted_folder}" "${install_location}"
21
- rm -rf "${extracted_folder}" "${tar_file}"
22
- }
23
-
24
- _ci_scripts_sudo() {
25
- SUDO=''
26
- if [ "$(whoami)" != "root" ]; then
27
- SUDO='sudo'
28
- fi
29
- $SUDO "$@"
30
- }
31
-
32
- case "$install_version" in
33
- git)
34
- _ci_scripts_sudo git clone git://github.com/benjamincaldwell/ci-scripts.git "${install_location}"
35
- ;;
36
- latest)
37
- echo "guh"
38
- ;;
39
- *)
40
- _ci_scripts_install_version "$install_version"
41
- ;;
42
- esac
43
-
44
- _ci_scripts_sudo ln -snf /opt/ci-scripts/bin/ci-scripts /usr/bin/ci-scripts
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes