napkin 0.0.1.pre.1

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p429
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,156 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ napkin (0.0.1.pre.1)
5
+ semantic (~> 1.3.0)
6
+ thor (~> 0.19.1)
7
+ veronic (= 0.0.31)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ akami (1.2.2)
13
+ gyoku (>= 0.4.0)
14
+ nokogiri
15
+ amq-protocol (1.9.2)
16
+ 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
+ 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)
63
+ 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
+ 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
96
+ parser (2.2.0.pre.3)
97
+ ast (>= 1.1, < 3.0)
98
+ slop (~> 3.4, >= 3.4.5)
99
+ powerpack (0.0.9)
100
+ pry (0.10.0)
101
+ coderay (~> 1.1.0)
102
+ method_source (~> 0.8.1)
103
+ slop (~> 3.4)
104
+ rack (1.5.2)
105
+ rainbow (2.0.0)
106
+ route53 (0.3.0)
107
+ builder
108
+ nokogiri (~> 1.5.10)
109
+ ruby-hmac
110
+ rubocop (0.24.1)
111
+ json (>= 1.7.7, < 2)
112
+ parser (>= 2.2.0.pre.3, < 3.0)
113
+ powerpack (~> 0.0.6)
114
+ rainbow (>= 1.99.1, < 3.0)
115
+ ruby-progressbar (~> 1.4)
116
+ ruby-hmac (0.4.0)
117
+ 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)
128
+ slop (3.6.0)
129
+ systemu (2.5.2)
130
+ 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
+
150
+ PLATFORMS
151
+ ruby
152
+
153
+ DEPENDENCIES
154
+ napkin!
155
+ pry (~> 0.10.0)
156
+ rubocop (~> 0.24.1)
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Napkin
2
+
3
+ Tools and scripts that Jenkins can use to make new jobs and DRY simpler across jobs.
4
+
5
+ ## Documentation
6
+ Documentation can be found at https://github.com/liftopia/lodge/tree/master/docs.
7
+
8
+ ## Todo
9
+ * Move all bare scripts out of Jenkins and into their respective repositories, and DRY any common functions to here
10
+
11
+ > FUTURE TBD
data/bin/napkin ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ require 'rubygems' if RUBY_VERSION < '1.9'
5
+
6
+ lib = File.expand_path('../../lib', __FILE__)
7
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
+
9
+ require 'napkin'
10
+
11
+ Napkin::CLI.start(ARGV)
data/lib/napkin.rb ADDED
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ require 'napkin/cli'
4
+ require 'napkin/version'
5
+
6
+ module Napkin
7
+ end
data/lib/napkin/cli.rb ADDED
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+
3
+ require 'fileutils'
4
+ require 'thor'
5
+
6
+ module Napkin
7
+ 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'
22
+
23
+ FileUtils.mkdir_p(File.dirname(bootstrap_file))
24
+ copy_file(File.basename(bootstrap_file), bootstrap_file)
25
+ else
26
+ puts "#{tool} is not a recognized tool!"
27
+ exit 1
28
+ end
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,62 @@
1
+ bash -c '
2
+ <%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
3
+
4
+ exists() {
5
+ if command -v $1 &>/dev/null
6
+ then
7
+ return 0
8
+ else
9
+ return 1
10
+ fi
11
+ }
12
+
13
+ install_sh="http://opscode.com/chef/install.sh"
14
+ version_string="-v <%= chef_version %>"
15
+
16
+ if ! exists /usr/bin/chef-client; then
17
+ if exists wget; then
18
+ bash <(wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %> ${install_sh} -O -) ${version_string}
19
+ elif exists curl; then
20
+ bash <(curl -L <%= "--proxy \"#{knife_config[:bootstrap_proxy]}\" " if knife_config[:bootstrap_proxy] %> ${install_sh}) ${version_string}
21
+ else
22
+ echo "Neither wget nor curl found. Please install one and try again." >&2
23
+ exit 1
24
+ fi
25
+ fi
26
+
27
+ mkdir -p /etc/chef
28
+
29
+ awk NF > /etc/chef/validation.pem <<'EOP'
30
+ <%= validation_key %>
31
+ EOP
32
+ chmod 0600 /etc/chef/validation.pem
33
+
34
+ <% if @chef_config[:encrypted_data_bag_secret] -%>
35
+ awk NF > /etc/chef/encrypted_data_bag_secret <<'EOP'
36
+ <%= encrypted_data_bag_secret %>
37
+ EOP
38
+ chmod 0600 /etc/chef/encrypted_data_bag_secret
39
+ <% end -%>
40
+
41
+ <%# Generate Ohai Hints -%>
42
+ <% unless @chef_config[:knife][:hints].nil? || @chef_config[:knife][:hints].empty? -%>
43
+ mkdir -p /etc/chef/ohai/hints
44
+
45
+ <% @chef_config[:knife][:hints].each do |name, hash| -%>
46
+ cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
47
+ <%= hash.to_json %>
48
+ EOP
49
+ <% end -%>
50
+ <% end -%>
51
+
52
+ cat > /etc/chef/client.rb <<'EOP'
53
+ <%= config_content %>
54
+ EOP
55
+
56
+ cat > /etc/chef/first-boot.json <<'EOP'
57
+ <%= first_boot.to_json %>
58
+ EOP
59
+
60
+ <%- @chef_config[:chef_client_path] = '/opt/chef/bin/chef-client' -%>
61
+ <%= start_chef %>'
62
+
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require 'semantic'
4
+
5
+ module Napkin
6
+ VERSION = Semantic::Version.new('0.0.1-pre.1')
7
+
8
+ MAJOR = VERSION.major
9
+ MINOR = VERSION.minor
10
+ PATCH = VERSION.patch
11
+ end
data/napkin.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'napkin/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'napkin'
9
+ spec.version = Napkin::VERSION.to_s.gsub('-', '.')
10
+ spec.platform = Gem::Platform::RUBY
11
+ spec.date = '2014-07-28'
12
+ spec.summary = 'Jenkins build setup and runner'
13
+ spec.description = 'Simplifies the setup and preparation of job runs'
14
+ spec.authors = ['Aaron Daniel']
15
+ spec.email = 'ops@liftopia.com'
16
+ spec.homepage = 'https://github.com/liftopia/napkin'
17
+ spec.license = 'MIT'
18
+ spec.files = `git ls-files`.split("\n")
19
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
21
+ spec.require_path = 'lib'
22
+
23
+ {
24
+ 'pry' => '~> 0.10.0',
25
+ 'rubocop' => '~> 0.24.1'
26
+ }.each_pair do |dep, ver|
27
+ spec.add_development_dependency(dep, ver)
28
+ end
29
+
30
+ {
31
+ 'semantic' => '~> 1.3.0',
32
+ 'thor' => '~> 0.19.1',
33
+ 'veronic' => '= 0.0.31'
34
+ }.each_pair do |dep, ver|
35
+ spec.add_dependency(dep, ver)
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: napkin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre.1
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Aaron Daniel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-07-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pry
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.10.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.10.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rubocop
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.24.1
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.24.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: semantic
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.3.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: thor
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.19.1
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.19.1
78
+ - !ruby/object:Gem::Dependency
79
+ name: veronic
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - '='
84
+ - !ruby/object:Gem::Version
85
+ version: 0.0.31
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - '='
92
+ - !ruby/object:Gem::Version
93
+ version: 0.0.31
94
+ description: Simplifies the setup and preparation of job runs
95
+ email: ops@liftopia.com
96
+ executables:
97
+ - napkin
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - .ruby-version
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - README.md
105
+ - bin/napkin
106
+ - lib/napkin.rb
107
+ - lib/napkin/cli.rb
108
+ - lib/napkin/files/lifted-chef.erb
109
+ - lib/napkin/version.rb
110
+ - napkin.gemspec
111
+ homepage: https://github.com/liftopia/napkin
112
+ licenses:
113
+ - MIT
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>'
128
+ - !ruby/object:Gem::Version
129
+ version: 1.3.1
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 1.8.23
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: Jenkins build setup and runner
136
+ test_files: []