aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/templates/newgem
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/templates/newgem')
-rw-r--r--lib/bundler/templates/newgem/.travis.yml.tt5
-rw-r--r--lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt74
-rw-r--r--lib/bundler/templates/newgem/Gemfile.tt6
-rw-r--r--lib/bundler/templates/newgem/LICENSE.txt.tt21
-rw-r--r--lib/bundler/templates/newgem/README.md.tt47
-rw-r--r--lib/bundler/templates/newgem/Rakefile.tt29
-rw-r--r--lib/bundler/templates/newgem/bin/console.tt14
-rw-r--r--lib/bundler/templates/newgem/bin/setup.tt8
-rw-r--r--lib/bundler/templates/newgem/exe/newgem.tt3
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt3
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/newgem.c.tt9
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/newgem.h.tt6
-rw-r--r--lib/bundler/templates/newgem/gitignore.tt21
-rw-r--r--lib/bundler/templates/newgem/lib/newgem.rb.tt12
-rw-r--r--lib/bundler/templates/newgem/lib/newgem/version.rb.tt7
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt46
-rw-r--r--lib/bundler/templates/newgem/rspec.tt2
-rw-r--r--lib/bundler/templates/newgem/spec/newgem_spec.rb.tt11
-rw-r--r--lib/bundler/templates/newgem/spec/spec_helper.rb.tt14
-rw-r--r--lib/bundler/templates/newgem/test/newgem_test.rb.tt11
-rw-r--r--lib/bundler/templates/newgem/test/test_helper.rb.tt4
21 files changed, 353 insertions, 0 deletions
diff --git a/lib/bundler/templates/newgem/.travis.yml.tt b/lib/bundler/templates/newgem/.travis.yml.tt
new file mode 100644
index 0000000000..fe0761cc23
--- /dev/null
+++ b/lib/bundler/templates/newgem/.travis.yml.tt
@@ -0,0 +1,5 @@
+sudo: false
+language: ruby
+rvm:
+ - <%= RUBY_VERSION %>
+before_install: gem install bundler -v <%= Bundler::VERSION %>
diff --git a/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt b/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt
new file mode 100644
index 0000000000..a3833d29d7
--- /dev/null
+++ b/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at <%= config[:email] %>. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/lib/bundler/templates/newgem/Gemfile.tt b/lib/bundler/templates/newgem/Gemfile.tt
new file mode 100644
index 0000000000..c114bd6665
--- /dev/null
+++ b/lib/bundler/templates/newgem/Gemfile.tt
@@ -0,0 +1,6 @@
+source "https://rubygems.org"
+
+git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
+
+# Specify your gem's dependencies in <%= config[:name] %>.gemspec
+gemspec
diff --git a/lib/bundler/templates/newgem/LICENSE.txt.tt b/lib/bundler/templates/newgem/LICENSE.txt.tt
new file mode 100644
index 0000000000..76ef4b0191
--- /dev/null
+++ b/lib/bundler/templates/newgem/LICENSE.txt.tt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) <%= Time.now.year %> <%= config[:author] %>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/lib/bundler/templates/newgem/README.md.tt b/lib/bundler/templates/newgem/README.md.tt
new file mode 100644
index 0000000000..edbe55dabe
--- /dev/null
+++ b/lib/bundler/templates/newgem/README.md.tt
@@ -0,0 +1,47 @@
+# <%= config[:constant_name] %>
+
+Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/<%= config[:namespaced_path] %>`. To experiment with that code, run `bin/console` for an interactive prompt.
+
+TODO: Delete this and the text above, and describe your gem
+
+## Installation
+
+Add this line to your application's Gemfile:
+
+```ruby
+gem '<%= config[:name] %>'
+```
+
+And then execute:
+
+ $ bundle
+
+Or install it yourself as:
+
+ $ gem install <%= config[:name] %>
+
+## Usage
+
+TODO: Write usage instructions here
+
+## Development
+
+After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
+
+To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
+
+## Contributing
+
+Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.<% end %>
+<% if config[:mit] -%>
+
+## License
+
+The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
+<% end -%>
+<% if config[:coc] -%>
+
+## Code of Conduct
+
+Everyone interacting in the <%= config[:constant_name] %> project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).
+<% end -%>
diff --git a/lib/bundler/templates/newgem/Rakefile.tt b/lib/bundler/templates/newgem/Rakefile.tt
new file mode 100644
index 0000000000..099da6f3ec
--- /dev/null
+++ b/lib/bundler/templates/newgem/Rakefile.tt
@@ -0,0 +1,29 @@
+require "bundler/gem_tasks"
+<% if config[:test] == "minitest" -%>
+require "rake/testtask"
+
+Rake::TestTask.new(:test) do |t|
+ t.libs << "test"
+ t.libs << "lib"
+ t.test_files = FileList["test/**/*_test.rb"]
+end
+
+<% elsif config[:test] == "rspec" -%>
+require "rspec/core/rake_task"
+
+RSpec::Core::RakeTask.new(:spec)
+
+<% end -%>
+<% if config[:ext] -%>
+require "rake/extensiontask"
+
+task :build => :compile
+
+Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
+ ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
+end
+
+task :default => [:clobber, :compile, :<%= config[:test_task] %>]
+<% else -%>
+task :default => :<%= config[:test_task] %>
+<% end -%>
diff --git a/lib/bundler/templates/newgem/bin/console.tt b/lib/bundler/templates/newgem/bin/console.tt
new file mode 100644
index 0000000000..a27f82430f
--- /dev/null
+++ b/lib/bundler/templates/newgem/bin/console.tt
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+
+require "bundler/setup"
+require "<%= config[:namespaced_path] %>"
+
+# You can add fixtures and/or initialization code here to make experimenting
+# with your gem easier. You can also use a different console, if you like.
+
+# (If you use this, don't forget to add pry to your Gemfile!)
+# require "pry"
+# Pry.start
+
+require "irb"
+IRB.start(__FILE__)
diff --git a/lib/bundler/templates/newgem/bin/setup.tt b/lib/bundler/templates/newgem/bin/setup.tt
new file mode 100644
index 0000000000..dce67d860a
--- /dev/null
+++ b/lib/bundler/templates/newgem/bin/setup.tt
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -euo pipefail
+IFS=$'\n\t'
+set -vx
+
+bundle install
+
+# Do any other automated setup that you need to do here
diff --git a/lib/bundler/templates/newgem/exe/newgem.tt b/lib/bundler/templates/newgem/exe/newgem.tt
new file mode 100644
index 0000000000..a8339bb79f
--- /dev/null
+++ b/lib/bundler/templates/newgem/exe/newgem.tt
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+
+require "<%= config[:namespaced_path] %>"
diff --git a/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt b/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt
new file mode 100644
index 0000000000..8cfc828f94
--- /dev/null
+++ b/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt
@@ -0,0 +1,3 @@
+require "mkmf"
+
+create_makefile(<%= config[:makefile_path].inspect %>)
diff --git a/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt b/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt
new file mode 100644
index 0000000000..8177c4d202
--- /dev/null
+++ b/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt
@@ -0,0 +1,9 @@
+#include "<%= config[:underscored_name] %>.h"
+
+VALUE rb_m<%= config[:constant_array].join %>;
+
+void
+Init_<%= config[:underscored_name] %>(void)
+{
+ rb_m<%= config[:constant_array].join %> = rb_define_module(<%= config[:constant_name].inspect %>);
+}
diff --git a/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt b/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt
new file mode 100644
index 0000000000..c6e420b66e
--- /dev/null
+++ b/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt
@@ -0,0 +1,6 @@
+#ifndef <%= config[:underscored_name].upcase %>_H
+#define <%= config[:underscored_name].upcase %>_H 1
+
+#include "ruby.h"
+
+#endif /* <%= config[:underscored_name].upcase %>_H */
diff --git a/lib/bundler/templates/newgem/gitignore.tt b/lib/bundler/templates/newgem/gitignore.tt
new file mode 100644
index 0000000000..573d76b4c2
--- /dev/null
+++ b/lib/bundler/templates/newgem/gitignore.tt
@@ -0,0 +1,21 @@
+/.bundle/
+/.yardoc
+/Gemfile.lock
+/_yardoc/
+/coverage/
+/doc/
+/pkg/
+/spec/reports/
+/tmp/
+<%- if config[:ext] -%>
+*.bundle
+*.so
+*.o
+*.a
+mkmf.log
+<%- end -%>
+<%- if config[:test] == "rspec" -%>
+
+# rspec failure tracking
+.rspec_status
+<%- end -%>
diff --git a/lib/bundler/templates/newgem/lib/newgem.rb.tt b/lib/bundler/templates/newgem/lib/newgem.rb.tt
new file mode 100644
index 0000000000..7d8ad90ab0
--- /dev/null
+++ b/lib/bundler/templates/newgem/lib/newgem.rb.tt
@@ -0,0 +1,12 @@
+require "<%= config[:namespaced_path] %>/version"
+<%- if config[:ext] -%>
+require "<%= config[:namespaced_path] %>/<%= config[:underscored_name] %>"
+<%- end -%>
+
+<%- config[:constant_array].each_with_index do |c, i| -%>
+<%= " " * i %>module <%= c %>
+<%- end -%>
+<%= " " * config[:constant_array].size %># Your code goes here...
+<%- (config[:constant_array].size-1).downto(0) do |i| -%>
+<%= " " * i %>end
+<%- end -%>
diff --git a/lib/bundler/templates/newgem/lib/newgem/version.rb.tt b/lib/bundler/templates/newgem/lib/newgem/version.rb.tt
new file mode 100644
index 0000000000..389daf5048
--- /dev/null
+++ b/lib/bundler/templates/newgem/lib/newgem/version.rb.tt
@@ -0,0 +1,7 @@
+<%- config[:constant_array].each_with_index do |c, i| -%>
+<%= " " * i %>module <%= c %>
+<%- end -%>
+<%= " " * config[:constant_array].size %>VERSION = "0.1.0"
+<%- (config[:constant_array].size-1).downto(0) do |i| -%>
+<%= " " * i %>end
+<%- end -%>
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
new file mode 100644
index 0000000000..caea7fe7be
--- /dev/null
+++ b/lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -0,0 +1,46 @@
+# coding: utf-8
+lib = File.expand_path("../lib", __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require "<%= config[:namespaced_path] %>/version"
+
+Gem::Specification.new do |spec|
+ spec.name = <%= config[:name].inspect %>
+ spec.version = <%= config[:constant_name] %>::VERSION
+ spec.authors = [<%= config[:author].inspect %>]
+ spec.email = [<%= config[:email].inspect %>]
+
+ spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
+ spec.description = %q{TODO: Write a longer description or delete this line.}
+ spec.homepage = "TODO: Put your gem's website or public repo URL here."
+<%- if config[:mit] -%>
+ spec.license = "MIT"
+<%- end -%>
+
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
+ if spec.respond_to?(:metadata)
+ spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
+ else
+ raise "RubyGems 2.0 or newer is required to protect against " \
+ "public gem pushes."
+ end
+
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
+ f.match(%r{^(test|spec|features)/})
+ end
+ spec.bindir = "exe"
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
+ spec.require_paths = ["lib"]
+<%- if config[:ext] -%>
+ spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
+<%- end -%>
+
+ spec.add_development_dependency "bundler", "~> <%= config[:bundler_version] %>"
+ spec.add_development_dependency "rake", "~> 10.0"
+<%- if config[:ext] -%>
+ spec.add_development_dependency "rake-compiler"
+<%- end -%>
+<%- if config[:test] -%>
+ spec.add_development_dependency "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
+<%- end -%>
+end
diff --git a/lib/bundler/templates/newgem/rspec.tt b/lib/bundler/templates/newgem/rspec.tt
new file mode 100644
index 0000000000..8c18f1abdd
--- /dev/null
+++ b/lib/bundler/templates/newgem/rspec.tt
@@ -0,0 +1,2 @@
+--format documentation
+--color
diff --git a/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt b/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt
new file mode 100644
index 0000000000..b7ef7f9e4a
--- /dev/null
+++ b/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt
@@ -0,0 +1,11 @@
+require "spec_helper"
+
+RSpec.describe <%= config[:constant_name] %> do
+ it "has a version number" do
+ expect(<%= config[:constant_name] %>::VERSION).not_to be nil
+ end
+
+ it "does something useful" do
+ expect(false).to eq(true)
+ end
+end
diff --git a/lib/bundler/templates/newgem/spec/spec_helper.rb.tt b/lib/bundler/templates/newgem/spec/spec_helper.rb.tt
new file mode 100644
index 0000000000..805cf57e01
--- /dev/null
+++ b/lib/bundler/templates/newgem/spec/spec_helper.rb.tt
@@ -0,0 +1,14 @@
+require "bundler/setup"
+require "<%= config[:namespaced_path] %>"
+
+RSpec.configure do |config|
+ # Enable flags like --only-failures and --next-failure
+ config.example_status_persistence_file_path = ".rspec_status"
+
+ # Disable RSpec exposing methods globally on `Module` and `main`
+ config.disable_monkey_patching!
+
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ end
+end
diff --git a/lib/bundler/templates/newgem/test/newgem_test.rb.tt b/lib/bundler/templates/newgem/test/newgem_test.rb.tt
new file mode 100644
index 0000000000..f2af9f90e0
--- /dev/null
+++ b/lib/bundler/templates/newgem/test/newgem_test.rb.tt
@@ -0,0 +1,11 @@
+require "test_helper"
+
+class <%= config[:constant_name] %>Test < Minitest::Test
+ def test_that_it_has_a_version_number
+ refute_nil ::<%= config[:constant_name] %>::VERSION
+ end
+
+ def test_it_does_something_useful
+ assert false
+ end
+end
diff --git a/lib/bundler/templates/newgem/test/test_helper.rb.tt b/lib/bundler/templates/newgem/test/test_helper.rb.tt
new file mode 100644
index 0000000000..725e3e4647
--- /dev/null
+++ b/lib/bundler/templates/newgem/test/test_helper.rb.tt
@@ -0,0 +1,4 @@
+$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
+require "<%= config[:namespaced_path] %>"
+
+require "minitest/autorun"