forked from gma/nesta
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
242 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in <%= @gem_name %>.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
README | ||
====== | ||
|
||
TODO: Explain what your plugin is for | ||
|
||
Installation | ||
------------ | ||
|
||
To use this plugin just add it to your Nesta project's `Gemfile` and | ||
then install it with Bundler: | ||
|
||
$ echo 'gem "<%= @gem_name %>"' >> Gemfile | ||
$ bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
def version | ||
version_file = File.join(File.dirname(__FILE__), "lib", name, "version.rb") | ||
contents = File.read(version_file) | ||
contents.match(/VERSION = ['"]([0-9a-z.-]+)['"].*$/) | ||
$1 | ||
end | ||
|
||
def name | ||
"<%= @gem_name %>" | ||
end | ||
|
||
def built_gem_path | ||
gem_packages = File.join(File.dirname(__FILE__), "pkg", "#{name}-*.gem") | ||
Dir[gem_packages].sort_by { |file| File.mtime(file) }.last | ||
end | ||
|
||
def already_tagged? | ||
`git tag`.split(/\n/).include?("v#{version}") | ||
end | ||
|
||
desc "Build #{name}-#{version}.gem into the pkg directory." | ||
task 'build' do | ||
`gem build -V #{File.join(File.dirname(__FILE__), "#{name}.gemspec")}` | ||
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), "pkg")) | ||
gem = Dir[File.join(File.dirname(__FILE__), "#{name}-*.gem")].sort_by{|f| File.mtime(f)}.last | ||
FileUtils.mv(gem, 'pkg') | ||
puts "#{name} #{version} built to #{built_gem_path}." | ||
end | ||
|
||
desc "Build and install #{name}-#{version}.gem into system gems." | ||
task 'install' => 'build' do | ||
`gem install '#{built_gem_path}' --local` | ||
end | ||
|
||
desc "Create tag v#{version} and build and push #{name}-#{version}.gem to Rubygems\n" \ | ||
"To prevent publishing in Rubygems use `gem_push=no rake release`" | ||
task 'release' => ['build', 'release:guard_clean', | ||
'release:source_control_push', 'release:rubygem_push'] do | ||
end | ||
|
||
task 'release:guard_clean' do | ||
if !system("git diff --exit-code") || !system("git diff-index --quiet --cached HEAD") | ||
puts "There are files that need to be committed first." | ||
exit(1) | ||
end | ||
end | ||
|
||
task 'release:source_control_push' do | ||
unless already_tagged? | ||
system "git tag -a -m 'Version #{version}' v#{version}" | ||
system 'git push' | ||
system 'git push --tags' | ||
end | ||
end | ||
|
||
task 'release:rubygem_push' do | ||
system "gem push #{built_gem_path}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.gem | ||
Gemfile.lock | ||
pkg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Nesta | ||
module Plugin | ||
module <%= module_name %> | ||
module Helpers | ||
# If your plugin needs any helper methods, add them here... | ||
end | ||
end | ||
end | ||
class App | ||
helpers Nesta::Plugin::<%= module_name %>::Helpers | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require "<%= @gem_name %>/version" | ||
|
||
Nesta::Plugin.register(__FILE__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Nesta | ||
module Plugin | ||
<%= nested_module_definition_with_version -%> | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- encoding: utf-8 -*- | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require "<%= @gem_name %>/version" | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "<%= @gem_name %>" | ||
spec.version = Nesta::Plugin::<%= module_name %>::VERSION | ||
spec.authors = ["TODO: Your name"] | ||
spec.email = ["TODO: Your email address"] | ||
spec.homepage = "" | ||
spec.summary = %q{TODO: Write a gem summary} | ||
spec.description = %q{TODO: Write a gem description} | ||
spec.license = "MIT" | ||
spec.rubyforge_project = "<%= @gem_name %>" | ||
spec.files = `git ls-files -z`.split("\x0") | ||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } | ||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | ||
spec.require_paths = ["lib"] | ||
# specify any dependencies here; for example: | ||
# spec.add_development_dependency "rspec" | ||
# spec.add_runtime_dependency "rest-client" | ||
spec.add_dependency("nesta", ">= 0.9.11") | ||
spec.add_development_dependency("rake") | ||
end |