testcloud-generator 0.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.envrc +1 -0
  3. data/.gitignore +15 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +31 -0
  7. data/Rakefile +2 -0
  8. data/bin/testcloud_generator +6 -0
  9. data/lib/testcloud/generator/cli.rb +28 -0
  10. data/lib/testcloud/generator/commands/.gem.rb.swp +0 -0
  11. data/lib/testcloud/generator/commands/base.rb +39 -0
  12. data/lib/testcloud/generator/commands/gem.rb +142 -0
  13. data/lib/testcloud/generator/commands.rb +8 -0
  14. data/lib/testcloud/generator/gem_version.rb +15 -0
  15. data/lib/testcloud/generator/templates/newgem/.envrc +1 -0
  16. data/lib/testcloud/generator/templates/newgem/.rspec +2 -0
  17. data/lib/testcloud/generator/templates/newgem/Gemfile.tt +28 -0
  18. data/lib/testcloud/generator/templates/newgem/LICENSE.txt +22 -0
  19. data/lib/testcloud/generator/templates/newgem/bin/console.tt +12 -0
  20. data/lib/testcloud/generator/templates/newgem/bin/cucumber.tt +16 -0
  21. data/lib/testcloud/generator/templates/newgem/bin/puma.tt +16 -0
  22. data/lib/testcloud/generator/templates/newgem/bin/rake.tt +16 -0
  23. data/lib/testcloud/generator/templates/newgem/bin/rspec.tt +16 -0
  24. data/lib/testcloud/generator/templates/newgem/config.ru.tt +7 -0
  25. data/lib/testcloud/generator/templates/newgem/features/support/env.rb.tt +4 -0
  26. data/lib/testcloud/generator/templates/newgem/lib/newgem/api/application.rb.tt +22 -0
  27. data/lib/testcloud/generator/templates/newgem/lib/newgem/api/endpoint.rb.tt +13 -0
  28. data/lib/testcloud/generator/templates/newgem/lib/newgem/api.rb.tt +21 -0
  29. data/lib/testcloud/generator/templates/newgem/lib/newgem/gem_version.rb.tt +15 -0
  30. data/lib/testcloud/generator/templates/newgem/lib/newgem/params.rb.tt +9 -0
  31. data/lib/testcloud/generator/templates/newgem/lib/newgem/setup.rb.tt +11 -0
  32. data/lib/testcloud/generator/templates/newgem/lib/newgem/use_cases.rb.tt +10 -0
  33. data/lib/testcloud/generator/templates/newgem/lib/newgem/version.rb.tt +15 -0
  34. data/lib/testcloud/generator/templates/newgem/lib/newgem.rb.tt +23 -0
  35. data/lib/testcloud/generator/templates/newgem/lib/newgem_shortcut.rb.tt +1 -0
  36. data/lib/testcloud/generator/templates/newgem/newgem.gemspec.tt +30 -0
  37. data/lib/testcloud/generator/templates/newgem/spec/spec_helper.rb.tt +11 -0
  38. data/lib/testcloud/generator/version.rb +13 -0
  39. data/lib/testcloud/generator.rb +7 -0
  40. data/lib/testcloud_generator.rb +1 -0
  41. data/testcloud-generator.gemspec +23 -0
  42. metadata +127 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f5dc121f9fb7175f346a421951721f3a97ef9d57
