napkin 0.0.4 → 0.0.5

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDU4YmNjZmFhODU3NGFkYzJmZTU3ZGIwYjg0NDkxZjFmMjQxZDRjOQ==
4
+ ZTYyYjBhODc3ZjRiNGY1NTMxMDY2N2FjYTY4NGI5ZTdhYTk4ZjU2Mw==
5
5
  data.tar.gz: !binary |-
6
- YjUzOTRkMmNhOWQ0MGE0NGEwYzk3Nzk2NmFhYTlmNmQ0N2NhNTczMw==
6
+ ZTZiZjdiYzNkZjk5MmMxNmNiNDc0YWJhNjYyODYyNzhjOWM3YmRjNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OThmMWQ4NmIzNTFjMTcwNzE4NTJhYWU0ZmYxYzk5ZGNjMmNkOTgwMzMwYjYx
10
- ODE3MzZjZTc5NWNlY2ZkMzQ0MTZkNTI5ZmFmNGUwYjQ2ODk5ZWM4NzYzMmY1
11
- ODIwZjdiYmNhNzhiYTgzOWE4ZTdhM2YxZmJlNzQ5NTEyNjc5YmI=
9
+ ZTNiYTc5MDdlOGNjOTk2MTY2ZDEwZjQzMmZhN2FmZGQ1YmZmZjMyNGUyNDMz
10
+ ODJkMjRkNWFmMTYyM2Y0Y2JmZjM3NWEzMTJiYTFiMWJmM2RhMmRjYzY4YTFh
11
+ NDc3OWE4ZmE3MTE1MDA3NDMyZmQ0YjM4Njk2MmZhYzU3ODgyNTU=
12
12
  data.tar.gz: !binary |-
13
- YjRlZGQzYzQ0OTE1MGViZjcyYzg0YjlkNzM0OWE3YTljOWRhNTc3NzI5ZTNi
14
- YmFiZGY1MmU4ZjQ5NGZkMTBkMWVlOTcwZmFjYTBjMmIwNGIwMTBkNzgwYWFm
15
- ZWM0OGQzZjhkMTNjNmI3YzE3NDAxYmQ4MzU4ZTI4YjBhZDViNDk=
13
+ ZjFmYjFhZWIxMzA1MDdmOWJkYzY5NzA5OTZjZjQxZDBkMGY0MzM1Yjk5Zjcy
14
+ ZGU5YTQ0ZmY4ZWE1NjlmMjVkNzVjY2FkMWQyYzNmMGFmNzIyMTk5ODgxYjIz
15
+ MDUwMTk2NmU3MmQwNTg5NmI1YmYyMjMxM2Q5ZTdjNWUxYTEzYjU=
data/Gemfile.lock CHANGED
@@ -1,98 +1,35 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- napkin (0.0.1.pre.1)
4
+ napkin (0.0.4)
5
+ jenkins_api_client (~> 1.3.0)
6
+ octokit (~> 3.0)
5
7
  semantic (~> 1.3.0)
6
8
  thor (~> 0.19.1)
7
- veronic (= 0.0.31)
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
12
- akami (1.2.2)
13
- gyoku (>= 0.4.0)
14
- nokogiri
15
- amq-protocol (1.9.2)
13
+ addressable (2.3.6)
16
14
  ast (2.0.0)
17
- aws-sdk (1.49.0)
18
- json (~> 1.4)
19
- nokogiri (>= 1.4.4)
20
- builder (3.2.2)
21
- bunny (1.3.1)
22
- amq-protocol (>= 1.9.2)
23
- chef (0.8.10)
24
- bunny (>= 0.6.0)
25
- erubis
26
- extlib
27
- json
28
- mixlib-authentication (>= 1.1.0)
29
- mixlib-cli (>= 1.1.0)
30
- mixlib-config (>= 1.1.0)
31
- mixlib-log (>= 1.1.0)
32
- moneta
33
- ohai (>= 0.5.0)
34
15
  coderay (1.1.0)
