bosh-plugin-generator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 939a697dd4edc2ca8e6002088b39345267e0f7b8
4
+ data.tar.gz: b812d9894b3aef6b37539ee0b72767b8d162f959
5
+ SHA512:
6
+ metadata.gz: e984f0d586b6bab11fe4b8d88ad90f18aec8d51a9edb424b05d2c551312359ffdfb39e465864785389113077f6461ced896fe6ac98057efb1567efa9ce1bf75c
7
+ data.tar.gz: 34bd57d8840d36ce1698b19035e585b05ccfbf0897882efb1eae2e79f0dc832529d549bd00a2add5e192cfceb49ccbb30ec11510978ec0e3b7be509f265c68db
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ tmp
2
+ .rvmrc
3
+ .ruby-gemset
4
+ .ruby-version
5
+ magic
data/.rmvrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create 2.1.5@bosh-plugin-generator
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format progress
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ before_install:
3
+ - sudo apt-get update -qq --fix-missing
4
+ - sudo apt-get install -qq git
5
+ - "git config --global user.name git-user && git config --global user.email git-user@mail.com"
6
+ rvm:
7
+ - 2.2.0
8
+ - 2.1.5
9
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bosh-plugin.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'pry-byebug'
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,162 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bosh-plugin-generator (0.0.1)
5
+ bosh_cli (>= 1.2682.0)
6
+ bosh_common (>= 1.2682.0)
7
+ erubis (~> 2.7.0)
8
+ git (~> 1.2.6)
9
+ membrane (~> 1.1.0)
10
+ semi_semantic (~> 1.1.0)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ ast (2.0.0)
16
+ astrolabe (1.3.0)
17
+ parser (>= 2.2.0.pre.3, < 3.0)
18
+ aws-sdk (1.44.0)
19
+ json (~> 1.4)
20
+ nokogiri (>= 1.4.4)
21
+ blobstore_client (1.2811.0)
22
+ aws-sdk (= 1.44.0)
23
+ bosh_common (~> 1.2811.0)
24
+ fog (~> 1.23.0)
25
+ httpclient (= 2.4.0)
26
+ multi_json (~> 1.1)
27
+ ruby-atmos-pure (~> 1.0.5)
28
+ bosh-template (1.2811.0)
29
+ semi_semantic (~> 1.1.0)
30
+ bosh_cli (1.2811.0)
31
+ blobstore_client (~> 1.2811.0)
32
+ bosh-template (~> 1.2811.0)
33
+ bosh_common (~> 1.2811.0)
34
+ highline (~> 1.6.2)
35
+ httpclient (= 2.4.0)
36
+ json_pure (~> 1.7)
37
+ minitar (~> 0.5.4)
38
+ net-scp (~> 1.1.0)
39
+ net-ssh (>= 2.2.1)
40
+ net-ssh-gateway (~> 1.2.0)
41
+ netaddr (~> 1.5.0)
42
+ progressbar (~> 0.9.0)
43
+ terminal-table (~> 1.4.3)
44
+ bosh_common (1.2811.0)
45
+ logging (~> 1.8.2)
46
+ semi_semantic (~> 1.1.0)
47
+ builder (3.2.2)
48
+ byebug (3.5.1)
49
+ columnize (~> 0.8)
50
+ debugger-linecache (~> 1.2)
51
+ slop (~> 3.6)
52
+ coderay (1.1.0)
53
+ columnize (0.9.0)
54
+ debugger-linecache (1.2.0)
55
+ diff-lcs (1.2.5)
56
+ erubis (2.7.0)
57
+ excon (0.43.0)
58
+ fog (1.23.0)
59
+ fog-brightbox
60
+ fog-core (~> 1.23)
61
+ fog-json
62
+ fog-softlayer
63
+ ipaddress (~> 0.5)
64
+ nokogiri (~> 1.5, >= 1.5.11)
65
+ fog-brightbox (0.7.1)
66
+ fog-core (~> 1.22)
67
+ fog-json
68
+ inflecto (~> 0.0.2)
69
+ fog-core (1.27.3)
70
+ builder
71
+ excon (~> 0.38)
72
+ formatador (~> 0.2)
73
+ mime-types
74
+ net-scp (~> 1.1)
75
+ net-ssh (>= 2.1.3)
76
+ fog-json (1.0.0)
77
+ multi_json (~> 1.0)
78
+ fog-softlayer (0.3.27)
79
+ fog-core
80
+ fog-json
81
+ formatador (0.2.5)
82
+ git (1.2.8)
83
+ highline (1.6.21)
84
+ httpclient (2.4.0)
85
+ inflecto (0.0.2)
86
+ ipaddress (0.8.0)
87
+ json (1.8.2)
88
+ json_pure (1.8.2)
89
+ little-plugger (1.1.3)
90
+ log4r (1.1.10)
91
+ logging (1.8.2)
92
+ little-plugger (>= 1.1.3)
93
+ multi_json (>= 1.8.4)
94
+ membrane (1.1.0)
95
+ method_source (0.8.2)
96
+ mime-types (2.4.3)
97
+ mini_portile (0.6.2)
98
+ minitar (0.5.4)
99
+ multi_json (1.10.1)
100
+ net-scp (1.1.2)
101
+ net-ssh (>= 2.6.5)
102
+ net-ssh (2.9.2)
103
+ net-ssh-gateway (1.2.0)
104
+ net-ssh (>= 2.6.5)
105
+ netaddr (1.5.0)
106
+ nokogiri (1.6.5)
107
+ mini_portile (~> 0.6.0)
108
+ parser (2.2.0.2)
109
+ ast (>= 1.1, < 3.0)
110
+ powerpack (0.0.9)
111
+ progressbar (0.9.2)
112
+ pry (0.10.1)
113
+ coderay (~> 1.1.0)
114
+ method_source (~> 0.8.1)
115
+ slop (~> 3.4)
116
+ pry-byebug (2.0.0)
117
+ byebug (~> 3.4)
118
+ pry (~> 0.10)
119
+ rainbow (2.0.0)
120
+ rake (10.4.2)
121
+ rspec (3.1.0)
122
+ rspec-core (~> 3.1.0)
123
+ rspec-expectations (~> 3.1.0)
124
+ rspec-mocks (~> 3.1.0)
125
+ rspec-core (3.1.7)
126
+ rspec-support (~> 3.1.0)
127
+ rspec-expectations (3.1.2)
128
+ diff-lcs (>= 1.2.0, < 2.0)
129
+ rspec-support (~> 3.1.0)
130
+ rspec-its (1.1.0)
131
+ rspec-core (>= 3.0.0)
132
+ rspec-expectations (>= 3.0.0)
133
+ rspec-mocks (3.1.3)
134
+ rspec-support (~> 3.1.0)
135
+ rspec-support (3.1.2)
136
+ rubocop (0.28.0)
137
+ astrolabe (~> 1.3)
138
+ parser (>= 2.2.0.pre.7, < 3.0)
139
+ powerpack (~> 0.0.6)
140
+ rainbow (>= 1.99.1, < 3.0)
141
+ ruby-progressbar (~> 1.4)
142
+ ruby-atmos-pure (1.0.5)
143
+ log4r (>= 1.1.9)
144
+ ruby-hmac (>= 0.4.0)
145
+ ruby-hmac (0.4.0)
146
+ ruby-progressbar (1.7.1)
147
+ semi_semantic (1.1.0)
148
+ slop (3.6.0)
149
+ terminal-table (1.4.5)
150
+
151
+ PLATFORMS
152
+ ruby
153
+
154
+ DEPENDENCIES
155
+ bosh-plugin-generator!
156
+ bundler (~> 1.6)
157
+ pry-byebug
158
+ rake
159
+ rspec (~> 3.1.0)
160
+ rspec-its (~> 1.1.0)
161
+ rspec-mocks
162
+ rubocop
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Bosh plugin generator
2
+ [![Build Status](https://travis-ci.org/Altoros/bosh-plugin-generator.svg?branch=master)](https://travis-ci.org/Altoros/bosh-plugin-generator)
3
+
4
+ This gem creates file system tree structure for BOSH plugin. BOSH installs and updates software packages on large numbers of VMs over many IaaS providers with the absolute minimum of configuration changes.
5
+
6
+ ## What is BOSH?
7
+ BOSH orchestrates initial deployments and ongoing updates that are: predictable, repeatable, reliable, self-healing, infrastructure-agnostic. You can take a look on [BOSH project on GitHub](https://github.com/cloudfoundry/bosh) and read more details in [docs](http://docs.cloudfoundry.org/bosh/).
8
+
9
+ ## How to install
10
+ ```
11
+ gem install bosh-plugin-generator
12
+ ```
13
+
14
+ ## How to use
15
+ ```
16
+ bosh generate plugin <plugin-name>
17
+ ```
18
+
19
+ ## Contributing
20
+
21
+ 1. Fork it
22
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
23
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
24
+ 4. Push to the branch (`git push origin my-new-feature`)
25
+ 5. Create new Pull Request
26
+
27
+ ## List of Contributors
28
+
29
+ * [Altoros](https://www.altoros.com)
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task :default => :spec
5
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'bosh/plugin_generator/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "bosh-plugin-generator"
9
+ spec.version = Bosh::PluginGenerator::VERSION
10
+ spec.authors = ["Alex Lomov"]
11
+ spec.email = ["lomov.as@gmail.com"]
12
+ spec.description = %q{Create file system tree structure for BOSH plugin development.}
13
+ spec.summary = %q{This gem creates file system tree structure for BOSH plugin. BOSH installs and updates software packages on large numbers of VMs over many IaaS providers with the absolute minimum of configuration changes.}
14
+ spec.homepage = "http://altoros.com"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.required_ruby_version = '>= 2.0.0'
23
+
24
+ spec.add_runtime_dependency "bosh_cli", ">= 1.2682.0"
25
+ spec.add_runtime_dependency "bosh_common", ">= 1.2682.0"
26
+ spec.add_runtime_dependency "semi_semantic", "~> 1.1.0"
27
+ spec.add_runtime_dependency "membrane", "~> 1.1.0"
28
+ spec.add_runtime_dependency "git", "~> 1.2.6"
29
+ spec.add_runtime_dependency "erubis", "~> 2.7.0"
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.6"
32
+ spec.add_development_dependency "rspec", "~> 3.1.0"
33
+ spec.add_development_dependency "rspec-its", '~> 1.1.0'
34
+ spec.add_development_dependency "rake"
35
+ spec.add_development_dependency "rubocop"
36
+ spec.add_development_dependency "rspec-mocks"
37
+ end
@@ -0,0 +1,24 @@
1
+ require "bosh/plugin_generator"
2
+
3
+ module Bosh::Cli::Command
4
+ class PluginGenerator < Base
5
+ include Bosh::PluginGenerator::Helpers
6
+
7
+ # example: bosh generate plugin bosh-magic
8
+ usage "generate plugin"
9
+ desc "Generates folder with skeleton of new BOSH plugin."
10
+ option "--author [author]", String, "name of the owner (by default will take from git settings)"
11
+ option "--email [email]", String, "email of the owner (by default will take from git settings)"
12
+ option "--description [text]", String, "Short description of the plugin"
13
+ option "--license [type]", String, "type of license file included to plugin repository" +
14
+ "(possible values mit|gpl|lgpl|apache2)"
15
+ def perform(plugin_name)
16
+ extract_options(plugin_name)
17
+ say "Generating BOSH CLI plugin...".make_green
18
+ generate_files
19
+ say "DONE. ".make_green
20
+ say "The plugin is saved to #{File.join(Dir.pwd, plugin_name)}"
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ require "cli"
2
+ require "cli/core_ext"
3
+
4
+ module Bosh
5
+ module PluginGenerator
6
+ include BoshExtensions
7
+ end
8
+ end
9
+
10
+ require "bosh/plugin_generator/generator"
11
+ require "bosh/plugin_generator/helpers"
12
+ require "bosh/cli/commands/plugin_generator"
@@ -0,0 +1,29 @@
1
+ require 'erubis'
2
+
3
+ module Bosh
4
+ module PluginGenerator
5
+ class Generator
6
+
7
+ attr_accessor :context, :options
8
+ def initialize(context, options = {})
9
+ @options = options
10
+ @context = context
11
+ end
12
+
13
+ def generate(source, target)
14
+ folder = File.dirname(target)
15
+ FileUtils.mkdir_p(folder)
16
+ template = File.read(File.join(source_folder, source))
17
+ result = Erubis::Eruby.new(template).result(context)
18
+ File.write(target, result)
19
+ end
20
+
21
+ private
22
+
23
+ def source_folder
24
+ options[:source_folder] || Dir.pwd
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,98 @@
1
+ require 'git'
2
+
3
+ module Bosh
4
+ module PluginGenerator
5
+ module Helpers
6
+
7
+ attr_accessor :plugin_name, :plugin_folder, :lib_folder, :helpers_folder, :commands_folder
8
+
9
+ extend Forwardable
10
+ def_delegator :@generator, :generate
11
+
12
+ def extract_options(plugin_name)
13
+ @plugin_name = plugin_name
14
+ @plugin_folder = plugin_name
15
+ @license_type = options[:license]
16
+ @lib_folder = File.join(plugin_name, 'lib', 'bosh')
17
+ @spec_folder = File.join(plugin_name, 'spec')
18
+ @helpers_folder = File.join(lib_folder, short_plugin_name)
19
+ @commands_folder = File.join(lib_folder, 'cli', 'commands')
20
+
21
+ default_context = {
22
+ email: Git.global_config["user.email"],
23
+ author: Git.global_config["user.name"],
24
+ description: "Short description.",
25
+ license: nil,
26
+ full_plugin_name: full_plugin_name,
27
+ short_plugin_name: short_plugin_name,
28
+ class_name: short_plugin_name.split('_').collect(&:capitalize).join
29
+ }
30
+ context = default_context.merge(options)
31
+ raise "You need to specify email and author" if context[:email].nil? || context[:author].nil?
32
+ templates_folder = File.expand_path("../../../../templates", __FILE__)
33
+ @generator = Bosh::PluginGenerator::Generator.new(context, source_folder: templates_folder)
34
+ end
35
+
36
+ def generate_files
37
+ generate_command_class
38
+ generate_helpers
39
+ generate_version
40
+ generate_gemspec
41
+ generate_readme
42
+ generate_license if license?
43
+ generate_developer_environment
44
+ end
45
+
46
+ private
47
+
48
+ def full_plugin_name
49
+ return @full_plugin_name if @full_plugin_name
50
+ separator = plugin_name.include?('_') ? '_' : '-'
51
+ @full_plugin_name = plugin_name.start_with?('bosh') ? plugin_name : ['bosh', plugin_name].join(separator)
52
+ end
53
+
54
+ def short_plugin_name
55
+ @short_plugin_name ||= plugin_name.gsub(/^bosh[_-]/, '')
56
+ end
57
+
58
+ def license?
59
+ !!@license_type
60
+ end
61
+
62
+ def generate_command_class
63
+ generate('main.rb.erb', File.join(lib_folder, "#{short_plugin_name}.rb"))
64
+ generate('cli/commands/command.rb.erb', File.join(commands_folder, "#{short_plugin_name}.rb"))
65
+ end
66
+
67
+ def generate_helpers
68
+ generate('helpers_folder/helpers.rb.erb', File.join(helpers_folder, 'helpers.rb'))
69
+ end
70
+
71
+ def generate_version
72
+ generate('helpers_folder/version.rb.erb', File.join(helpers_folder, 'version.rb'))
73
+ end
74
+
75
+ def generate_gemspec
76
+ generate('gemspec.erb', File.join(plugin_name, "#{full_plugin_name}.gemspec"))
77
+ end
78
+
79
+ def generate_readme
80
+ generate('README.md.erb', File.join(plugin_name, 'README.md'))
81
+ end
82
+
83
+ def generate_license
84
+ generate("licenses/#{@license_type}.txt", File.join(plugin_name, 'LICENSE'))
85
+ end
86
+
87
+ def generate_developer_environment
88
+ generate("Gemfile", File.join(plugin_folder, "Gemfile"))
89
+ generate("Rakefile", File.join(plugin_folder, 'Rakefile'))
90
+ generate("spec/spec_helper.rb", File.join(@spec_folder, 'spec_helper.rb'))
91
+ generate("spec/command_spec.rb", File.join(@spec_folder, 'command_spec.rb'))
92
+ generate("spec/.rspec", File.join(plugin_folder, '.rspec'))
93
+ generate(".gitignore", File.join(plugin_folder, '.gitignore'))
94
+ end
95
+
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,5 @@
1
+ module Bosh
2
+ module PluginGenerator
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ I needed to put something here, so here is my question :
2
+
3
+ How many people can read hex if only <%= people.join(', ') %> and dead people can read hex?
@@ -0,0 +1,25 @@
1
+ describe Bosh::PluginGenerator::Generator do
2
+ let(:context) { { people: ['you', 'me'] } }
3
+ let(:tmpdir) { Dir.mktmpdir }
4
+ let(:target) { File.join(tmpdir, 'subfolder-1', 'subfolder-2', 'result.txt') }
5
+ subject { Bosh::PluginGenerator::Generator.new(context, source_folder: File.expand_path('../../assets', __FILE__)) }
6
+ after { FileUtils.remove_entry_secure tmpdir }
7
+
8
+ describe '#generate' do
9
+ before do
10
+ subject.generate('simple-template.txt', target)
11
+ end
12
+
13
+ context 'simple template' do
14
+
15
+ it 'creates file with folder' do
16
+ expect(File).to exist(target)
17
+ end
18
+
19
+ it 'creates renders ERB' do
20
+ expect(File.read(target)).to match(/you, me/)
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,72 @@
1
+ describe "bosh generate plugin" do
2
+
3
+ describe 'magic command' do
4
+
5
+ before(:context) do
6
+ @current_dir = Dir.pwd
7
+ @tmpdir = Dir.mktmpdir
8
+ Dir.chdir(@tmpdir)
9
+ end
10
+
11
+ after(:context) do
12
+ Dir.chdir(@current_dir)
13
+ FileUtils.remove_entry_secure(@tmpdir)
14
+ end
15
+
16
+ context "without parameters and 'bosh-' preffix" do
17
+ let(:plugin_folder) { File.join(Dir.pwd, 'magic') }
18
+
19
+ before(:all) do
20
+ system("bosh generate plugin magic > /dev/null")
21
+ end
22
+
23
+ it "creates gem with 'bosh-' prefix" do
24
+ gemspec_file = File.join(plugin_folder, 'bosh-magic.gemspec')
25
+ expect(File).to exist(gemspec_file)
26
+ expect(File.read(gemspec_file)).to match(/bosh-magic/)
27
+ end
28
+
29
+ it "generates gemspec with email from Git setup" do
30
+ expect(File.read("#{plugin_folder}/bosh-magic.gemspec")).to include(Git.global_config["user.name"])
31
+ expect(File.read("#{plugin_folder}/bosh-magic.gemspec")).to include(Git.global_config["user.email"])
32
+ end
33
+
34
+ it "has no license file" do
35
+ expect(File).not_to exist(File.join(plugin_folder, 'LICENSE'))
36
+ end
37
+
38
+ end
39
+
40
+ context "with parameters, license and 'bosh-' prefix" do
41
+ let(:plugin_folder) { File.join(Dir.pwd, 'bosh-magic') }
42
+
43
+ before(:all) do
44
+ command = <<-CMD
45
+ bosh generate plugin bosh-magic --email=gandalf@email.com \
46
+ --author=Gandalf \
47
+ --license=mit > /dev/null
48
+ CMD
49
+ system(command)
50
+ end
51
+
52
+ it "creates folder with the name specified as plugin a name" do
53
+ expect(File).to exist(plugin_folder)
54
+ end
55
+
56
+ it "creates gem with 'bosh-' prefix" do
57
+ gemspec_file = File.join(plugin_folder, 'bosh-magic.gemspec')
58
+ expect(File).to exist(gemspec_file)
59
+ expect(File.read(gemspec_file)).to match(/bosh-magic/)
60
+ end
61
+
62
+ it "generates gemspec with correct email" do
63
+ expect(File.read("#{plugin_folder}/bosh-magic.gemspec")).to match(/gandalf@email.com/)
64
+ end
65
+
66
+ it "creates license file" do
67
+ expect(File).to exist(File.join(plugin_folder, 'LICENSE'))
68
+ end
69
+
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,17 @@
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
2
+
3
+ require "rubygems"
4
+ require "bundler"
5
+ Bundler.setup(:default, :test)
6
+
7
+ $:.unshift(File.expand_path("../../lib", __FILE__))
8
+
9
+ require "rspec/core"
10
+ require "rspec/its"
11
+
12
+ require "bosh/plugin_generator"
13
+
14
+ def asset_file(*path)
15
+ assets_file = File.expand_path("../assets", __FILE__)
16
+ File.join(assets_file, *path)
17
+ end
@@ -0,0 +1,36 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
35
+ .ruby-gemset
36
+ .ruby-version
data/templates/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bosh-plugin.gemspec
4
+ gemspec
@@ -0,0 +1,28 @@
1
+ # Bosh plugin generator
2
+
3
+ <%= description || "Short description here." %>
4
+
5
+ ## What is BOSH?
6
+ BOSH orchestrates initial deployments and ongoing updates that are: predictable, repeatable, reliable, self-healing, infrastructure-agnostic. You can take a look on [BOSH project on GitHub](https://github.com/cloudfoundry/bosh) and read more details in [docs](http://docs.cloudfoundry.org/bosh/).
7
+
8
+ ## How to install
9
+ ```
10
+ gem install <%= full_plugin_name %>
11
+ ```
12
+
13
+ ## How to use
14
+ ```
15
+ bosh say hello
16
+ ```
17
+
18
+ ## Contributing
19
+
20
+ 1. Fork it
21
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
22
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
23
+ 4. Push to the branch (`git push origin my-new-feature`)
24
+ 5. Create new Pull Request
25
+
26
+ ## Notes
27
+
28
+ Generated by [BOSH plugin generator](https://github.com/Altoros/bosh-plugin-generator)
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task :default => :spec
5
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,14 @@
1
+ require "bosh/<%= short_plugin_name %>"
2
+
3
+ module Bosh::Cli::Command
4
+ class <%= class_name %> < Base
5
+ include Bosh::<%= class_name %>::Helpers
6
+
7
+ usage "say hello"
8
+ desc "simple BOSH CLI plugin"
9
+ def perform
10
+ say_hello
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'bosh/<%= short_plugin_name %>/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "<%= full_plugin_name %>"
9
+ spec.version = Bosh::<%= class_name %>::VERSION
10
+ spec.authors = ["<%= author %>"]
11
+ spec.email = ["<%= email %>"]
12
+ spec.description = %q{<%= description %>}
13
+ spec.summary = %q{<%= description %>}
14
+ spec.homepage = "https://github.com/cloudfoundry/bosh"
15
+ <%- if license %>
16
+ spec.license = "<%= license.upcase %>"
17
+ <% end %>
18
+
19
+ spec.files = `git ls-files`.split($/)
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.required_ruby_version = '>= 2.0.0'
25
+
26
+ spec.add_runtime_dependency "bosh_cli", ">= 1.2682.0"
27
+ spec.add_runtime_dependency "bosh_common", ">= 1.2682.0"
28
+ spec.add_runtime_dependency "semi_semantic", "~> 1.1.0"
29
+ spec.add_runtime_dependency "membrane", "~> 1.1.0"
30
+ spec.add_runtime_dependency "git", "~> 1.2.6"
31
+
32
+ spec.add_development_dependency "bundler", "~> 1.6"
33
+ spec.add_development_dependency "rspec", "~> 3.1.0"
34
+ spec.add_development_dependency "rspec-its", '~> 1.1.0'
35
+ spec.add_development_dependency "rake"
36
+ spec.add_development_dependency "rubocop"
37
+ end
@@ -0,0 +1,11 @@
1
+ module Bosh
2
+ module <%= class_name %>
3
+ module Helpers
4
+
5
+ def say_hello
6
+ say "Hello, world!".make_green
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Bosh
2
+ module <%= class_name %>
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ Copyright <%= Date.today.year %> <%= "#{author} <#{email}>" %>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,15 @@
1
+ <%= description %>
2
+ Copyright (C) <%= Date.today.year %> <%= "#{author} <#{email}>" %>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or
7
+ (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -0,0 +1,8 @@
1
+ <%= description %>
2
+ Copyright (C) <%= Date.today.year %> <%= "#{author} <#{email}>" %>
3
+
4
+ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
5
+
6
+ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
7
+
8
+ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) <%= Date.today.year %> <%= "#{author} <#{email}>" %>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ require "cli/core_ext"
2
+ require "cli/validation"
3
+
4
+ module Bosh
5
+ module <%= class_name %>
6
+ include BoshExtensions
7
+ end
8
+ end
9
+
10
+
11
+ require "bosh/<%= short_plugin_name %>/helpers"
12
+ require "bosh/<%= short_plugin_name %>/version"
13
+ require "bosh/cli/commands/<%= short_plugin_name %>"
@@ -0,0 +1,3 @@
1
+ --format progress
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,11 @@
1
+ describe "bosh say hello" do
2
+
3
+ before do
4
+ system("bosh say hello > /dev/null")
5
+ end
6
+
7
+ it "exits without errors" do
8
+ expect($?.exitstatus).to eq(0)
9
+ end
10
+
11
+ end
@@ -0,0 +1,12 @@
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
2
+
3
+ require "rubygems"
4
+ require "bundler"
5
+ Bundler.setup(:default, :test)
6
+
7
+ $:.unshift(File.expand_path("../../lib", __FILE__))
8
+
9
+ require "rspec/core"
10
+ require "rspec/its"
11
+
12
+ require "bosh/<%= short_plugin_name %>"
metadata ADDED
@@ -0,0 +1,252 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bosh-plugin-generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alex Lomov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bosh_cli
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.2682.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.2682.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bosh_common
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2682.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2682.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: semi_semantic
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: membrane
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: git
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.2.6
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.2.6
83
+ - !ruby/object:Gem::Dependency
84
+ name: erubis
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.7.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.7.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.6'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.6'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 3.1.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 3.1.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec-its
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.1.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.1.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rake
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rspec-mocks
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ description: Create file system tree structure for BOSH plugin development.
182
+ email:
183
+ - lomov.as@gmail.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - ".gitignore"
189
+ - ".rmvrc"
190
+ - ".rspec"
191
+ - ".travis.yml"
192
+ - Gemfile
193
+ - Gemfile.lock
194
+ - README.md
195
+ - Rakefile
196
+ - bosh-plugin-generator.gemspec
197
+ - lib/bosh/cli/commands/plugin_generator.rb
198
+ - lib/bosh/plugin_generator.rb
199
+ - lib/bosh/plugin_generator/generator.rb
200
+ - lib/bosh/plugin_generator/helpers.rb
201
+ - lib/bosh/plugin_generator/version.rb
202
+ - spec/assets/simple-template.txt
203
+ - spec/plugin_generator/generator_spec.rb
204
+ - spec/plugin_generator_spec.rb
205
+ - spec/spec_helper.rb
206
+ - templates/.gitignore
207
+ - templates/Gemfile
208
+ - templates/README.md.erb
209
+ - templates/Rakefile
210
+ - templates/cli/commands/command.rb.erb
211
+ - templates/gemspec.erb
212
+ - templates/helpers_folder/helpers.rb.erb
213
+ - templates/helpers_folder/version.rb.erb
214
+ - templates/licenses/apache2.txt
215
+ - templates/licenses/gpl.txt
216
+ - templates/licenses/lgpl.txt
217
+ - templates/licenses/mit.txt
218
+ - templates/main.rb.erb
219
+ - templates/spec/.rspec
220
+ - templates/spec/command_spec.rb
221
+ - templates/spec/spec_helper.rb
222
+ homepage: http://altoros.com
223
+ licenses:
224
+ - MIT
225
+ metadata: {}
226
+ post_install_message:
227
+ rdoc_options: []
228
+ require_paths:
229
+ - lib
230
+ required_ruby_version: !ruby/object:Gem::Requirement
231
+ requirements:
232
+ - - ">="
233
+ - !ruby/object:Gem::Version
234
+ version: 2.0.0
235
+ required_rubygems_version: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - ">="
238
+ - !ruby/object:Gem::Version
239
+ version: '0'
240
+ requirements: []
241
+ rubyforge_project:
242
+ rubygems_version: 2.4.5
243
+ signing_key:
244
+ specification_version: 4
245
+ summary: This gem creates file system tree structure for BOSH plugin. BOSH installs
246
+ and updates software packages on large numbers of VMs over many IaaS providers with
247
+ the absolute minimum of configuration changes.
248
+ test_files:
249
+ - spec/assets/simple-template.txt
250
+ - spec/plugin_generator/generator_spec.rb
251
+ - spec/plugin_generator_spec.rb
252
+ - spec/spec_helper.rb