awskit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +674 -0
  7. data/README.md +4 -0
  8. data/Rakefile +6 -0
  9. data/awskit.gemspec +35 -0
  10. data/bin/awskit +6 -0
  11. data/lib/awskit/cli.rb +40 -0
  12. data/lib/awskit/gen/cli.rb +35 -0
  13. data/lib/awskit/gen/cookbook/kitchen_template_binding.rb +41 -0
  14. data/lib/awskit/gen/cookbook/service.rb +123 -0
  15. data/lib/awskit/gen/cookbook/templates/.gitignore +18 -0
  16. data/lib/awskit/gen/cookbook/templates/.kitchen.yml.erb +43 -0
  17. data/lib/awskit/gen/cookbook/templates/Berksfile +6 -0
  18. data/lib/awskit/gen/cookbook/templates/Gemfile +22 -0
  19. data/lib/awskit/gen/cookbook/templates/README.md.erb +3 -0
  20. data/lib/awskit/gen/cookbook/templates/Thorfile +5 -0
  21. data/lib/awskit/gen/cookbook/templates/Vagrantfile.erb +90 -0
  22. data/lib/awskit/gen/cookbook/templates/attributes/default.rb +2 -0
  23. data/lib/awskit/gen/cookbook/templates/chefignore +94 -0
  24. data/lib/awskit/gen/cookbook/templates/metadata.rb.erb +9 -0
  25. data/lib/awskit/gen/cookbook/templates/recipes/configure.rb +0 -0
  26. data/lib/awskit/gen/cookbook/templates/recipes/deploy.rb +0 -0
  27. data/lib/awskit/gen/cookbook/templates/recipes/setup.rb +1 -0
  28. data/lib/awskit/gen/cookbook/templates/recipes/shutdown.rb +0 -0
  29. data/lib/awskit/gen/cookbook/templates/recipes/undeploy.rb +0 -0
  30. data/lib/awskit/gen/cookbook/templates/test/integration/default/serverspec/localhost/common_spec.rb +6 -0
  31. data/lib/awskit/gen/cookbook/templates/test/integration/default/serverspec/spec_helper.rb +11 -0
  32. data/lib/awskit/gen/cookbook/vagrantfile_template_binding.rb +17 -0
  33. data/lib/awskit/gen/template_writer.rb +28 -0
  34. data/lib/awskit/gen/toolkit/files/.gitignore +9 -0
  35. data/lib/awskit/gen/toolkit/files/.rspec +2 -0
  36. data/lib/awskit/gen/toolkit/files/Gemfile +4 -0
  37. data/lib/awskit/gen/toolkit/files/LICENSE.txt +674 -0
  38. data/lib/awskit/gen/toolkit/files/README.md +3 -0
  39. data/lib/awskit/gen/toolkit/files/Rakefile +6 -0
  40. data/lib/awskit/gen/toolkit/service.rb +136 -0
  41. data/lib/awskit/gen/toolkit/templates/bin.erb +6 -0
  42. data/lib/awskit/gen/toolkit/templates/cli.erb +31 -0
  43. data/lib/awskit/gen/toolkit/templates/spec_helper.erb +2 -0
  44. data/lib/awskit/gen/toolkit/templates/toolkit.erb +24 -0
  45. data/lib/awskit/gen/toolkit/templates/toolkit.gemspec.erb +35 -0
  46. data/lib/awskit/gen/toolkit/templates/toolkit_spec.erb +11 -0
  47. data/lib/awskit/gen/toolkit/templates/version.erb +3 -0
  48. data/lib/awskit/gen/toolkit/toolkit_template_binding.rb +19 -0
  49. data/lib/awskit/version.rb +3 -0
  50. data/lib/awskit.rb +28 -0
  51. metadata +150 -0
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/awskit.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'awskit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "awskit"
8
+ spec.version = Awskit::VERSION
9
+ spec.authors = ["Jeremy Hahn"]
10
+ spec.email = ["mail@jeremyhahn.com"]
11
+
12
+ spec.summary = %q{DevOps automation toolkit generator for AWS.}
13
+ spec.description = %q{Generates an AWS DevOps toolkit.}
14
+ spec.homepage = "https://github.com/jeremyhahn/awskit"
15
+ spec.license = "GPLv3"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.11"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec", "~> 3.0"
33
+
34
+ spec.add_runtime_dependency 'stackit', "~> 0"
35
+ end
data/bin/awskit ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $:.push File.expand_path('../../lib', __FILE__)
3
+ require 'awskit/cli'
4
+ Awskit::Cli.require_clis
5
+ Awskit::Cli.start
6
+
data/lib/awskit/cli.rb ADDED
@@ -0,0 +1,40 @@
1
+ require 'stackit/cli/stack_cli'
2
+ require 'awskit'
3
+
4
+ module Awskit
5
+ class Cli < Stackit::BaseCli
6
+
7
+ def initialize(*args)
8
+ super(*args)
9
+ end
10
+
11
+ def self.require_clis
12
+ Dir.glob("#{Awskit.home}/awskit/*") do |pkg|
13
+ next if File.file?(pkg)
14
+ pkg_name = pkg.split('/').last
15
+ full_pkg_name = "Awskit::#{pkg_name.capitalize}::Cli"
16
+ cli = "#{pkg}/cli.rb"
17
+ if File.exist?(cli)
18
+ require cli
19
+ clazz = full_pkg_name.constantize
20
+ clazz.initialize_cli if clazz.respond_to?('initialize_cli')
21
+ end
22
+ end
23
+ end
24
+
25
+ desc 'version', 'Displays awskit version'
26
+ def version
27
+ puts <<-LOGO
28
+ ___ _ _______ __ __ __________
29
+ / | | / / ___// //_// _/_ __/
30
+ / /| | | /| / /\__ \/ ,< / / / /
31
+ / ___ | |/ |/ /___/ / /| |_/ / / /
32
+ /_/ |_|__/|__//____/_/ |_/___/ /_/
33
+
34
+ Amazon Web Services Toolkit Generator v#{Awskit::VERSION}
35
+
36
+ LOGO
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,35 @@
1
+ require 'erb'
2
+ require 'awskit/gen/template_writer'
3
+ require 'awskit/gen/toolkit/service'
4
+ require 'awskit/gen/cookbook/service'
5
+
6
+ module Awskit::Gen
7
+
8
+ class Cli < Stackit::BaseCli
9
+
10
+ def initialize(*args)
11
+ super(*args)
12
+ end
13
+
14
+ def self.initialize_cli
15
+ Thor.desc "gen", "AWS DevOps toolkit cookbook scaffolding"
16
+ Thor.subcommand "gen", self
17
+ end
18
+
19
+ desc 'toolkit', 'Generate a new toolkit'
20
+ method_option :name, aliases: '-n', desc: 'The toolkit name', :required => true
21
+ method_option :path, aliases: '-p', desc: 'A file system path to output the generated toolkit'
22
+ def toolkit
23
+ Toolkit::Service.new(options).gen
24
+ end
25
+
26
+ desc 'cookbook', 'Chef cookbook scaffolding'
27
+ method_option :name, aliases: '-n', desc: 'The cookbook name', :required => true
28
+ method_option :path, aliases: '-p', desc: 'A file system path to output the generated cookbook'
29
+ def cookbook
30
+ Cookbook::Service.new(options).gen
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,41 @@
1
+ module Awskit::Gen::Cookbook
2
+
3
+ class KitchenTemplateBinding
4
+
5
+ attr_accessor :aws_ssh_key
6
+ attr_accessor :security_group
7
+ attr_accessor :region
8
+ attr_accessor :availability_zone
9
+ attr_accessor :subnet_id
10
+ attr_accessor :iam_profile_name
11
+ attr_accessor :instance_type
12
+ attr_accessor :associate_public_ip
13
+ attr_accessor :transport_ssh_key
14
+ attr_accessor :transport_username
15
+ attr_accessor :platform_ami
16
+ attr_accessor :platform_username
17
+ attr_accessor :service_name
18
+
19
+ def initialize(options)
20
+ self.aws_ssh_key = options[:aws_ssh_key]
21
+ self.security_group = options[:security_group]
22
+ self.region = options[:region]
23
+ self.availability_zone = options[:availability_zone]
24
+ self.subnet_id = options[:subnet_id]
25
+ self.iam_profile_name = options[:iam_profile_name]
26
+ self.instance_type = options[:instance_type]
27
+ self.associate_public_ip = options[:associate_public_ip]
28
+ self.transport_ssh_key = options[:transport_ssh_key]
29
+ self.transport_username = options[:transport_username]
30
+ self.platform_ami = options[:platform_ami]
31
+ self.platform_username = options[:platform_username]
32
+ self.service_name = options[:service_name]
33
+ end
34
+
35
+ def get_binding
36
+ binding()
37
+ end
38
+
39
+ end
40
+ end
41
+
@@ -0,0 +1,123 @@
1
+ require 'awskit/gen/cookbook/kitchen_template_binding'
2
+ require 'awskit/gen/cookbook/vagrantfile_template_binding'
3
+
4
+ module Awskit::Gen::Cookbook
5
+
6
+ class Service
7
+
8
+ attr_accessor :options
9
+ attr_accessor :output_path
10
+
11
+ def initialize(options)
12
+ self.options = options
13
+ self.output_path = options[:path] || "./#{cookbook_name}"
14
+ end
15
+
16
+ def gen
17
+ gen_dirs
18
+ gen_kitchen_yml
19
+ gen_vagrantfile
20
+ gen_readme
21
+ gen_recipes
22
+ gen_attributes
23
+ copy_static_files
24
+ end
25
+
26
+ private
27
+
28
+ def cookbook_name
29
+ options[:name].downcase
30
+ end
31
+
32
+ def gen_dirs
33
+ FileUtils.mkdir_p "#{output_path}/test/integration/default/serverspec/localhost"
34
+ attrs = "#{output_path}/attributes"
35
+ recipes = "#{output_path}/recipes"
36
+ Dir.mkdir attrs unless File.exist?(attrs)
37
+ Dir.mkdir recipes unless File.exist?(recipes)
38
+ end
39
+
40
+ def gen_kitchen_yml
41
+ Awskit::Gen::TemplateWriter.new(
42
+ :output_path => output_path,
43
+ :template => template_path('.kitchen.yml'),
44
+ :binding => kitchen_template_binding,
45
+ :filename => '.kitchen.yml'
46
+ ).write!
47
+ end
48
+
49
+ def gen_vagrantfile
50
+ Awskit::Gen::TemplateWriter.new(
51
+ :output_path => output_path,
52
+ :template => template_path('Vagrantfile'),
53
+ :binding => service_name_template_binding,
54
+ :filename => 'Vagrantfile'
55
+ ).write!
56
+ end
57
+
58
+ def gen_readme
59
+ Awskit::Gen::TemplateWriter.new(
60
+ :output_path => output_path,
61
+ :template => template_path('README.md'),
62
+ :binding => service_name_template_binding,
63
+ :filename => 'README.md'
64
+ ).write!
65
+ end
66
+
67
+ def gen_recipes
68
+ FileUtils.touch("#{output_path}/recipes/setup.rb")
69
+ FileUtils.touch("#{output_path}/recipes/configure.rb")
70
+ FileUtils.touch("#{output_path}/recipes/deploy.rb")
71
+ FileUtils.touch("#{output_path}/recipes/undeploy.rb")
72
+ FileUtils.touch("#{output_path}/recipes/shutdown.rb")
73
+ File.write("#{output_path}/recipes/setup.rb", "include_recipe 'common'\n")
74
+ end
75
+
76
+ def gen_attributes
77
+ FileUtils.touch("#{output_path}/attributes/default.rb")
78
+ end
79
+
80
+ def copy_static_files
81
+ FileUtils.cp(static_file('Berksfile'), "#{output_path}/Berksfile")
82
+ FileUtils.cp(static_file('chefignore'), "#{output_path}/chefignore")
83
+ FileUtils.cp(static_file('Gemfile'), "#{output_path}/Gemfile")
84
+ FileUtils.cp(static_file('Thorfile'), "#{output_path}/Thorfile")
85
+ FileUtils.cp(static_file('.gitignore'), "#{output_path}/.gitignore")
86
+ FileUtils.cp(static_file('test/integration/default/serverspec/spec_helper.rb'), "#{output_path}/test/integration/default/serverspec/spec_helper.rb")
87
+ FileUtils.cp(static_file('test/integration/default/serverspec/localhost/common_spec.rb'), "#{output_path}/test/integration/default/serverspec/localhost/common_spec.rb")
88
+ end
89
+
90
+ def static_file(file)
91
+ "#{Awskit.home}/awskit/gen/cookbook/templates/#{file}"
92
+ end
93
+
94
+ def template_path(template)
95
+ "#{Awskit.home}/awskit/gen/cookbook/templates/#{template}.erb"
96
+ end
97
+
98
+ def service_name_template_binding
99
+ ServiceNameTemplateBinding.new(
100
+ service_name: options[:name]
101
+ ).get_binding
102
+ end
103
+
104
+ def kitchen_template_binding
105
+ KitchenTemplateBinding.new(
106
+ :aws_ssh_key => Awskit.environment,
107
+ :security_group => '',
108
+ :availability_zone => 'a',
109
+ :subnet_id => '',
110
+ :iam_profile_name => 'ALLOW_ALL',
111
+ :instance_type => 't2.medium',
112
+ :associate_public_ip => true,
113
+ :transport_ssh_key => "#{ENV['HOME']}.ssh/#{Awskit.environment}.pem",
114
+ :transport_username => 'ec2-user',
115
+ :platform_ami => 'ami-60b6c60a',
116
+ :platform_username => 'ec2-user',
117
+ :service_name => options[:name]
118
+ ).get_binding
119
+ end
120
+
121
+ end
122
+
123
+ end
@@ -0,0 +1,18 @@
1
+ *~
2
+ *#
3
+ .#*
4
+ \#*#
5
+ .*.sw[a-z]
6
+ *.un~
7
+ pkg/
8
+
9
+ # Berkshelf
10
+ .vagrant
11
+ /cookbooks
12
+ Berksfile.lock
13
+
14
+ # Bundler
15
+ Gemfile.lock
16
+ bin/*
17
+ .bundle/*
18
+
@@ -0,0 +1,43 @@
1
+ ---
2
+ driver:
3
+ name: ec2
4
+ aws_ssh_key_id: <%= aws_ssh_key %>
5
+ security_group_ids: ["<%= security_group %>"]
6
+ region: <%= region %>
7
+ availability_zone: <%= availability_zone %>
8
+ require_chef_omnibus: true
9
+ subnet_id: <%= subnet_id %>
10
+ iam_profile_name: <%= iam_profile_name %>
11
+ instance_type: <%= instance_type %>
12
+ associate_public_ip: <%= associate_public_ip %>
13
+ interface: dns
14
+
15
+ transport:
16
+ ssh_key: <%= transport_ssh_key %>
17
+ connection_timeout: 10
18
+ connection_retries: 5
19
+ username: <%= transport_username %>
20
+
21
+ provisioner:
22
+ name: chef_zero
23
+ chef_zero_port: 9090
24
+
25
+ platforms:
26
+ - name: amazon
27
+ driver:
28
+ image_id: <%= platform_ami %> #ami-60b6c60a
29
+ transport:
30
+ username: <%= platform_username %> #ec2-user
31
+
32
+ suites:
33
+ - name: <%= service_name %>
34
+ run_list:
35
+ - recipe[<%= service_name %>::setup]
36
+ - recipe[<%= service_name %>::configure]
37
+ - recipe[<%= service_name %>::deploy]
38
+ attributes: {
39
+ <%= service_name %>: {
40
+ test_kitchen: true
41
+ }
42
+ }
43
+
@@ -0,0 +1,6 @@
1
+ source "https://supermarket.chef.io"
2
+
3
+ metadata
4
+
5
+ cookbook 'common', path: "../common"
6
+
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'berkshelf'
4
+ gem 'test-kitchen'
5
+ gem 'kitchen-ec2'
6
+
7
+ group :integration do
8
+ gem 'kitchen-vagrant', '~> 0.11'
9
+ end
10
+
11
+ # Uncomment these lines if you want to live on the Edge:
12
+ #
13
+ # group :development do
14
+ # gem "berkshelf", github: "berkshelf/berkshelf"
15
+ # gem "vagrant", github: "mitchellh/vagrant", tag: "v1.6.3"
16
+ # end
17
+ #
18
+ # group :plugins do
19
+ # gem "vagrant-berkshelf", github: "berkshelf/vagrant-berkshelf"
20
+ # gem "vagrant-omnibus", github: "schisamo/vagrant-omnibus"
21
+ # end
22
+
@@ -0,0 +1,3 @@
1
+ # <%= service_name.capitalize %> Cookbook
2
+
3
+ Installs and configures the retailigence <%= service_name %> service.
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ require 'bundler'
4
+ require 'bundler/setup'
5
+ require 'berkshelf/thor'
@@ -0,0 +1,90 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = '2'
6
+
7
+ Vagrant.require_version '>= 1.5.0'
8
+
9
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10
+ # All Vagrant configuration is done here. The most common configuration
11
+ # options are documented and commented below. For a complete reference,
12
+ # please see the online documentation at vagrantup.com.
13
+
14
+ config.vm.hostname = '<%= service_name %>-berkshelf'
15
+
16
+ # Set the version of chef to install using the vagrant-omnibus plugin
17
+ # NOTE: You will need to install the vagrant-omnibus plugin:
18
+ #
19
+ # $ vagrant plugin install vagrant-omnibus
20
+ #
21
+ if Vagrant.has_plugin?("vagrant-omnibus")
22
+ config.omnibus.chef_version = 'latest'
23
+ end
24
+
25
+ # Every Vagrant virtual environment requires a box to build off of.
26
+ # If this value is a shorthand to a box in Vagrant Cloud then
27
+ # config.vm.box_url doesn't need to be specified.
28
+ config.vm.box = 'chef/ubuntu-14.04'
29
+
30
+
31
+ # Assign this VM to a host-only network IP, allowing you to access it
32
+ # via the IP. Host-only networks can talk to the host machine as well as
33
+ # any other machines on the same network, but cannot be accessed (through this
34
+ # network interface) by any external networks.
35
+ config.vm.network :private_network, type: 'dhcp'
36
+
37
+ # Create a forwarded port mapping which allows access to a specific port
38
+ # within the machine from a port on the host machine. In the example below,
39
+ # accessing "localhost:8080" will access port 80 on the guest machine.
40
+
41
+ # Share an additional folder to the guest VM. The first argument is
42
+ # the path on the host to the actual folder. The second argument is
43
+ # the path on the guest to mount the folder. And the optional third
44
+ # argument is a set of non-required options.
45
+ # config.vm.synced_folder "../data", "/vagrant_data"
46
+
47
+ # Provider-specific configuration so you can fine-tune various
48
+ # backing providers for Vagrant. These expose provider-specific options.
49
+ # Example for VirtualBox:
50
+ #
51
+ # config.vm.provider :virtualbox do |vb|
52
+ # # Don't boot with headless mode
53
+ # vb.gui = true
54
+ #
55
+ # # Use VBoxManage to customize the VM. For example to change memory:
56
+ # vb.customize ["modifyvm", :id, "--memory", "1024"]
57
+ # end
58
+ #
59
+ # View the documentation for the provider you're using for more
60
+ # information on available options.
61
+
62
+ # The path to the Berksfile to use with Vagrant Berkshelf
63
+ # config.berkshelf.berksfile_path = "./Berksfile"
64
+
65
+ # Enabling the Berkshelf plugin. To enable this globally, add this configuration
66
+ # option to your ~/.vagrant.d/Vagrantfile file
67
+ config.berkshelf.enabled = true
68
+
69
+ # An array of symbols representing groups of cookbook described in the Vagrantfile
70
+ # to exclusively install and copy to Vagrant's shelf.
71
+ # config.berkshelf.only = []
72
+
73
+ # An array of symbols representing groups of cookbook described in the Vagrantfile
74
+ # to skip installing and copying to Vagrant's shelf.
75
+ # config.berkshelf.except = []
76
+
77
+ config.vm.provision :chef_solo do |chef|
78
+ chef.json = {
79
+ mysql: {
80
+ server_root_password: 'rootpass',
81
+ server_debian_password: 'debpass',
82
+ server_repl_password: 'replpass'
83
+ }
84
+ }
85
+
86
+ chef.run_list = [
87
+ 'recipe[<%= service_name %>::default]'
88
+ ]
89
+ end
90
+ end
@@ -0,0 +1,2 @@
1
+ node.default[:cassandra][:version] = "2.2.6"
2
+ node.default['cassandra']['config']['cluster_name'] = 'retaildb'
@@ -0,0 +1,94 @@
1
+ # Put files/directories that should be ignored in this file when uploading
2
+ # or sharing to the community site.
3
+ # Lines that start with '# ' are comments.
4
+
5
+ # OS generated files #
6
+ ######################
7
+ .DS_Store
8
+ Icon?
9
+ nohup.out
10
+ ehthumbs.db
11
+ Thumbs.db
12
+
13
+ # SASS #
14
+ ########
15
+ .sass-cache
16
+
17
+ # EDITORS #
18
+ ###########
19
+ \#*
20
+ .#*
21
+ *~
22
+ *.sw[a-z]
23
+ *.bak
24
+ REVISION
25
+ TAGS*
26
+ tmtags
27
+ *_flymake.*
28
+ *_flymake
29
+ *.tmproj
30
+ .project
31
+ .settings
32
+ mkmf.log
33
+
34
+ ## COMPILED ##
35
+ ##############
36
+ a.out
37
+ *.o
38
+ *.pyc
39
+ *.so
40
+ *.com
41
+ *.class
42
+ *.dll
43
+ *.exe
44
+ */rdoc/
45
+
46
+ # Testing #
47
+ ###########
48
+ .watchr
49
+ .rspec
50
+ spec/*
51
+ spec/fixtures/*
52
+ test/*
53
+ features/*
54
+ Guardfile
55
+ Procfile
56
+
57
+ # SCM #
58
+ #######
59
+ .git
60
+ */.git
61
+ .gitignore
62
+ .gitmodules
63
+ .gitconfig
64
+ .gitattributes
65
+ .svn
66
+ */.bzr/*
67
+ */.hg/*
68
+ */.svn/*
69
+
70
+ # Berkshelf #
71
+ #############
72
+ cookbooks/*
73
+ tmp
74
+
75
+ # Cookbooks #
76
+ #############
77
+ CONTRIBUTING
78
+ CHANGELOG*
79
+
80
+ # Strainer #
81
+ ############
82
+ Colanderfile
83
+ Strainerfile
84
+ .colander
85
+ .strainer
86
+
87
+ # Vagrant #
88
+ ###########
89
+ .vagrant
90
+ Vagrantfile
91
+
92
+ # Travis #
93
+ ##########
94
+ .travis.yml
@@ -0,0 +1,9 @@
1
+ name '<%= service_name %>'
2
+ maintainer 'root'
3
+ maintainer_email 'root@localhost'
4
+ license 'All rights reserved'
5
+ description 'Installs/Configures <%= service_name %>'
6
+ long_description 'Installs/Configures <%= service_name %>'
7
+ version IO.read(File.join(File.dirname(__FILE__), 'VERSION')) rescue '0.0.1'
8
+
9
+ depends 'common'
@@ -0,0 +1 @@
1
+ include_recipe 'common'
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe command('java -version') do
4
+ its(:exit_status) { should eq(0) }
5
+ its(:stdout) { should match(/.*1.8.*/) }
6
+ end
@@ -0,0 +1,11 @@
1
+ require 'serverspec'
2
+ require 'pathname'
3
+
4
+ include Serverspec::Helper::Exec
5
+ include Serverspec::Helper::DetectOS
6
+
7
+ RSpec.configure do |c|
8
+ c.before :all do
9
+ c.os = backend(Serverspec::Commands::Base).check_os
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ module Awskit::Gen::Cookbook
2
+
3
+ class ServiceNameTemplateBinding
4
+
5
+ attr_accessor :service_name
6
+
7
+ def initialize(options)
8
+ self.service_name = options[:service_name]
9
+ end
10
+
11
+ def get_binding
12
+ binding()
13
+ end
14
+
15
+ end
16
+ end
17
+
@@ -0,0 +1,28 @@
1
+ module Awskit::Gen
2
+
3
+ class TemplateWriter
4
+
5
+ attr_accessor :output_path
6
+ attr_accessor :template
7
+ attr_accessor :binding
8
+ attr_accessor :filename
9
+
10
+ def initialize(options)
11
+ self.output_path = options[:output_path]
12
+ self.template = options[:template]
13
+ self.binding = options[:binding]
14
+ self.filename = options[:filename]
15
+ end
16
+
17
+ def write!
18
+ t = File.open(template).read
19
+ erb_template = ERB.new(t, nil, '-')
20
+ content = erb_template.result(binding)
21
+ File.open("#{output_path}/#{filename}", "w+") { |file|
22
+ file.write(content)
23
+ }
24
+ end
25
+
26
+ end
27
+
28
+ end