35
- em-winrm (0.5.5)
36
- eventmachine (~> 1.0.0)
37
- mixlib-log (>= 1.3.0)
38
- uuidtools (~> 2.1.1)
39
- winrm (~> 1.1.2)
40
- erubis (2.7.0)
41
- eventmachine (1.0.3)
42
- excon (0.31.0)
43
- extlib (0.9.16)
44
- ffi (1.9.3)
45
- fog (1.20.0)
46
- builder
47
- excon (~> 0.31.0)
48
- formatador (~> 0.2.0)
49
- mime-types
50
- multi_json (~> 1.0)
51
- net-scp (~> 1.1)
52
- net-ssh (>= 2.1.3)
53
- nokogiri (>= 1.5.11)
54
- formatador (0.2.5)
55
- gssapi (1.0.3)
56
- ffi (>= 1.0.1)
57
- gyoku (1.1.1)
58
- builder (>= 2.1.2)
59
- httpclient (2.4.0)
60
- httpi (0.9.7)
61
- rack
62
- ipaddress (0.8.0)
16
+ faraday (0.9.0)
17
+ multipart-post (>= 1.2, < 3)
18
+ jenkins_api_client (1.3.0)
19
+ json
20
+ mixlib-shellout (>= 1.1.0)
21
+ nokogiri (~> 1.6.0)
22
+ terminal-table (>= 1.4.0)
23
+ thor (>= 0.16.0)
63
24
  json (1.8.1)
64
- knife-ec2 (0.8.0)
65
- fog (~> 1.20.0)
66
- knife-windows (>= 0.5.12)
67
- knife-windows (0.6.0)
68
- em-winrm (~> 0.5, >= 0.5.4)
69
- little-plugger (1.1.3)
70
- logging (1.8.2)
71
- little-plugger (>= 1.1.3)
72
- multi_json (>= 1.8.4)
73
25
  method_source (0.8.2)
74
- mime-types (2.3)
75
- mixlib-authentication (1.3.0)
76
- mixlib-log
77
- mixlib-cli (1.5.0)
78
- mixlib-config (2.1.0)
79
- mixlib-log (1.6.0)
80
- mixlib-shellout (1.4.0)
81
- moneta (0.8.0)
82
- multi_json (1.10.1)
83
- net-scp (1.2.1)
84
- net-ssh (>= 2.6.5)
85
- net-ssh (2.9.1)
86
- nokogiri (1.5.11)
87
- nori (1.1.5)
88
- ohai (6.22.0)
89
- ipaddress
90
- mixlib-cli
91
- mixlib-config
92
- mixlib-log
93
- mixlib-shellout
94
- systemu (~> 2.5.2)
95
- yajl-ruby
26
+ mini_portile (0.6.2)
27
+ mixlib-shellout (2.0.1)
28
+ multipart-post (2.0.0)
29
+ nokogiri (1.6.6.2)
30
+ mini_portile (~> 0.6.0)
31
+ octokit (3.2.0)
32
+ sawyer (~> 0.5.3)
96
33
  parser (2.2.0.pre.3)
97
34
  ast (>= 1.1, < 3.0)
98
35
  slop (~> 3.4, >= 3.4.5)
@@ -101,51 +38,21 @@ GEM
101
38
  coderay (~> 1.1.0)
102
39
  method_source (~> 0.8.1)
103
40
  slop (~> 3.4)
104
- rack (1.5.2)
105
41
  rainbow (2.0.0)
106
- route53 (0.3.0)
107
- builder
108
- nokogiri (~> 1.5.10)
109
- ruby-hmac
110
42
  rubocop (0.24.1)
111
43
  json (>= 1.7.7, < 2)
112
44
  parser (>= 2.2.0.pre.3, < 3.0)
113
45
  powerpack (~> 0.0.6)
114
46
  rainbow (>= 1.99.1, < 3.0)
115
47
  ruby-progressbar (~> 1.4)
116
- ruby-hmac (0.4.0)
117
48
  ruby-progressbar (1.5.1)
118
- rubyntlm (0.1.1)
119
- savon (0.9.5)
120
- akami (~> 1.0)
121
- builder (>= 2.1.2)
122
- gyoku (>= 0.4.0)
123
- httpi (~> 0.9)
124
- nokogiri (>= 1.4.0)
125
- nori (~> 1.0)
126
- wasabi (~> 1.0)
127
- semantic (1.3.0)
49
+ sawyer (0.5.4)
50
+ addressable (~> 2.3.5)
51
+ faraday (~> 0.8, < 0.10)
52
+ semantic (1.3.1)
128
53
  slop (3.6.0)
