gemma 5.0.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5de5140af28c81d37e8fd0c866a7f6c8ff3477e25c8ef4ebda025e394c7f8458
4
- data.tar.gz: 8dcf3341ec3906930d3e97c719f4810b7242ebb4a72eb8aae7ff25046e2f74be
3
+ metadata.gz: fce7a63071e7da6293940d6de9edb2b6f1bf83541ebef9fc8ea79a3f78afd85d
4
+ data.tar.gz: ea7cd9b6f702182b3e0c72320357fa08a1d030f8298b531bbc18f78d4e06da28
5
5
  SHA512:
6
- metadata.gz: 418f976c89b423d4611e40a08664773710df3f49c50179e922beb5eb3b79d998cb5c0800996a7de53171b16d79f85ad7a8e94ea1f39760bf8ceaf3ef81f1e691
7
- data.tar.gz: 76187653c72259c71f3f48af09c35cfab72562c63c35b63d82131a6424dc87b671e74368bd9955db14b18ae3e3ad729a5f1bf5deaee58f4f7cb1a169c419b854
6
+ metadata.gz: 168d3c1e0f760239bf411e7fb4aab922b6bba58c6bda534e49e012eafe436188e8178ec3cb2051d3ec1cb707ff06c18c45a279c3bb74239b18fae4d99e5bc733
7
+ data.tar.gz: 74218ae6523f60523e732d9c9830b729a81f9289dc1e885a480f32022740dbd6cb7bd7c64f240e8f3043145f40df8d9f135777105e917411abc93438066bfcbc
data/README.md ADDED
@@ -0,0 +1,213 @@
1
+ # gemma
2
+
3
+ https://github.com/jdleesmiller/gemma
4
+
5
+ https://github.com/jdleesmiller/gemma/wiki
6
+
7
+ [![Build Status](https://github.com/jdleesmiller/gemma/actions/workflows/ci.yml/badge.svg)](https://github.com/jdleesmiller/gemma/actions/workflows/ci.yml)
8
+ [![Gem Version](https://badge.fury.io/rb/gemma.png)](http://badge.fury.io/rb/gemma)
9
+
10
+ ## SYNOPSIS
11
+
12
+ Gemma is a gem development helper like hoe and jeweler, but it keeps the
13
+ `gemspec` in a `.gemspec` file, instead of in a `Rakefile`. This helps
14
+ your gem to play nicely with commands like `gem` and `bundle`, and it allows
15
+ gemma to provide `rake` tasks with sensible defaults for many common gem
16
+ development tasks.
17
+
18
+ See [this blog post](http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended) for some reasons
19
+ why you probably want a `.gemspec` file in your gem's repository.
20
+
21
+ ### Usage
22
+
23
+ See the project wiki for tutorials and guides:
24
+ https://github.com/jdleesmiller/gemma/wiki
25
+
26
+ Briefly:
27
+
28
+ #### Create a New Gem
29
+
30
+ Gemma has a simple interactive gem scaffolding tool; run
31
+
32
+ ```sh
33
+ gemma new
34
+ ```
35
+
36
+ and follow the prompts. (Run with -h for help.)
37
+
38
+ This gives you a simple gem template like the following:
39
+
40
+ ```
41
+ my_gem
42
+ |-- bin
43
+ | `-- my_gem # executable (optional)
44
+ |-- Gemfile # for bundler (see below)
45
+ |-- lib
46
+ | |-- my_gem # most of your code goes here
47
+ | | `-- version.rb # the version constant
48
+ | `-- my_gem.rb # the main code file
49
+ |-- my_gem.gemspec # gem metadata
50
+ |-- Rakefile # development tasks
51
+ |-- README.md # documentation
52
+ `-- test # unit tests go here
53
+ `-- my_gem
54
+ `-- my_gem_test.rb
55
+ ```
56
+
57
+ Things you need to change in the template are marked with a `TODO` tag.
58
+
59
+ #### To Modify an Existing Gem to use Gemma
60
+
61
+ The main thing you need is a `.gemspec` file. If you have been using hoe
62
+ or jeweler, you already have all of the information in your Rakefile, so you
63
+ just have to move it into a `.gemspec` file.
64
+
65
+ Gemma provides rake tasks with sensible defaults based on the contents of
66
+ your gemspec; to enable them, add the following to the top of your `Rakefile`:
67
+
68
+ ```ruby
69
+ require 'rubygems'
70
+ require 'bundler/setup'
71
+ require 'gemma'
72
+
73
+ Gemma::RakeTasks.with_gemspec_file 'my_gem.gemspec'
74
+
75
+ task default: :test
76
+ ```
77
+
78
+ This gives you some standard rake tasks, in addition to any that you define
79
+ yourself.
80
+
81
+ #### The Standard Tasks
82
+
83
+ Run `rake -T` for a full list of tasks.
84
+
85
+ ```
86
+ rake build # Build my_gem-0.0.1.gem into the pkg directory
87
+ rake clean # Remove any temporary products.
88
+ rake clobber # Remove any generated file.
89
+ rake clobber_rdoc # Remove RDoc HTML files
90
+ rake install # Build and install my_gem-0.0.1.gem into system gems
91
+ rake rdoc # Build RDoc HTML files
92
+ rake release # Create tag v0.0.1 and build and push my_gem-0.0.1.gem ...
93
+ rake rerdoc # Rebuild RDoc HTML files
94
+ rake test # Run tests
95
+ rake yard # Generate YARD Documentation
96
+ ```
97
+
98
+ You can customize the standard tasks by passing a block to `with_gemspec_file`:
99
+
100
+ ```ruby
101
+ Gemma::RakeTasks.with_gemspec_file 'mygem.gemspec' do |g|
102
+ g.rdoc.title = 'My Gem Is Great'
103
+ end
104
+ ```
105
+
106
+ See the gemma API docs for more information.
107
+
108
+ ## INSTALLATION
109
+
110
+ ```sh
111
+ gem install gemma
112
+ ```
113
+
114
+ ## DEVELOPMENT
115
+
116
+ ```sh
117
+ git clone git://github.com/jdleesmiller/gemma.git
118
+ cd gemma
119
+ bundle
120
+ rake -T # list development tasks
121
+ ```
122
+
123
+ ## TODO
124
+
125
+ - make it easier to add custom tasks and / or new task generators, as in
126
+
127
+ ```ruby
128
+ # DOES NOT WORK YET
129
+ Gemma::RakeTasks.with_gemspec_file 'mygem.gemspec' do |g|
130
+ g.yard_dev = Gemma::RakeTasks::YardTasks.new(g.gemspec, :yard_dev)
131
+ g.yard_dev.output = 'dev_docs'
132
+ g.yard_dev.options.push('--protected', '--private')
133
+ end
134
+ ```
135
+
136
+ - more tasks (e.g. to publish docs)
137
+ - more tasks to support C extensions
138
+ - hooks for the rcov and/or simplecov coverage tools
139
+ - tasks for version control? (e.g. based on http://github.com/nvie/gitflow)
140
+ - contributions welcome!
141
+
142
+ ## HISTORY
143
+
144
+ **6.0.0**
145
+ - updated dependencies
146
+ - dropped support for rubies < 3 (use 5.x for older rubies)
147
+
148
+ **5.0.1**
149
+ - fix rake testtask to avoid `cannot load such file -- ubygems` in ruby 2.5.0
150
+
151
+ **5.0.0**
152
+ - updated dependencies
153
+ - added rubocop as a dependency and lint the code and the template
154
+ - converted the template readme to markdown
155
+ - dropped support for rubies < 2.3 (use 4.x for older rubies)
156
+
157
+ **4.1.0**
158
+ - updated dependencies
159
+
160
+ **4.0.0**
161
+ - updated dependencies
162
+ - removed RunTasks -- bundler handles this now
163
+
164
+ **3.0.0**
165
+ - updated dependencies
166
+
167
+ **2.2.0**
168
+ - updated dependencies; now using bundler 1.1
169
+
170
+ **2.1.0**
171
+ - updated dependencies
172
+
173
+ **2.0.0**
174
+ - now relies on bundler
175
+ - now specifies particular gem version that must be used for rake, rdoc and
176
+ yard; the old approach was to try to work with whatever was already installed,
177
+ but this proved too fragile
178
+ - removed rcov support, because it doesn't work on 1.9.x (see simplecov)
179
+
180
+ **1.0.0**
181
+ - added templates
182
+ - changed rdoc and yard tasks to use `require_paths` instead of `files`
183
+ - more tests
184
+ - more documentation
185
+
186
+ **0.0.2**
187
+ - minor fixes
188
+
189
+ **0.0.1**
190
+ - first release
191
+
192
+ ## LICENSE
193
+
194
+ Copyright (c) 2010-2025 John Lees-Miller
195
+
196
+ Permission is hereby granted, free of charge, to any person obtaining
197
+ a copy of this software and associated documentation files (the
198
+ 'Software'), to deal in the Software without restriction, including
199
+ without limitation the rights to use, copy, modify, merge, publish,
200
+ distribute, sublicense, and/or sell copies of the Software, and to
201
+ permit persons to whom the Software is furnished to do so, subject to
202
+ the following conditions:
203
+
204
+ The above copyright notice and this permission notice shall be
205
+ included in all copies or substantial portions of the Software.
206
+
207
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
208
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
209
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
210
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
211
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
212
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
213
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/gemma CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # = gemma
5
6
  #
@@ -55,13 +56,13 @@ opts = {}
55
56
  opts['--template'] = []
56
57
  getopt.each do |opt, arg|
57
58
  case opt
58
- when '--help' then
59
+ when '--help'
59
60
  Gemma::Utility.print_usage_from_file_comment __FILE__
60
61
  exit
61
- when '--version' then
62
+ when '--version'
62
63
  puts "gemma-#{Gemma::VERSION}"
63
64
  exit
64
- when '--template' then
65
+ when '--template'
65
66
  opts['--template'] << arg
66
67
  else
67
68
  opts[opt] = arg
@@ -89,11 +90,11 @@ if interactive
89
90
  puts
90
91
  end
91
92
 
92
- if interactive
93
- gt.gem_name = hl.ask('gem name: ') { |q| q.validate = /^.+$/ } # weak
94
- else
95
- gt.gem_name = opts['--name']
96
- end
93
+ gt.gem_name = if interactive
94
+ hl.ask('gem name: ') { |q| q.validate = /^.+$/ } # weak
95
+ else
96
+ opts['--name']
97
+ end
97
98
 
98
99
  if opts['--dir']
99
100
  gt.dir_name = opts['--dir']
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Gemma
3
4
  #
4
5
  # Methods to check input against accepted conventions.
@@ -31,7 +32,7 @@ module Gemma
31
32
  # @return [Boolean]
32
33
  #
33
34
  def self.good_gem_name?(gem_name)
34
- gem_name =~ /^[a-z0-9]+[a-z0-9_\-]*$/
35
+ gem_name =~ /^[a-z0-9]+[a-z0-9_-]*$/
35
36
  end
36
37
 
37
38
  #
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'erb'
3
4
  require 'fileutils'
4
5
  require 'yaml'
@@ -18,7 +19,7 @@ module Gemma
18
19
  # there are files that occur in multiple templates (files in earlier
19
20
  # templates are overwritten by those in later templates, at present).
20
21
  #
21
- BUILTIN_TEMPLATES = %w(base executable minitest).freeze
22
+ BUILTIN_TEMPLATES = %w[base executable minitest].freeze
22
23
 
23
24
  def initialize
24
25
  @gem_name = nil
@@ -86,9 +87,7 @@ module Gemma
86
87
  # directories to copy
87
88
  #
88
89
  def create_gem(template_paths, destination_path = self.destination_path)
89
- if File.exist?(destination_path)
90
- raise "destination #{destination_path} exists"
91
- end
90
+ raise "destination #{destination_path} exists" if File.exist?(destination_path)
92
91
 
93
92
  # Copy templates in.
94
93
  FileUtils.mkdir_p destination_path
@@ -99,22 +98,23 @@ module Gemma
99
98
  Dir.chdir destination_path do
100
99
  dirs = Dir['**/*'].select { |f| File.directory? f }.sort
101
100
  dirs.grep(/gem_name/).each do |file|
102
- FileUtils.mv file, file.gsub(/gem_name/, gem_name)
101
+ FileUtils.mv file, file.gsub('gem_name', gem_name)
103
102
  end
104
103
 
105
104
  files = (Dir['**/*'] + Dir['**/.*']).select { |f| File.file? f }.sort
106
105
  FileUtils.chmod 0o644, files
107
- FileUtils.chmod 0o755, files.select { |f| File.dirname(f) == 'bin' }
106
+ FileUtils.chmod(0o755, files.select { |f| File.dirname(f) == 'bin' })
108
107
  files.each do |file|
109
108
  # Rename files with names that depend on the gem name.
110
109
  if file =~ /gem_name/
111
- new_file = file.sub(/gem_name/, gem_name)
110
+ new_file = file.sub('gem_name', gem_name)
112
111
  FileUtils.mv file, new_file
113
112
  file = new_file
114
113
  end
115
114
 
116
115
  # Run erb to customize each file.
117
116
  next unless File.extname(file) == '.erb'
117
+
118
118
  erb_file = File.read file
119
119
  File.open file, 'w' do |f|
120
120
  erb = ERB.new(erb_file)
data/lib/gemma/options.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Gemma
3
4
  #
4
5
  # Helpers for processing command line arguments.
@@ -60,14 +61,15 @@ module Gemma
60
61
 
61
62
  until options.empty?
62
63
  x = options.shift
63
- if x == '--'
64
+ case x
65
+ when '--'
64
66
  # Stop at the '--' terminator.
65
67
  done << x
66
68
  break
67
- elsif x =~ /^(--[^=]+)/
69
+ when /^(--[^=]+)/
68
70
  if names.member?(Regexp.last_match(1))
69
71
  # Found a long style option; look for its argument (if any).
70
- result = \
72
+ result =
71
73
  if x =~ /=(.*)$/
72
74
  Regexp.last_match(1)
73
75
  elsif !options.empty? && options.first !~ /^-./
@@ -78,13 +80,13 @@ module Gemma
78
80
  else
79
81
  done << x
80
82
  end
81
- elsif x =~ /^(-(.))(.*)/
83
+ when /^(-(.))(.*)/
82
84
  # Found a short style option; this may actually represent several
83
85
  # options; look for matching short options.
84
86
  name = Regexp.last_match(1)
85
87
  rest = Regexp.last_match(3)
86
88
  if names.member?(name)
87
- result = \
89
+ result =
88
90
  if rest.length.positive?
89
91
  rest
90
92
  elsif !options.empty? && options.first !~ /^-./
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Gemma
3
4
  class RakeTasks
4
5
  #
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Gemma
3
4
  class RakeTasks
4
5
  #
@@ -18,7 +19,7 @@ module Gemma
18
19
  # @param [Gem::Specification] gemspec
19
20
  #
20
21
  def initialize(gemspec)
21
- super(gemspec)
22
+ super
22
23
 
23
24
  # Defaults.
24
25
  @task_name = :test
@@ -69,7 +70,7 @@ module Gemma
69
70
  tt.libs = gemspec.require_paths.dup
70
71
  tt.libs << 'test'
71
72
  tt.test_files = files
72
- @with_test_task.call(tt) if @with_test_task
73
+ @with_test_task&.call(tt)
73
74
  end
74
75
  end
75
76
  nil
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Gemma
3
4
  class RakeTasks
4
5
  #
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'rdoc/task'
3
4
 
4
5
  module Gemma
@@ -20,7 +21,7 @@ module Gemma
20
21
  # @param [Gem::Specification] gemspec
21
22
  #
22
23
  def initialize(gemspec)
23
- super(gemspec)
24
+ super
24
25
 
25
26
  # Defaults.
26
27
  @task_name = :rdoc
@@ -29,13 +30,13 @@ module Gemma
29
30
  # I'm not sure whether it's a good idea to pass -o in the gemspec, but
30
31
  # for now we'll handle it, because it's needed in the Rakefile.
31
32
  @options = gemspec.rdoc_options
32
- @output, @options = Options.extract(%w(-o --output --op), @options).to_a
33
+ @output, @options = Options.extract(%w[-o --output --op], @options).to_a
33
34
  @output ||= 'rdoc'
34
35
 
35
36
  # Extract --main, --title and --template so RDocTask can have them.
36
- @main, @options = Options.extract(%w(-m --main), @options).to_a
37
- @title, @options = Options.extract(%w(-t --title), @options).to_a
38
- @template, @options = Options.extract(%w(-T --template), @options).to_a
37
+ @main, @options = Options.extract(%w[-m --main], @options).to_a
38
+ @title, @options = Options.extract(%w[-t --title], @options).to_a
39
+ @template, @options = Options.extract(%w[-T --template], @options).to_a
39
40
 
40
41
  @files = gemspec.require_paths + gemspec.extra_rdoc_files
41
42
  end
@@ -126,7 +127,7 @@ module Gemma
126
127
  rd.main = main
127
128
  rd.template = template
128
129
  rd.options = options
129
- @with_rdoc_task.call(rd) if @with_rdoc_task
130
+ @with_rdoc_task&.call(rd)
130
131
  end
131
132
  CLOBBER.include(output)
132
133
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'yard'
3
4
 
4
5
  module Gemma
@@ -32,7 +33,7 @@ module Gemma
32
33
  # @param [Gem::Specification] gemspec
33
34
  #
34
35
  def initialize(gemspec)
35
- super(gemspec)
36
+ super
36
37
 
37
38
  # Defaults.
38
39
  @task_name = :yard
@@ -42,8 +43,8 @@ module Gemma
42
43
  # Extract supported rdoc options and add to the default yard options.
43
44
  # Keep track of main, if it is given, because we have to remove it from
44
45
  # the extra files list (otherwise it shows up twice in the output).
45
- @main = Options.extract(%w(-m --main), gemspec.rdoc_options).argument
46
- @title = Options.extract(%w(-t --title), gemspec.rdoc_options).argument
46
+ @main = Options.extract(%w[-m --main], gemspec.rdoc_options).argument
47
+ @title = Options.extract(%w[-t --title], gemspec.rdoc_options).argument
47
48
 
48
49
  @options = []
49
50
 
@@ -136,7 +137,7 @@ module Gemma
136
137
  yd.options = complete_options
137
138
  yd.files = files
138
139
  yd.files.push('-', *extra_files) unless extra_files.empty?
139
- @with_yardoc_task.call(yd) if @with_yardoc_task
140
+ @with_yardoc_task&.call(yd)
140
141
  end
141
142
  CLOBBER.include(output)
142
143
  CLOBBER.include('.yardoc')
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'rake/clean'
3
4
 
4
5
  module Gemma
@@ -18,7 +19,7 @@ module Gemma
18
19
  #
19
20
  class RakeTasks
20
21
  # Alias for new.
21
- class <<self
22
+ class << self
22
23
  alias with_gemspec_file new
23
24
  end
24
25
 
@@ -53,12 +54,10 @@ module Gemma
53
54
  # Let the user add more plugins and alter settings.
54
55
  yield(self) if block_given?
55
56
 
56
- @plugins.values.each do |plugin|
57
- begin
58
- plugin.create_rake_tasks
59
- rescue
60
- warn "plugin #{plugin.class} failed: #{$ERROR_INFO}"
61
- end
57
+ @plugins.each_value do |plugin|
58
+ plugin.create_rake_tasks
59
+ rescue StandardError
60
+ warn "plugin #{plugin.class} failed: #{$ERROR_INFO}"
62
61
  end
63
62
  end
64
63
 
data/lib/gemma/utility.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Gemma
3
4
  #
4
5
  # Utility functions.
@@ -18,7 +19,8 @@ module Gemma
18
19
  lines.shift if lines.first =~ /^#\s*frozen_string_literal/
19
20
  lines.each do |line|
20
21
  line.strip!
21
- break unless line =~ /^#{comment_char}(.*)/
22
+ break unless line.empty? || line =~ /^#{comment_char}(.*)/
23
+
22
24
  io.puts Regexp.last_match(1)
23
25
  end
24
26
  end
data/lib/gemma/version.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Gemma
3
- VERSION_MAJOR = 5
4
+ VERSION_MAJOR = 6
4
5
  VERSION_MINOR = 0
5
- VERSION_PATCH = 1
6
+ VERSION_PATCH = 0
6
7
  VERSION = [VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH].join('.')
7
8
  end
data/lib/gemma.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'English'
3
4
  require 'shellwords'
4
5
 
@@ -3,7 +3,7 @@
3
3
  require '<%= gem_name %>'
4
4
  require 'minitest/autorun'
5
5
 
6
- class Test<%= module_name %> < MiniTest::Test
6
+ class Test<%= module_name %> < Minitest::Test
7
7
  def test_<%= gem_name %>
8
8
  assert_equal 3, 1 + 1, 'TODO write tests'
9
9
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'gemma/test_helper'
3
4
  require 'tmpdir'
4
5
 
5
- class Gemma::GemFromTemplateTest < MiniTest::Test
6
+ class Gemma::GemFromTemplateTest < Minitest::Test
6
7
  def setup
7
8
  @tmp = Dir.mktmpdir('gemma')
8
9
  @old_pwd = Dir.pwd
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'gemma/test_helper'
3
4
  require 'tmpdir'
4
5
  require 'open4'
@@ -7,7 +8,7 @@ require 'open4'
7
8
  # Run the 'gemma new' command and then run some basic commands to make sure that
8
9
  # things worked out.
9
10
  #
10
- class Gemma::GemmaNewTest < MiniTest::Test
11
+ class Gemma::GemmaNewTest < Minitest::Test
11
12
  #
12
13
  # Run a command in a bundler-free environment and capture both stdout and
13
14
  # stderror output.
@@ -22,7 +23,7 @@ class Gemma::GemmaNewTest < MiniTest::Test
22
23
  # which is nicer, but Open3 on ruby 1.8.7 doesn't let us get exitstatus.)
23
24
  #
24
25
  def run_cmd(*args)
25
- Bundler.with_clean_env do
26
+ Bundler.with_original_env do
26
27
  # We have to clear RUBYOPT, because Bundler::ORIGINAL_ENV in the test
27
28
  # runner's process still contains some bundler stuff from rake's process.
28
29
  # This suggests that we might have to stop using rake's built-in TestTask,
@@ -58,6 +59,7 @@ class Gemma::GemmaNewTest < MiniTest::Test
58
59
 
59
60
  # edit the test gem's Gemfile to point to this gemma
60
61
  raise 'no Gemfile in test gem' unless File.exist?('Gemfile')
62
+
61
63
  File.open('Gemfile', 'a') do |f|
62
64
  f.puts "gem 'gemma', :path => #{@old_pwd.dump}"
63
65
  end
@@ -66,7 +68,7 @@ class Gemma::GemmaNewTest < MiniTest::Test
66
68
  gemspec_name = 'test_gem.gemspec'
67
69
  gemspec = File.read(gemspec_name)
68
70
  gemspec.gsub!(/TODO\s*/, '')
69
- gemspec.gsub!(/'homepage'/, "'http://example.com'")
71
+ gemspec.gsub!("'homepage'", "'http://example.com'")
70
72
  File.open(gemspec_name, 'w') { |f| f.puts gemspec }
71
73
 
72
74
  # run bundler on the test gem; it should find the same gems that we're using
@@ -74,12 +76,6 @@ class Gemma::GemmaNewTest < MiniTest::Test
74
76
  status, output = run_cmd('bundle', 'install', '--local')
75
77
  raise "bundle failed:\n#{output}" unless status.exitstatus.zero?
76
78
 
77
- # it should say that it has loaded two things from source: gemma and the
78
- # test_gem itself; if it doesn't it indicates that something strange
79
- # happened with bundler's environment (or it may just break on future
80
- # versions of bundler)
81
- raise 'did not load from source' unless output =~ /from source at/
82
-
83
79
  # bundler should produce a lock file
84
80
  raise 'no Gemfile.lock in test gem' unless File.exist?('Gemfile.lock')
85
81
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'gemma/test_helper'
3
4
  require 'set'
4
5
 
5
- class Gemma::GemmaTest < MiniTest::Test
6
+ class Gemma::GemmaTest < Minitest::Test
6
7
  # Can load empty spec.
7
8
  def test_empty_spec
8
9
  s = Gem::Specification.new
@@ -11,13 +12,13 @@ class Gemma::GemmaTest < MiniTest::Test
11
12
 
12
13
  def test_rdoc_tasks
13
14
  s = Gem::Specification.new
14
- s.files = %w(lib/a.rb lib/b.rb)
15
- s.test_files = %w(test/test_a.rb test/test_a.rb)
15
+ s.files = %w[lib/a.rb lib/b.rb]
16
+ s.test_files = %w[test/test_a.rb test/test_a.rb]
16
17
  s.rdoc_options = ['--main', 'README.md']
17
18
  s.extra_rdoc_files = ['README.md', 'FAQ']
18
19
 
19
20
  Gemma::RakeTasks.new(s) do |g|
20
- assert_equal %w(lib FAQ README.md).to_set, g.rdoc.files.to_set
21
+ assert_equal %w[lib FAQ README.md].to_set, g.rdoc.files.to_set
21
22
  assert_equal [], g.rdoc.options
22
23
  assert_equal 'README.md', g.rdoc.main
23
24
  assert_nil g.rdoc.title
@@ -30,8 +31,8 @@ class Gemma::GemmaTest < MiniTest::Test
30
31
 
31
32
  def test_yard_tasks
32
33
  s = Gem::Specification.new
33
- s.files = %w(lib/a.rb)
34
- s.test_files = %w(test/test_a.rb)
34
+ s.files = %w[lib/a.rb]
35
+ s.test_files = %w[test/test_a.rb]
35
36
  s.rdoc_options = ['--main', 'README.rdoc']
36
37
  s.extra_rdoc_files = ['README.rdoc']
37
38
 
@@ -39,7 +40,7 @@ class Gemma::GemmaTest < MiniTest::Test
39
40
  # A file should not be passed as an extra file if it's the --main file.
40
41
  # Test files should not be documented.
41
42
  Gemma::RakeTasks.new(s) do |g|
42
- assert_equal %w(lib), g.yard.files
43
+ assert_equal %w[lib], g.yard.files
43
44
  assert_equal [], g.yard.extra_files
44
45
  assert_equal 'README.rdoc', g.yard.main
45
46
  assert_equal [], g.yard.options
@@ -48,22 +49,22 @@ class Gemma::GemmaTest < MiniTest::Test
48
49
  assert_nil g.yard.title
49
50
 
50
51
  g.yard.with_yardoc_task do |yd|
51
- assert_equal %w(lib), yd.files
52
+ assert_equal %w[lib], yd.files
52
53
  assert_equal 4, yd.options.size
53
54
  assert_equal \
54
55
  'README.rdoc',
55
- Gemma::Options.extract(%w(--main), yd.options).argument
56
+ Gemma::Options.extract(%w[--main], yd.options).argument
56
57
  assert_equal \
57
58
  'yard',
58
- Gemma::Options.extract(%w(--output), yd.options).argument
59
+ Gemma::Options.extract(%w[--output], yd.options).argument
59
60
  end
60
61
  end
61
62
 
62
63
  # Add some extra files (that aren't the --main file).
63
64
  s.extra_rdoc_files << 'FAQ'
64
65
  Gemma::RakeTasks.new(s) do |g|
65
- assert_equal %w(lib), g.yard.files
66
- assert_equal %w(FAQ), g.yard.extra_files
66
+ assert_equal %w[lib], g.yard.files
67
+ assert_equal %w[FAQ], g.yard.extra_files
67
68
  assert_equal 'README.rdoc', g.yard.main
68
69
  assert_equal [], g.yard.options
69
70
  end
@@ -71,15 +72,15 @@ class Gemma::GemmaTest < MiniTest::Test
71
72
  # Make sure extra options are ignored.
72
73
  s.rdoc_options = ['--main', 'README.rdoc', '--diagram']
73
74
  Gemma::RakeTasks.new(s) do |g|
74
- assert_equal %w(lib), g.yard.files
75
- assert_equal %w(FAQ), g.yard.extra_files
75
+ assert_equal %w[lib], g.yard.files
76
+ assert_equal %w[FAQ], g.yard.extra_files
76
77
  assert_equal 'README.rdoc', g.yard.main
77
78
  assert_equal [], g.yard.options
78
79
  end
79
80
  s.rdoc_options = ['--diagram', '--main', 'README.rdoc']
80
81
  Gemma::RakeTasks.new(s) do |g|
81
- assert_equal %w(lib), g.yard.files
82
- assert_equal %w(FAQ), g.yard.extra_files
82
+ assert_equal %w[lib], g.yard.files
83
+ assert_equal %w[FAQ], g.yard.extra_files
83
84
  assert_equal 'README.rdoc', g.yard.main
84
85
  assert_equal [], g.yard.options
85
86
  end
@@ -95,25 +96,25 @@ class Gemma::GemmaTest < MiniTest::Test
95
96
  assert_equal [], g.yard.options
96
97
 
97
98
  g.yard.with_yardoc_task do |yd|
98
- assert_equal %w(lib - FAQ), yd.files
99
+ assert_equal %w[lib - FAQ], yd.files
99
100
  assert_equal 6, yd.options.size
100
101
  assert_equal \
101
102
  'README.rdoc',
102
- Gemma::Options.extract(%w(--main), yd.options).argument
103
+ Gemma::Options.extract(%w[--main], yd.options).argument
103
104
  assert_equal \
104
105
  'yard',
105
- Gemma::Options.extract(%w(--output), yd.options).argument
106
+ Gemma::Options.extract(%w[--output], yd.options).argument
106
107
  assert_equal \
107
108
  'a b c',
108
- Gemma::Options.extract(%w(--title), yd.options).argument
109
+ Gemma::Options.extract(%w[--title], yd.options).argument
109
110
  end
110
111
  end
111
112
  end
112
113
 
113
114
  def test_test_unit_tasks
114
115
  s = Gem::Specification.new
115
- s.files = %w(lib/a.rb lib/b.rb)
116
- s.test_files = %w(test/test_a.rb test/test_b.rb)
116
+ s.files = %w[lib/a.rb lib/b.rb]
117
+ s.test_files = %w[test/test_a.rb test/test_b.rb]
117
118
  s.require_paths << 'foo'
118
119
 
119
120
  # annoyance: if we ran this test with rake TEST=... then the environmental
@@ -122,9 +123,9 @@ class Gemma::GemmaTest < MiniTest::Test
122
123
 
123
124
  Gemma::RakeTasks.new(s) do |g|
124
125
  g.test.with_test_task do |tt|
125
- assert_equal %w(lib foo test).to_set, tt.libs.to_set
126
+ assert_equal %w[lib foo test].to_set, tt.libs.to_set
126
127
  assert_equal \
127
- %w(test/test_a.rb test/test_b.rb).to_set,
128
+ %w[test/test_a.rb test/test_b.rb].to_set,
128
129
  tt.file_list.to_a.to_set
129
130
  end
130
131
  end
@@ -163,7 +164,7 @@ class Gemma::GemmaTest < MiniTest::Test
163
164
  gemma_file = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'gemma')
164
165
  io = StringIO.new
165
166
  Gemma::Utility.print_usage_from_file_comment gemma_file, '#', io
166
- assert io.string =~ /gemma/
167
+ assert_match(/gemma/, io.string)
167
168
  end
168
169
 
169
170
  def test_plugin_abstract
@@ -1,122 +1,123 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'gemma/test_helper'
3
4
 
4
- class OptionsTest < MiniTest::Test
5
+ class OptionsTest < Minitest::Test
5
6
  include Gemma
6
7
 
7
8
  def test_empty
8
9
  # empty input
9
10
  assert_equal \
10
11
  Options::ExtractResult.new(nil, []),
11
- Options.extract(%w(--a), [])
12
+ Options.extract(%w[--a], [])
12
13
  end
13
14
 
14
15
  def test_long_form
15
- input = %w(--a av --b --c=cv)
16
+ input = %w[--a av --b --c=cv]
16
17
 
17
18
  # option a has an argument
18
19
  assert_equal \
19
- Options::ExtractResult.new('av', %w(--b --c=cv)),
20
- Options.extract(%w(--a), input)
20
+ Options::ExtractResult.new('av', %w[--b --c=cv]),
21
+ Options.extract(%w[--a], input)
21
22
 
22
23
  # option b has no argument; result is ''
23
24
  assert_equal \
24
- Options::ExtractResult.new('', %w(--a av --c=cv)),
25
- Options.extract(%w(--b), input)
25
+ Options::ExtractResult.new('', %w[--a av --c=cv]),
26
+ Options.extract(%w[--b], input)
26
27
 
27
28
  # option c also has argument
28
29
  assert_equal \
29
- Options::ExtractResult.new('cv', %w(--a av --b)),
30
- Options.extract(%w(--c), input)
30
+ Options::ExtractResult.new('cv', %w[--a av --b]),
31
+ Options.extract(%w[--c], input)
31
32
 
32
33
  # there is no option d; result is nil
33
34
  assert_equal \
34
35
  Options::ExtractResult.new(nil, input),
35
- Options.extract(%w(--d), input)
36
+ Options.extract(%w[--d], input)
36
37
  end
37
38
 
38
39
  def test_terminator
39
40
  # just the -- terminator
40
41
  assert_equal \
41
42
  Options::ExtractResult.new(nil, ['--']),
42
- Options.extract(%w(--a), ['--'])
43
+ Options.extract(%w[--a], ['--'])
43
44
 
44
45
  # should keep content before and after the -- terminator
45
46
  assert_equal \
46
- Options::ExtractResult.new(nil, %w(a -- b)),
47
- Options.extract(%w(--a), %w(a -- b))
47
+ Options::ExtractResult.new(nil, %w[a -- b]),
48
+ Options.extract(%w[--a], %w[a -- b])
48
49
  end
49
50
 
50
- def test_terminator_2
51
- input = %w(foo --a av -- --b bv)
51
+ def test_terminator2
52
+ input = %w[foo --a av -- --b bv]
52
53
 
53
54
  # should not be able to find options after the -- terminator
54
55
  assert_equal \
55
- Options::ExtractResult.new('av', %w(foo -- --b bv)),
56
- Options.extract(%w(--a), input)
56
+ Options::ExtractResult.new('av', %w[foo -- --b bv]),
57
+ Options.extract(%w[--a], input)
57
58
  assert_equal \
58
59
  Options::ExtractResult.new(nil, input),
59
- Options.extract(%w(--b), input)
60
+ Options.extract(%w[--b], input)
60
61
  assert_equal \
61
- Options::ExtractResult.new('', %w(-- --b)),
62
- Options.extract(%w(--a), %w(--a -- --b))
62
+ Options::ExtractResult.new('', %w[-- --b]),
63
+ Options.extract(%w[--a], %w[--a -- --b])
63
64
  assert_equal \
64
- Options::ExtractResult.new(nil, %w(--a -- --b)),
65
- Options.extract(%w(--b), %w(--a -- --b))
65
+ Options::ExtractResult.new(nil, %w[--a -- --b]),
66
+ Options.extract(%w[--b], %w[--a -- --b])
66
67
  end
67
68
 
68
69
  def test_short_form
69
70
  # should be able to find -a but not -b
70
- input = %w(foo -a av -- -b bv)
71
+ input = %w[foo -a av -- -b bv]
71
72
  assert_equal \
72
- Options::ExtractResult.new('av', %w(foo -- -b bv)),
73
- Options.extract(%w(-a), input)
73
+ Options::ExtractResult.new('av', %w[foo -- -b bv]),
74
+ Options.extract(%w[-a], input)
74
75
  assert_equal \
75
76
  Options::ExtractResult.new(nil, input),
76
- Options.extract(%w(-b), input)
77
+ Options.extract(%w[-b], input)
77
78
 
78
79
  # the -aav and -b bv forms
79
- input = %w(-aav -b bv)
80
+ input = %w[-aav -b bv]
80
81
  assert_equal \
81
- Options::ExtractResult.new('av', %w(-b bv)),
82
- Options.extract(%w(-a), input)
82
+ Options::ExtractResult.new('av', %w[-b bv]),
83
+ Options.extract(%w[-a], input)
83
84
  assert_equal \
84
- Options::ExtractResult.new('bv', %w(-aav)),
85
- Options.extract(%w(-b), input)
85
+ Options::ExtractResult.new('bv', %w[-aav]),
86
+ Options.extract(%w[-b], input)
86
87
 
87
88
  # short form with no argument
88
89
  assert_equal \
89
- Options::ExtractResult.new('', %w(-a av)),
90
- Options.extract(%w(-b), %w(-a av -b))
90
+ Options::ExtractResult.new('', %w[-a av]),
91
+ Options.extract(%w[-b], %w[-a av -b])
91
92
 
92
93
  # missing short form argument
93
94
  assert_equal \
94
- Options::ExtractResult.new(nil, %w(-a av -b foo bar.txt)),
95
- Options.extract(%w(-c), %w(-a av -b foo bar.txt))
95
+ Options::ExtractResult.new(nil, %w[-a av -b foo bar.txt]),
96
+ Options.extract(%w[-c], %w[-a av -b foo bar.txt])
96
97
  end
97
98
 
98
99
  def test_multiple_options
99
100
  # single -a means we pick up a1
100
101
  assert_equal \
101
102
  Options::ExtractResult.new('a1', []),
102
- Options.extract(%w(-a), %w(-a a1))
103
+ Options.extract(%w[-a], %w[-a a1])
103
104
 
104
105
  # the second -a means that we pick up a2
105
106
  assert_equal \
106
107
  Options::ExtractResult.new('a2', []),
107
- Options.extract(%w(-a), %w(-a a1 -a a2))
108
+ Options.extract(%w[-a], %w[-a a1 -a a2])
108
109
  assert_equal \
109
- Options::ExtractResult.new('a2', %w(hi -bfoo)),
110
- Options.extract(%w(-a), %w(hi -a a1 -a a2 -bfoo))
110
+ Options::ExtractResult.new('a2', %w[hi -bfoo]),
111
+ Options.extract(%w[-a], %w[hi -a a1 -a a2 -bfoo])
111
112
 
112
113
  # mixing long and short forms doesn't affect this
113
114
  assert_equal \
114
115
  Options::ExtractResult.new('a2', []),
115
- Options.extract(%w(-a --a), %w(-a a1 --a a2))
116
+ Options.extract(%w[-a --a], %w[-a a1 --a a2])
116
117
 
117
118
  # a duplicate option after the -- terminator makes no difference
118
119
  assert_equal \
119
- Options::ExtractResult.new('a1', %w(-- -aa2)),
120
- Options.extract(%w(-a), %w(-a a1 -- -aa2))
120
+ Options::ExtractResult.new('a1', %w[-- -aa2]),
121
+ Options.extract(%w[-a], %w[-a a1 -- -aa2])
121
122
  end
122
123
  end
metadata CHANGED
@@ -1,113 +1,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemma
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Lees-Miller
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2018-01-07 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: highline
13
+ name: getoptlong
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 1.6.21
18
+ version: 0.2.1
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: 1.6.21
25
+ version: 0.2.1
27
26
  - !ruby/object:Gem::Dependency
28
- name: rake
27
+ name: highline
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: 10.2.2
32
+ version: 1.6.21
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: 10.2.2
39
+ version: 1.6.21
41
40
  - !ruby/object:Gem::Dependency
42
- name: rdoc
41
+ name: minitest
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - ">="
46
45
  - !ruby/object:Gem::Version
47
- version: 4.1.1
46
+ version: 5.3.1
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - ">="
53
52
  - !ruby/object:Gem::Version
54
- version: 4.1.1
53
+ version: 5.3.1
55
54
  - !ruby/object:Gem::Dependency
56
- name: rubocop
55
+ name: rake
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - ">="
60
59
  - !ruby/object:Gem::Version
61
- version: 0.42.0
60
+ version: 10.2.2
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
- version: 0.42.0
67
+ version: 10.2.2
69
68
  - !ruby/object:Gem::Dependency
70
- name: yard
69
+ name: rdoc
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
72
  - - ">="
74
73
  - !ruby/object:Gem::Version
75
- version: 0.8.7
74
+ version: 4.1.1
76
75
  type: :runtime
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
79
  - - ">="
81
80
  - !ruby/object:Gem::Version
82
- version: 0.8.7
81
+ version: 4.1.1
83
82
  - !ruby/object:Gem::Dependency
84
- name: minitest
83
+ name: rubocop
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
86
  - - ">="
88
87
  - !ruby/object:Gem::Version
89
- version: 5.3.1
88
+ version: 0.42.0
90
89
  type: :runtime
91
90
  prerelease: false
92
91
  version_requirements: !ruby/object:Gem::Requirement
93
92
  requirements:
94
93
  - - ">="
95
94
  - !ruby/object:Gem::Version
96
- version: 5.3.1
95
+ version: 0.42.0
97
96
  - !ruby/object:Gem::Dependency
98
- name: open4
97
+ name: yard
99
98
  requirement: !ruby/object:Gem::Requirement
100
99
  requirements:
101
- - - "~>"
100
+ - - ">="
102
101
  - !ruby/object:Gem::Version
103
- version: 1.3.0
104
- type: :development
102
+ version: 0.8.7
103
+ type: :runtime
105
104
  prerelease: false
106
105
  version_requirements: !ruby/object:Gem::Requirement
107
106
  requirements:
108
- - - "~>"
107
+ - - ">="
109
108
  - !ruby/object:Gem::Version
110
- version: 1.3.0
109
+ version: 0.8.7
111
110
  description: |
112
111
  Gemma is a gem development helper like hoe and jeweler, but it keeps the gemspec
113
112
  in a gemspec file, instead of in a Rakefile. This helps your gem to play nicely
@@ -119,10 +118,10 @@ executables:
119
118
  - gemma
120
119
  extensions: []
121
120
  extra_rdoc_files:
122
- - README.rdoc
121
+ - README.md
123
122
  - bin/gemma
124
123
  files:
125
- - README.rdoc
124
+ - README.md
126
125
  - bin/gemma
127
126
  - lib/gemma.rb
128
127
  - lib/gemma/conventions.rb
@@ -152,29 +151,27 @@ files:
152
151
  - test/gemma/options_test.rb
153
152
  homepage: http://github.com/jdleesmiller/gemma
154
153
  licenses: []
155
- metadata: {}
156
- post_install_message:
154
+ metadata:
155
+ rubygems_mfa_required: 'true'
157
156
  rdoc_options:
158
157
  - "--main"
159
- - README.rdoc
158
+ - README.md
160
159
  - "--title"
161
- - gemma-5.0.1 Documentation
160
+ - gemma-6.0.0 Documentation
162
161
  require_paths:
163
162
  - lib
164
163
  required_ruby_version: !ruby/object:Gem::Requirement
165
164
  requirements:
166
165
  - - ">="
167
166
  - !ruby/object:Gem::Version
168
- version: '0'
167
+ version: '3.0'
169
168
  required_rubygems_version: !ruby/object:Gem::Requirement
170
169
  requirements:
171
170
  - - ">="
172
171
  - !ruby/object:Gem::Version
173
172
  version: '0'
174
173
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.7.3
177
- signing_key:
174
+ rubygems_version: 3.6.7
178
175
  specification_version: 4
179
176
  summary: A gem development tool that plays well with bundler.
180
177
  test_files:
data/README.rdoc DELETED
@@ -1,191 +0,0 @@
1
- = gemma
2
-
3
- http://github.com/jdleesmiller/gemma
4
-
5
- http://github.com/jdleesmiller/gemma/wiki
6
-
7
- {<img src="https://secure.travis-ci.org/jdleesmiller/gemma.png" alt="Build Status" />}[http://travis-ci.org/jdleesmiller/gemma]
8
- {<img src="https://gemnasium.com/jdleesmiller/gemma.png" alt="Dependency Status " />}[https://gemnasium.com/jdleesmiller/gemma]
9
- {<img src="https://badge.fury.io/rb/gemma.png" alt="Gem Version" />}[http://badge.fury.io/rb/gemma]
10
-
11
- == SYNOPSIS
12
-
13
- Gemma is a gem development helper like hoe and jeweler, but it keeps the
14
- +gemspec+ in a <tt>.gemspec</tt> file, instead of in a +Rakefile+. This helps
15
- your gem to play nicely with commands like +gem+ and +bundle+, and it allows
16
- gemma to provide +rake+ tasks with sensible defaults for many common gem
17
- development tasks.
18
-
19
- See http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended for some reasons
20
- why you probably want a <tt>.gemspec</tt> file in your gem's repository.
21
-
22
- === Usage
23
-
24
- See the project wiki for tutorials and guides:
25
- https://github.com/jdleesmiller/gemma/wiki
26
-
27
- Briefly:
28
-
29
- ==== Create a New Gem
30
-
31
- Gemma has a simple interactive gem scaffolding tool; run
32
- gemma new
33
- and follow the prompts. (Run with -h for help.)
34
-
35
- This gives you a simple gem template like the following:
36
-
37
- my_gem
38
- |-- bin
39
- | `-- my_gem # executable (optional)
40
- |-- Gemfile # for bundler (see below)
41
- |-- lib
42
- | |-- my_gem # most of your code goes here
43
- | | `-- version.rb # the version constant
44
- | `-- my_gem.rb # the main code file
45
- |-- my_gem.gemspec # gem metadata
46
- |-- Rakefile # development tasks
47
- |-- README.md # documentation
48
- `-- test # unit tests go here
49
- `-- my_gem
50
- `-- my_gem_test.rb
51
-
52
- Things you need to change in the template are marked with a +TODO+ tag.
53
-
54
- ==== To Modify an Existing Gem to use Gemma
55
-
56
- The main thing you need is a <tt>.gemspec</tt> file. If you have been using hoe
57
- or jeweler, you already have all of the information in your Rakefile, so you
58
- just have to move it into a <tt>.gemspec</tt> file.
59
-
60
- Gemma provides rake tasks with sensible defaults based on the contents of
61
- your gemspec; to enable them, add the following to the top of your +Rakefile+:
62
-
63
- require 'rubygems'
64
- require 'bundler/setup'
65
- require 'gemma'
66
-
67
- Gemma::RakeTasks.with_gemspec_file 'my_gem.gemspec'
68
-
69
- task default: :test
70
-
71
- This gives you some standard rake tasks, in addition to any that you define
72
- yourself.
73
-
74
- ==== The Standard Tasks
75
-
76
- Run <tt>rake -T</tt> for a full list of tasks.
77
-
78
- % rake -T
79
- rake build # Build my_gem-0.0.1.gem into the pkg directory
80
- rake clean # Remove any temporary products.
81
- rake clobber # Remove any generated file.
82
- rake clobber_rdoc # Remove RDoc HTML files
83
- rake install # Build and install my_gem-0.0.1.gem into system gems
84
- rake rdoc # Build RDoc HTML files
85
- rake release # Create tag v0.0.1 and build and push my_gem-0.0.1.gem ...
86
- rake rerdoc # Rebuild RDoc HTML files
87
- rake test # Run tests
88
- rake yard # Generate YARD Documentation
89
-
90
- You can customize the standard tasks by passing a block to +with_gemspec_file+:
91
-
92
- Gemma::RakeTasks.with_gemspec_file 'mygem.gemspec' do |g|
93
- g.rdoc.title = 'My Gem Is Great'
94
- end
95
-
96
- See the gemma API docs for more information.
97
-
98
- == INSTALLATION
99
-
100
- gem install gemma
101
-
102
- == DEVELOPMENT
103
-
104
- git clone git://github.com/jdleesmiller/gemma.git
105
- cd gemma
106
- bundle
107
- rake -T # list development tasks
108
-
109
- == TODO
110
-
111
- * make it easier to add custom tasks and / or new task generators, as in
112
- # DOES NOT WORK YET
113
- Gemma::RakeTasks.with_gemspec_file 'mygem.gemspec' do |g|
114
- g.yard_dev = Gemma::RakeTasks::YardTasks.new(g.gemspec, :yard_dev)
115
- g.yard_dev.output = 'dev_docs'
116
- g.yard_dev.options.push('--protected', '--private')
117
- end
118
- * more tasks (e.g. to publish docs)
119
- * more tasks to support C extensions
120
- * hooks for the rcov and/or simplecov coverage tools
121
- * tasks for version control? (e.g. based on http://github.com/nvie/gitflow)
122
- * contributions welcome!
123
-
124
- == HISTORY
125
-
126
- <em>5.0.1</em>
127
- * fix rake testtask to avoid `cannot load such file -- ubygems` in ruby 2.5.0
128
-
129
- <em>5.0.0</em>
130
- * updated dependencies
131
- * added rubocop as a dependency and lint the code and the template
132
- * converted the template readme to markdown
133
- * dropped support for rubies < 2.3 (use 4.x for older rubies)
134
-
135
- <em>4.1.0</em>
136
- * updated dependencies
137
-
138
- <em>4.0.0</em>
139
- * updated dependencies
140
- * removed RunTasks -- bundler handles this now
141
-
142
- <em>3.0.0</em>
143
- * updated dependencies
144
-
145
- <em>2.2.0</em>
146
- * updated dependencies; now using bundler 1.1
147
-
148
- <em>2.1.0</em>
149
- * updated dependencies
150
-
151
- <em>2.0.0</em>
152
- * now relies on bundler
153
- * now specifies particular gem version that must be used for rake, rdoc and
154
- yard; the old approach was to try to work with whatever was already installed,
155
- but this proved too fragile
156
- * removed rcov support, because it doesn't work on 1.9.x (see simplecov)
157
-
158
- <em>1.0.0</em>
159
- * added templates
160
- * changed rdoc and yard tasks to use +require_paths+ instead of +files+
161
- * more tests
162
- * more documentation
163
-
164
- <em>0.0.2</em>
165
- * minor fixes
166
-
167
- <em>0.0.1</em>
168
- * first release
169
-
170
- == LICENSE
171
-
172
- Copyright (c) 2010-2017 John Lees-Miller
173
-
174
- Permission is hereby granted, free of charge, to any person obtaining
175
- a copy of this software and associated documentation files (the
176
- 'Software'), to deal in the Software without restriction, including
177
- without limitation the rights to use, copy, modify, merge, publish,
178
- distribute, sublicense, and/or sell copies of the Software, and to
179
- permit persons to whom the Software is furnished to do so, subject to
180
- the following conditions:
181
-
182
- The above copyright notice and this permission notice shall be
183
- included in all copies or substantial portions of the Software.
184
-
185
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
186
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
187
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
188
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
189
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
190
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
191
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.