4
+ data.tar.gz: ee08115348a14a8fd58e9e9d3baa27e0177dfe0c
5
+ SHA512:
6
+ metadata.gz: 41773911c4540719038e825c677e99a0d2ea4e986960532ec0fa78db8d2bfff757e78869166cbfd5ed68d356510c9e188d253637483eca99bac6c62aab2c1818
7
+ data.tar.gz: 995a8a3c75c46c55e0336d36ece1cc7a3662bcd3ed8c8083b53002915c4475d336288fc6112bf978693db9fa1f2a0162dfcf2fdbcd68f964074b94d7d37ce886
data/.envrc ADDED
@@ -0,0 +1 @@
1
+ export PATH=$PWD/bin:$PATH
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in testcloud-generator.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 John Faucett
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Testcloud::Generator
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'testcloud-generator'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install testcloud-generator
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/testcloud-generator/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+ require 'testcloud_generator'
5
+
6
+ Testcloud::Generator::CLI.start
@@ -0,0 +1,28 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+ module Testcloud
4
+ module Generator
5
+ class CLI < Thor
6
+ include Thor::Actions
7
+ source_root(File.expand_path("../templates", __FILE__))
8
+ attr_reader :command
9
+
10
+ option :rack, type: :boolean
11
+ option :core, type: :boolean
12
+ option :jobs, type: :boolean
13
+ desc 'gem NAME', 'create a new testcloud gem having NAME'
14
+
15
+ def gem(gem_name)
16
+ @command = Testcloud::Generator::Commands::Gem.new(options.merge(gemname: gem_name), self)
17
+ @command.run
18
+ end
19
+
20
+ no_commands do
21
+ def config
22
+ command and command.template_options
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,39 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+ module Testcloud
4
+ module Generator
5
+ module Commands
6
+ class Base
7
+ attr_reader :parsed_options, :template_options, :thor
8
+ attr_accessor :options
9
+ def initialize(options = {}, thor)
10
+ @options = options
11
+ @thor = thor
12
+ @template_options = {}
13
+ end
14
+
15
+ def confirmation_prompt
16
+ end
17
+
18
+ def run
19
+ confirmation_prompt
20
+ execute_command
21
+ end
22
+
23
+ def execute_command
24
+ raise 'Implement'
25
+ end
26
+
27
+ def readline
28
+ $stdin.gets.chomp!
29
+ end
30
+
31
+ def abort_command(msg = nil)
32
+ $stdout.printf "aborting %s ...\n" % msg.to_s
33
+ exit(1)
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,142 @@
1
+ require 'fileutils'
2
+
3
+ module Testcloud
4
+ module Generator
5
+ module Commands
6
+ class Gem < Base
7
+
8
+ def confirmation_prompt
9
+ gemname = "testcloud-#{options['gemname']}"
10
+ options['gemname'] = gemname
11
+ $stdout.printf "Gem will be called: #{options['gemname']}\n"
12
+ show_options
13
+ $stdout.printf 'Is this correct? [y/n]: '
14
+ abort_command if readline != 'y'
15
+ end
16
+
17
+ def execute_command
18
+ name = options['gemname']
19
+ underscore_name = name.tr('-', '_')
20
+ namespace_path = name.tr('-', '/')
21
+ constant_name = name.split('-').map { |c| c[0..0].upcase + c[1..-1] }.join('::')
22
+ constant_array = constant_name.split('::')
23
+ gem_email = 'team@testcloud.io'
24
+ gem_author = 'testCloud Team'
25
+ target = File.join(Dir.pwd, name)
26
+
27
+ @template_options = {
28
+ 'name' => name,
29
+ 'underscore_name' => underscore_name,
30
+ 'constant_name' => constant_name,
31
+ 'constant_array' => constant_array,
32
+ 'author' => gem_author,
33
+ 'email' => gem_email,
34
+ 'namespace_path' => namespace_path,
35
+ 'core' => options.fetch('core') { false },
36
+ 'rack' => options.fetch('rack') { false },
37
+ 'jobs' => options.fetch('jobs') { false }
38
+ }
39
+
40
+ # fixme: don't overwrite the options again :(
41
+ options = @template_options
42
+
43
+ templates = {
44
+ 'Gemfile.tt' => 'Gemfile',
45
+ 'gitignore.tt' => '.gitignore',
46
+ 'lib/newgem.rb.tt' => "lib/#{namespace_path}.rb",
47
+ 'lib/newgem_shortcut.rb.tt' => "lib/#{underscore_name}.rb",
48
+ 'lib/newgem/gem_version.rb.tt' => "lib/#{namespace_path}/gem_version.rb",
49
+ 'lib/newgem/version.rb.tt' => "lib/#{namespace_path}/version.rb",
50
+ 'lib/newgem/setup.rb.tt' => "lib/#{namespace_path}/setup.rb",
51
+ 'LICENSE.txt.tt' => 'LICENSE.txt',
52
+
53
+ # testing
54
+ 'spec/spec_helper.rb.tt' => "spec/spec_helper.rb",
55
+ 'features/support/env.rb.tt' => 'features/support/env.rb',
56
+
57
+ # rack
58
+ 'config.ru.tt' => 'config.ru',
59
+ 'newgem/lib/newgem/api.rb.tt' => "lib/#{namespace_path}/api.rb",
60
+ 'newgem/lib/newgem/api/application.rb.tt' => "lib/#{namespace_path}/api/application.rb",
61
+ 'newgem/lib/newgem/api/endpoint.rb.tt' => "lib/#{namespace_path}/api/endpoint.rb",
62
+
63
+ # core
64
+ 'newgem/lib/newgem/params.rb.tt' => "lib/#{namespace_path}/params.rb",
65
+ 'newgem/lib/newgem/use_cases.rb.tt' => "lib/#{namespace_path}/use_cases.rb",
66
+ 'newgem/bin/console.tt' => "bin/console"
67
+ }
68
+
69
+ gemspec_dest = File.join(target, "#{name}.gemspec")
70
+
71
+ # basic required files
72
+ thor.template('newgem/Gemfile.tt', File.join(target, "Gemfile"), options)
73
+ thor.template('newgem/LICENSE.txt', File.join(target, "LICENSE.txt"), options)
74
+ thor.template('newgem/newgem.gemspec.tt', gemspec_dest, options)
75
+ thor.template('newgem/lib/newgem.rb.tt', File.join(target, templates['lib/newgem.rb.tt']), options)
76
+ thor.template('newgem/lib/newgem_shortcut.rb.tt', File.join(target, templates['lib/newgem_shortcut.rb.tt']), options)
77
+ thor.template('newgem/lib/newgem/version.rb.tt', File.join(target, templates['lib/newgem/version.rb.tt']), options)
78
+ thor.template('newgem/lib/newgem/gem_version.rb.tt', File.join(target, templates['lib/newgem/gem_version.rb.tt']), options)
79
+ thor.template('newgem/lib/newgem/setup.rb.tt', File.join(target, templates['lib/newgem/setup.rb.tt']), options)
80
+
81
+ # testing files
82
+ thor.template('newgem/spec/spec_helper.rb.tt', File.join(target, templates['spec/spec_helper.rb.tt']), options)
83
+ thor.template('newgem/features/support/env.rb.tt', File.join(target, templates['features/support/env.rb.tt']), options)
84
+
85
+ # api/rack files
86
+ if options['rack']
87
+ thor.template('newgem/config.ru.tt', File.join(target, 'config.ru'), options)
88
+ thor.template('newgem/lib/newgem/api.rb.tt', File.join(target, templates['newgem/lib/newgem/api.rb.tt']), options)
89
+ thor.template('newgem/lib/newgem/api/application.rb.tt', File.join(target, templates['newgem/lib/newgem/api/application.rb.tt']), options)
90
+ thor.template('newgem/lib/newgem/api/endpoint.rb.tt', File.join(target, templates['newgem/lib/newgem/api/endpoint.rb.tt']), options)
91
+ ["lib/#{namespace_path}/api/resources"].each { |path| FileUtils.mkdir(File.join(target, path)) }
92
+ end
93
+
94
+ # core dependencies
95
+ if options['core']
96
+ thor.template('newgem/lib/newgem/params.rb.tt', File.join(target, templates['newgem/lib/newgem/params.rb.tt']), options)
97
+ thor.template('newgem/lib/newgem/use_cases.rb.tt', File.join(target, templates['newgem/lib/newgem/use_cases.rb.tt']), options)
98
+ ["lib/#{namespace_path}/params", "lib/#{namespace_path}/use_cases"].each { |path| FileUtils.mkdir(File.join(target, path)) }
99
+ end
100
+
101
+ # binary files
102
+ ['cucumber', 'rspec', 'rake', 'puma', 'console'].each do |executable|
103
+ executable_path = File.join(target, "bin/#{executable}")
104
+
105
+ case executable
106
+ when 'cucumber', 'rspec', 'rake'
107
+ thor.template("newgem/bin/#{executable}.tt", executable_path, options)
108
+ FileUtils.chmod('+x', executable_path)
109
+ when 'console'
110
+ if options['core']
111
+ thor.template("newgem/bin/#{executable}.tt", executable_path, options)
112
+ FileUtils.chmod('+x', executable_path)
113
+ end
114
+ when 'puma'
115
+ if options['core']
116
+ thor.template("newgem/bin/#{executable}.tt", executable_path, options)
117
+ FileUtils.chmod('+x', executable_path)
118
+ end
119
+ end
120
+ end
121
+
122
+ # config files
123
+ thor.template('newgem/.envrc', File.join(target, '.envrc'), options)
124
+ thor.template('newgem/.rspec', File.join(target, '.rspec'), options)
125
+
126
+ # All files are copied, let's initialize a new git repo
127
+ Dir.chdir(target) do
128
+ $stdout.printf "Initializing git repo in #{target}"
129
+ `git init && git add .`
130
+ end
131
+ end
132
+
133
+ def show_options
134
+ options.keys.select { |o| o != 'gemname' }.each do |key|
135
+ $stdout.printf "* using #{key}\n" if options[key]
136
+ end
137
+ end
138
+
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,8 @@
1
+ module Testcloud
2
+ module Generator
3
+ module Commands
4
+ require 'testcloud/generator/commands/base'
5
+ require 'testcloud/generator/commands/gem'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ module Testcloud
2
+ module Generator
3
+ module VERSION
4
+ def self.gem_version
5
+ @gem_version ||= Gem::Version.new(STRING)
6
+ end
7
+
8
+ MAJOR = 0
9
+ MINOR = 0
10
+ PATCH = 0
11
+ PRE = 1
12
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
13
+ end
14
+ end
15
+ end
@@ -0,0 +1 @@
1
+ export PATH=$PWD/bin:$PATH
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,28 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+ gem 'testcloud-support', git: 'git@github.com:testCloud/testcloud-support.git', branch: 'master'
5
+
6
+ <% if config['core'] -%>
7
+ gem 'testcloud-core', path: '../testcloud-core'
8
+ <% end -%>
9
+ <% if config['jobs'] -%>
10
+ gem 'testcloud-jobs', path: '../testcloud-jobs'
11
+ <% end -%>
12
+
13
+ group :development do
14
+ gem 'pry'
15
+ <% if config["rack"] -%>
16
+ gem 'foreman'
17
+ gem 'puma', '~> 2.9.0'
18
+ <% end -%>
19
+ end
20
+
21
+ group :test do
22
+ gem 'cucumber', '~> 1.3.16'
23
+ gem 'rspec', '~> 3.0.0'
24
+ gem 'shoulda', '~> 3.5.0'
25
+ <% if config["rack"] -%>
26
+ gem 'rack-test'
27
+ <% end -%>
28
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 John Faucett
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require '<%= config['underscore_name'] %>'
5
+
6
+ <% if config['core'] -%>
7
+ require 'testcloud/core/booter'
8
+ Testcloud::Core::Booter.initialize!(true)
9
+ <% else -%>
10
+ require 'pry'
11
+ Pry::CLI.parse_options
12
+ <% end -%>
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('cucumber', 'cucumber')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -0,0 +1,7 @@
1
+ require '<%= config['underscore_name'] %>'
2
+
3
+ <% if config['core'] -%>
4
+ require 'testcloud/core/booter'
5
+ Testcloud::Core::Booter.initialize!
6
+ <% end -%>
7
+ run <%= config['constant_name'] %>::API.app
@@ -0,0 +1,4 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $:.unshift(lib) unless $:.include?(lib)
3
+
4
+ require '<%= config['underscore_name'] %>'
@@ -0,0 +1,22 @@
1
+ module <%= config['constant_array'].first %>
2
+ module <%= config['constant_array'].last %>
3
+ module API
4
+ class Application < Testcloud::API::AbstractApplication
5
+
6
+ protected
7
+ def define_application
8
+ @app ||= Rack::Builder.new do
9
+
10
+ # use SomeRackMiddleware
11
+
12
+ map '/' do
13
+ run <%= config['constant_name'] %>::API::Endpoint
14
+ end
15
+
16
+ end.to_app
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ module <%= config['constant_array'].first %>
2
+ module <%= config['constant_array'].last %>
3
+ module API
4
+ class Endpoint < Grape::API
5
+ extend Testcloud::API::Endpoint
6
+
7
+ # Resources
8
+ # mount <%= config['constant_name'] %>::API::Resources::YourNewResource
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require 'rack'
2
+ require 'testcloud/api'
3
+
4
+ module <%= config['constant_array'].first %>
5
+ module <%= config['constant_array'].last %>
6
+ module API
7
+ extend ActiveSupport::Autoload
8
+ include Testcloud::API::Entry
9
+
10
+ autoload :Application
11
+ autoload :Endpoint
12
+
13
+ module Resources
14
+ extend ActiveSupport::Autoload
15
+ end
16
+
17
+ # add entry point for rackapp
18
+ app <%= config['constant_name'] %>::API::Application
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ module <%= config['constant_array'].first %>
2
+ module <%= config['constant_array'].last %>
3
+ module VERSION
4
+ def self.gem_version
5
+ @gem_version ||= Gem::Version.new(STRING)
6
+ end
7
+
8
+ MAJOR = 0
9
+ MINOR = 0
10
+ PATCH = 0
11
+ PRE = nil
12
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ module <%= config['constant_array'].first %>
2
+ module <%= config['constant_array'].last %>
3
+ module Params
4
+ extend ActiveSupport::Autoload
5
+
6
+ # autoload :TesterAddCommentExample
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module <%= config['constant_array'].first %>
2
+ module <%= config['constant_array'].last %>
3
+ class << self
4
+ def setup
5
+ <% if config['core'] %>
6
+ <%= config['constant_name'] %>::UseCases.register
7
+ <% end %>
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module <%= config['constant_array'].first %>
2
+ module <%= config['constant_array'].last %>
3
+ module UseCases
4
+ extend ActiveSupport::Autoload
5
+ extend Testcloud::UseCases::Append
6
+
7
+ # autoload :TesterAddCommentExample
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'gem_version'
2
+
3
+ module <%= config['constant_array'].first %>
4
+ module <%= config['constant_array'].last %>
5
+ class << self
6
+ def gem_version
7
+ VERSION.gem_version
8
+ end
9
+
10
+ def version
11
+ VERSION::STRING
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ require 'testcloud_support'
2
+ <% if config['core'] %>
3
+ require 'testcloud/params/base'
4
+ require 'testcloud/use_cases'
5
+ <% end %>
6
+
7
+ module <%= config['constant_array'].first %>
8
+ module <%= config['constant_array'].last %>
9
+ extend ActiveSupport::Autoload
10
+
11
+ <% if config['rack'] -%>
12
+ autoload :API, '<%= config['namespace_path'] %>/api'
13
+ <% end %>
14
+
15
+ <% if config['core'] -%>
16
+ require '<%= config['namespace_path'] %>/params'
17
+ require '<%= config['namespace_path'] %>/use_cases'
18
+ <% end -%>
19
+ require '<%= config['namespace_path'] %>/setup'
20
+
21
+ setup
22
+ end
23
+ end
@@ -0,0 +1 @@
1
+ require '<%= config['namespace_path'] %>'
@@ -0,0 +1,30 @@
1
+ $:.unshift File.expand_path('../lib', __FILE__)
2
+ require '<%= config['namespace_path'] %>/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+
6
+ # metadata
7
+ spec.name = '<%= config['name'] %>'
8
+ spec.version = <%= config['constant_name'] %>.version
9
+ spec.authors = ['<%= config['author'] %>']
10
+ spec.email = ['<%= config['email'] %>']
11
+ spec.summary = %q{TODO: write a summary}
12
+ spec.description = %q{TODO: write a description}
13
+ spec.homepage = 'https://testcloud.io'
14
+ spec.license = 'MIT'
15
+ spec.platform = Gem::Platform::RUBY
16
+
17
+ # files
18
+ spec.require_paths = ['lib']
19
+ spec.files = Dir['lib/**/*', 'spec/**/*', '[A-Z]*']
20
+ spec.test_files = spec.files.grep(%r{^(spec|features)/})
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+
23
+ # dependencies
24
+ spec.add_development_dependency 'bundler', '~> 1.7'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+
27
+ <% if config['rack'] -%>
28
+ spec.add_runtime_dependency 'rack', '~> 1.5.2'
29
+ <% end -%>
30
+ end
@@ -0,0 +1,11 @@
1
+ ENV['TESTCLOUD_ENV'] = ENV['RAILS_ENV'] = 'test'
2
+
3
+ require 'bundler/setup'
4
+ <% if config['config'] -%>
5
+ require 'testcloud/core/booter'
6
+ Testcloud::Core::Booter.initialize!
7
+ <% end -%>
8
+
9
+ RSpec.configure do |config|
10
+
11
+ end
@@ -0,0 +1,13 @@
1
+ require_relative 'gem_version'
2
+
3
+ module Testcloud
4
+ module Generator
5
+ def self.gem_version
6
+ VERSION.gem_version
7
+ end
8
+
9
+ def self.version
10
+ VERSION::STRING
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module Testcloud
2
+ module Generator
3
+
4
+ autoload :CLI, 'testcloud/generator/cli'
5
+ autoload :Commands, 'testcloud/generator/commands'
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ require 'testcloud/generator'
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+ $:.unshift File.expand_path('../lib', __FILE__)
3
+ require 'testcloud/generator/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'testcloud-generator'
7
+ spec.version = Testcloud::Generator.version
8
+ spec.authors = ['testCloud Team']
9
+ spec.email = ['team@testcloud.io']
10
+ spec.summary = 'Generators at testCloud'
11
+ spec.description = 'Generators and command line helpers for working with gems'
12
+ spec.homepage = 'https://testcloud.io'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = ['testcloud_generator']
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_development_dependency 'bundler', '~> 1.7'
20
+ spec.add_development_dependency 'rake', '~> 10.0'
21
+
22
+ spec.add_runtime_dependency 'thor', '~> 0.19'
23
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: testcloud-generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - testCloud Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.19'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.19'
55
+ description: Generators and command line helpers for working with gems
56
+ email:
57
+ - team@testcloud.io
58
+ executables:
59
+ - testcloud_generator
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".envrc"
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/testcloud_generator
70
+ - lib/testcloud/generator.rb
71
+ - lib/testcloud/generator/cli.rb
72
+ - lib/testcloud/generator/commands.rb
73
+ - lib/testcloud/generator/commands/.gem.rb.swp
74
+ - lib/testcloud/generator/commands/base.rb
75
+ - lib/testcloud/generator/commands/gem.rb
76
+ - lib/testcloud/generator/gem_version.rb
77
+ - lib/testcloud/generator/templates/newgem/.envrc
78
+ - lib/testcloud/generator/templates/newgem/.rspec
79
+ - lib/testcloud/generator/templates/newgem/Gemfile.tt
80
+ - lib/testcloud/generator/templates/newgem/LICENSE.txt
81
+ - lib/testcloud/generator/templates/newgem/bin/console.tt
82
+ - lib/testcloud/generator/templates/newgem/bin/cucumber.tt
83
+ - lib/testcloud/generator/templates/newgem/bin/puma.tt
84
+ - lib/testcloud/generator/templates/newgem/bin/rake.tt
85
+ - lib/testcloud/generator/templates/newgem/bin/rspec.tt
86
+ - lib/testcloud/generator/templates/newgem/config.ru.tt
87
+ - lib/testcloud/generator/templates/newgem/features/support/env.rb.tt
88
+ - lib/testcloud/generator/templates/newgem/lib/newgem.rb.tt
89
+ - lib/testcloud/generator/templates/newgem/lib/newgem/api.rb.tt
90
+ - lib/testcloud/generator/templates/newgem/lib/newgem/api/application.rb.tt
91
+ - lib/testcloud/generator/templates/newgem/lib/newgem/api/endpoint.rb.tt
92
+ - lib/testcloud/generator/templates/newgem/lib/newgem/gem_version.rb.tt
93
+ - lib/testcloud/generator/templates/newgem/lib/newgem/params.rb.tt
94
+ - lib/testcloud/generator/templates/newgem/lib/newgem/setup.rb.tt
95
+ - lib/testcloud/generator/templates/newgem/lib/newgem/use_cases.rb.tt
96
+ - lib/testcloud/generator/templates/newgem/lib/newgem/version.rb.tt
97
+ - lib/testcloud/generator/templates/newgem/lib/newgem_shortcut.rb.tt
98
+ - lib/testcloud/generator/templates/newgem/newgem.gemspec.tt
99
+ - lib/testcloud/generator/templates/newgem/spec/spec_helper.rb.tt
100
+ - lib/testcloud/generator/version.rb
101
+ - lib/testcloud_generator.rb
102
+ - testcloud-generator.gemspec
103
+ homepage: https://testcloud.io
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.2.0
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Generators at testCloud
127
+ test_files: []