129
- systemu (2.5.2)
54
+ terminal-table (1.4.5)
130
55
  thor (0.19.1)
131
- uuidtools (2.1.4)
132
- veronic (0.0.31)
133
- aws-sdk
134
- chef
135
- knife-ec2
136
- nokogiri (~> 1.5.11)
137
- route53
138
- wasabi (1.0.0)
139
- nokogiri (>= 1.4.0)
140
- winrm (1.1.3)
141
- gssapi (~> 1.0.0)
142
- httpclient (~> 2.2, >= 2.2.0.2)
143
- logging (~> 1.6, >= 1.6.1)
144
- nokogiri (~> 1.5)
145
- rubyntlm (~> 0.1.1)
146
- savon (= 0.9.5)
147
- uuidtools (~> 2.1.2)
148
- yajl-ruby (1.2.1)
149
56
 
150
57
  PLATFORMS
151
58
  ruby
data/lib/napkin/cli.rb CHANGED
@@ -1,32 +1,20 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'fileutils'
4
3
  require 'thor'
5
4
 
5
+ require_relative './cli/github'
6
+ require_relative './cli/jenkins'
7
+ require_relative './cli/tools'
8
+
6
9
  module Napkin
7
10
  class CLI < Thor
8
- include Thor::Actions
9
-
10
- def self.source_root
11
- File.join(File.dirname(__FILE__), 'files')
12
- end
13
-
14
- desc 'setup TOOL', 'set up TOOL'
15
- method_option :bootstrap_file, :aliases => '-b', :desc => 'Bootstrap template for veronic/chef'
16
- def setup(tool)
17
- puts "Setting up #{tool}!"
18
-
19
- case tool
20
- when 'veronic'
21
- bootstrap_file = options[:bootstrap_file] || '/etc/veronic/bootstrap/lifted-chef.erb'
11
+ desc 'github', 'query github api'
12
+ subcommand 'github', Github
22
13
 
23
- FileUtils.mkdir_p(File.dirname(bootstrap_file))
24
- copy_file(File.basename(bootstrap_file), bootstrap_file, :force => true)
25
- else
26
- puts "#{tool} is not a recognized tool!"
27
- exit 1
28
- end
29
- end
14
+ desc 'jenkins', 'manage a jenkins instance'
15
+ subcommand 'jenkins', Jenkins
30
16
 
17
+ desc 'tools', 'install and configure tools for builds'
18
+ subcommand 'tools', Tools
31
19
  end
32
20
  end
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ require 'octokit'
4
+
5
+ module Napkin
6
+ class CLI < Thor
7
+ class Github < Thor
8
+ include Thor::Actions
9
+
10
+ desc 'teams ORG USER', 'grab the ORG USER\'s team list'
11
+ def teams(org, user)
12
+ teams = client.organization_teams(org).map do |team|
13
+ next if team[:slug].include?('owners') || team[:permission] == 'pull' || !client.team_member?(team[:id], user)
14
+ team[:slug]
15
+ end.compact
16
+
17
+ say teams.join(',')
18
+ teams
19
+ end
20
+
21
+ desc 'commit_author REPO COMMIT', 'grab the COMMIT details from REPO'
22
+ def commit_author(repo, commit)
23
+ author = client.commit(repo, commit)[:author][:login]
24
+ say author
25
+ author
26
+ end
27
+
28
+ private
29
+
30
+ def client
31
+ Octokit::Client.new(
32
+ :access_token => ENV['GITHUB_ACCESS_TOKEN']
33
+ )
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,39 @@
1
+ # encoding: utf-8
2
+
3
+ require 'jenkins_api_client'
4
+
5
+ module Napkin
6
+ class CLI < Thor
7
+ class Jenkins < Thor
8
+ include Thor::Actions
9
+
10
+ desc 'build JOB', 'run the jenkins JOB'
11
+ method_option :params,
12
+ :aliases => '-p',
13
+ :default => {},
14
+ :desc => 'Set the build parameters',
15
+ :required => false,
16
+ :type => :hash
17
+ def build(job)
18
+ client.job.build(job, options[:params])
19
+ say "#{job} building.", :green
20
+ rescue JenkinsApi::Exceptions::NotFound
21
+ say "#{job} not found.", :red
22
+ rescue JenkinsApi::Exceptions::ApiException
23
+ say "#{job} failed to start. Did you forget something maybe?", :red
24
+ end
25
+
26
+ private
27
+
28
+ def client
29
+ @client ||= JenkinsApi::Client.new(
30
+ :server_url => ENV['JENKINS_SERVER_URL'],
31
+ :username => ENV['JENKINS_USERNAME'],
32
+ :password => ENV['JENKINS_PASSWORD'],
33
+ :log_level => ENV['DEBUG'] ? Logger::DEBUG : Logger::INFO
34
+ )
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'fileutils'
4
+
5
+ module Napkin
6
+ class CLI < Thor
7
+ class Tools < Thor
8
+ include Thor::Actions
9
+
10
+ def self.source_root
11
+ File.join(File.dirname(__FILE__), 'files')
12
+ end
13
+
14
+ desc 'setup TOOL', 'set up TOOL'
15
+ method_option :bootstrap_file, :aliases => '-b', :desc => 'Bootstrap template for veronic/chef'
16
+ def setup(tool)
17
+ puts "Setting up #{tool}!"
18
+
19
+ case tool
20
+ when 'veronic'
21
+ bootstrap_file = options[:bootstrap_file] || '/etc/veronic/bootstrap/lifted-chef.erb'
22
+
23
+ FileUtils.mkdir_p(File.dirname(bootstrap_file))
24
+ copy_file(File.basename(bootstrap_file), bootstrap_file, :force => true)
25
+ else
26
+ puts "#{tool} is not a recognized tool!"
27
+ exit 1
28
+ end
29
+ end
30
+
31
+ end
32
+ end
33
+ end
@@ -3,7 +3,7 @@
3
3
  require 'semantic'
4
4
 
5
5
  module Napkin
6
- VERSION = Semantic::Version.new('0.0.4')
6
+ VERSION = Semantic::Version.new('0.0.5')
7
7
 
8
8
  MAJOR = VERSION.major
9
9
  MINOR = VERSION.minor
data/napkin.gemspec CHANGED
@@ -28,9 +28,10 @@ Gem::Specification.new do |spec|
28
28
  end
29
29
 
30
30
  {
31
- 'semantic' => '~> 1.3.0',
32
- 'thor' => '~> 0.19.1',
33
- 'veronic' => '= 0.0.32'
31
+ 'jenkins_api_client' => '~> 1.3.0',
32
+ 'octokit' => '~> 3.0',
33
+ 'semantic' => '~> 1.3.0',
34
+ 'thor' => '~> 0.19.1'
34
35
  }.each_pair do |dep, ver|
35
36
  spec.add_dependency(dep, ver)
36
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: napkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Daniel
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.24.1
41
41
  - !ruby/object:Gem::Dependency
42
- name: semantic
42
+ name: jenkins_api_client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
@@ -53,33 +53,47 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.3.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: thor
56
+ name: octokit
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 0.19.1
61
+ version: '3.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 0.19.1
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: veronic
70
+ name: semantic
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 0.0.32
75
+ version: 1.3.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: 0.0.32
82
+ version: 1.3.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: thor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 0.19.1
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 0.19.1
83
97
  description: Simplifies the setup and preparation of job runs
84
98
  email: ops@liftopia.com
85
99
  executables:
@@ -95,6 +109,9 @@ files:
95
109
  - bin/napkin
96
110
  - lib/napkin.rb
97
111
  - lib/napkin/cli.rb
112
+ - lib/napkin/cli/github.rb
113
+ - lib/napkin/cli/jenkins.rb
114
+ - lib/napkin/cli/tools.rb
98
115
  - lib/napkin/files/lifted-chef.erb
99
116
  - lib/napkin/version.rb
100
117
  - napkin.gemspec