ggem 1.8.4 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- data.tar.gz: e70497f9bf7cfa2b860ba621446d5fd64157b388
4
- metadata.gz: 99171d84a31b835e65a86d540e7a789616c2370e
5
- SHA512:
6
- data.tar.gz: 20fc8d088d476ecb8864fbcf8feaf34c23449ec482e23b51345429794378400eba1a93d2d660d18138c74ae9ce4b780aff8c5cd099c631fd2d5a492060805a72
7
- metadata.gz: 848dd46e4e63ab74784a0c83fd79bae2a109aa37ad5713047fd06a8fecf6c00ca0846e1986fc633f004fd4baf861235c28730290b9dc10db5bb759a1dfad3328
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bb8dc845b435566b7087e4965db63b2f7748a2dad1c71fc23d4a3723716d1a4d
4
+ data.tar.gz: b6ec3468d1fa99ce0186ce9d2dbe80d22083c10f59ef323c264ef99f8e5c687a
5
+ SHA512:
6
+ metadata.gz: c2a6d656edc4b1fa4cd9522c15640653946acb3c4c8430e1c343c80ddc0794e41adad78d7f6270c399685917b1e9e151b9e7c1848c38cb8fd9b96a26b205457c
7
+ data.tar.gz: 19b1b2c5ca9b4b886d68235309756dcff13cf8e2c026aa10e764a62b7a865f8480ffc812d34febf89707432a6638a3c71b4ea8841b570fcaa0834eb620dc3453
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ ruby '> 1.8'
4
+
3
5
  gemspec
4
6
 
5
- gem 'pry', "~> 0.9.0"
7
+ gem "pry", "~> 0.11.3"
data/README.md CHANGED
@@ -58,6 +58,9 @@ The `generate` command creates a folder and files for developing, testing, and r
58
58
  * adds `TODO` entries in files where user input is needed
59
59
  * source control using [Git](https://git-scm.com/)
60
60
  * test using [Assert](https://github.com/redding/assert)
61
+ * CI with CircleCI
62
+ * see `.circleci/config.yml`
63
+ * need to replace `/todo_org_name` with the gem's org name (ie `/redding`)
61
64
 
62
65
  You can also call this command using the `g` alias: `ggem g -h`.
63
66
 
@@ -114,7 +117,7 @@ To override the default `https://rubygems.org` push host, add a metadata entry t
114
117
 
115
118
  ```ruby
116
119
  # ...
117
- gem.metadata['allowed_push_host'] = "https://gems.example.com"
120
+ gem.metadata["allowed_push_host"] = "https://gems.example.com"
118
121
  # ...
119
122
  ```
120
123
 
@@ -175,6 +178,6 @@ $ gem install ggem
175
178
 
176
179
  1. Fork it
177
180
  2. Create your feature branch (`git checkout -b my-new-feature`)
178
- 3. Commit your changes (`git commit -am 'Added some feature'`)
181
+ 3. Commit your changes (`git commit -am "Added some feature"`)
179
182
  4. Push to the branch (`git push origin my-new-feature`)
180
183
  5. Create new Pull Request
data/bin/ggem CHANGED
@@ -3,5 +3,5 @@
3
3
  # Copyright (c) 2008-Present Kelly Redding
4
4
  #
5
5
 
6
- require 'ggem/cli'
6
+ require "ggem/cli"
7
7
  GGem::CLI.run ARGV
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "ggem/version"
5
5
 
@@ -11,14 +11,16 @@ Gem::Specification.new do |gem|
11
11
  gem.summary = %q{"Juh Gem", baby! (a gem utility CLI)}
12
12
  gem.description = %q{"Juh Gem", baby! (a gem utility CLI)}
13
13
  gem.homepage = "http://github.com/redding/ggem"
14
- gem.license = 'MIT'
14
+ gem.license = "MIT"
15
15
 
16
- gem.files = `git ls-files`.split($/)
16
+ gem.files = `git ls-files | grep "^[^.]"`.split($/)
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_development_dependency("assert", ["~> 2.16.3"])
21
+ gem.required_ruby_version = '> 1.8'
22
+
23
+ gem.add_development_dependency("assert", ["~> 2.17.0"])
22
24
 
23
25
  gem.add_dependency("much-plugin", ["~> 0.2.0"])
24
26
  gem.add_dependency("scmd", ["~> 3.0.3"])
@@ -1,2 +1,2 @@
1
- require 'ggem/version'
2
- require 'ggem/gem'
1
+ require "ggem/version"
2
+ require "ggem/gem"
@@ -1,18 +1,18 @@
1
- require 'ggem/version'
2
- require 'ggem/cli/clirb'
3
- require 'ggem/cli/commands'
1
+ require "ggem/version"
2
+ require "ggem/cli/clirb"
3
+ require "ggem/cli/commands"
4
4
 
5
5
  module GGem
6
6
 
7
7
  class CLI
8
8
 
9
9
  COMMANDS = CommandSet.new{ |unknown| InvalidCommand.new(unknown) }.tap do |c|
10
- c.add(GenerateCommand, 'generate', 'g')
11
- c.add(BuildCommand, 'build', 'b')
12
- c.add(InstallCommand, 'install', 'i')
13
- c.add(PushCommand, 'push', 'p')
14
- c.add(TagCommand, 'tag', 't')
15
- c.add(ReleaseCommand, 'release', 'r')
10
+ c.add(GenerateCommand, "generate", "g")
11
+ c.add(BuildCommand, "build", "b")
12
+ c.add(InstallCommand, "install", "i")
13
+ c.add(PushCommand, "push", "p")
14
+ c.add(TagCommand, "tag", "t")
15
+ c.add(ReleaseCommand, "release", "r")
16
16
  end
17
17
 
18
18
  def self.run(args)
@@ -52,7 +52,7 @@ module GGem
52
52
  private
53
53
 
54
54
  def display_debug(exception)
55
- if ENV['DEBUG']
55
+ if ENV["DEBUG"]
56
56
  @stderr.puts "#{exception.class}: #{exception.message}"
57
57
  @stderr.puts exception.backtrace.join("\n")
58
58
  end
@@ -8,13 +8,13 @@ class GGem::CLI
8
8
 
9
9
  def initialize(&block)
10
10
  @options = []; instance_eval(&block) if block
11
- require 'optparse'
11
+ require "optparse"
12
12
  @data, @args, @opts = [], [], {}; @parser = OptionParser.new do |p|
13
- p.banner = ''; @options.each do |o|
13
+ p.banner = ""; @options.each do |o|
14
14
  @opts[o.name] = o.value; p.on(*o.parser_args){ |v| @opts[o.name] = v }
15
15
  end
16
- p.on_tail('--version', ''){ |v| raise VersionExit, v.to_s }
17
- p.on_tail('--help', ''){ |v| raise HelpExit, v.to_s }
16
+ p.on_tail("--version", ""){ |v| raise VersionExit, v.to_s }
17
+ p.on_tail("--help", ""){ |v| raise HelpExit, v.to_s }
18
18
  end
19
19
  end
20
20
 
@@ -27,14 +27,14 @@ class GGem::CLI
27
27
  end
28
28
  def to_s; @parser.to_s; end
29
29
  def inspect
30
- "#<#{self.class}:#{'0x0%x' % (object_id << 1)} @data=#{@data.inspect}>"
30
+ "#<#{self.class}:#{"0x0%x" % (object_id << 1)} @data=#{@data.inspect}>"
31
31
  end
32
32
 
33
33
  class Option
34
34
  attr_reader :name, :opt_name, :desc, :abbrev, :value, :klass, :parser_args
35
35
 
36
36
  def initialize(name, *args)
37
- settings, @desc = args.last.kind_of?(::Hash) ? args.pop : {}, args.pop || ''
37
+ settings, @desc = args.last.kind_of?(::Hash) ? args.pop : {}, args.pop || ""
38
38
  @name, @opt_name, @abbrev = parse_name_values(name, settings[:abbrev])
39
39
  @value, @klass = gvalinfo(settings[:value])
40
40
  @parser_args = if [TrueClass, FalseClass, NilClass].include?(@klass)
@@ -47,8 +47,8 @@ class GGem::CLI
47
47
  private
48
48
 
49
49
  def parse_name_values(name, custom_abbrev)
50
- [ (processed_name = name.to_s.strip.downcase), processed_name.gsub('_', '-'),
51
- custom_abbrev || processed_name.gsub(/[^a-z]/, '').chars.first || 'a'
50
+ [ (processed_name = name.to_s.strip.downcase), processed_name.gsub("_", "-"),
51
+ custom_abbrev || processed_name.gsub(/[^a-z]/, "").chars.first || "a"
52
52
  ]
53
53
  end
54
54
  def gvalinfo(v); v.kind_of?(Class) ? [nil,gklass(v)] : [v,gklass(v.class)]; end
@@ -1,5 +1,5 @@
1
- require 'ggem/cli/clirb'
2
- require 'much-plugin'
1
+ require "ggem/cli/clirb"
2
+ require "much-plugin"
3
3
 
4
4
  module GGem; end
5
5
  class GGem::CLI
@@ -21,7 +21,7 @@ class GGem::CLI
21
21
  def run(argv)
22
22
  @clirb.parse!([@name, argv].flatten.compact)
23
23
  raise CLIRB::HelpExit if @name.to_s.empty?
24
- raise InvalidCommandError, "'#{self.name}' is not a command."
24
+ raise InvalidCommandError, "`#{self.name}` is not a command."
25
25
  end
26
26
 
27
27
  def help
@@ -55,7 +55,7 @@ class GGem::CLI
55
55
  end
56
56
 
57
57
  def summary
58
- ''
58
+ ""
59
59
  end
60
60
 
61
61
  end
@@ -80,7 +80,7 @@ class GGem::CLI
80
80
 
81
81
  def cmd(&cmd_block)
82
82
  cmd, status, output = cmd_block.call
83
- if ENV['DEBUG']
83
+ if ENV["DEBUG"]
84
84
  @stdout.puts cmd
85
85
  @stdout.puts output
86
86
  end
@@ -103,7 +103,7 @@ class GGem::CLI
103
103
  def initialize(*args)
104
104
  super
105
105
 
106
- require 'ggem/git_repo'
106
+ require "ggem/git_repo"
107
107
  @repo = GGem::GitRepo.new(Dir.pwd)
108
108
  end
109
109
 
@@ -128,7 +128,7 @@ class GGem::CLI
128
128
  super
129
129
 
130
130
  begin
131
- require 'ggem/gem'
131
+ require "ggem/gem"
132
132
  path = GGem::Gem.new(Dir.pwd, @clirb.args.first).save!.path
133
133
  @stdout.puts "created gem in #{path}"
134
134
  rescue GGem::Gem::NoNameError => exception
@@ -167,7 +167,7 @@ class GGem::CLI
167
167
  def initialize(*args)
168
168
  super
169
169
 
170
- require 'ggem/gemspec'
170
+ require "ggem/gemspec"
171
171
  begin
172
172
  @spec = GGem::Gemspec.new(Dir.pwd)
173
173
  rescue GGem::Gemspec::NotFoundError => exception
@@ -288,8 +288,8 @@ class GGem::CLI
288
288
 
289
289
  def initialize
290
290
  super do
291
- option 'force-tag', 'force tagging even with uncommitted files', {
292
- :abbrev => 'f'
291
+ option "force-tag", "force tagging even with uncommitted files", {
292
+ :abbrev => "f"
293
293
  }
294
294
  end
295
295
  end
@@ -311,7 +311,7 @@ class GGem::CLI
311
311
  cmd{ @repo.run_validate_committed_cmd }
312
312
  rescue GGem::GitRepo::CmdError => err
313
313
  @stderr.puts "There are files that need to be committed first."
314
- if self.clirb.opts['force-tag']
314
+ if self.clirb.opts["force-tag"]
315
315
  @stderr.puts "Forcing tag anyway..."
316
316
  else
317
317
  raise CommandExitError
@@ -360,7 +360,7 @@ class GGem::CLI
360
360
 
361
361
  def run(argv, *args)
362
362
  super
363
- @tag_command.run(self.clirb.opts['force-tag'] ? ['--force-tag'] : [])
363
+ @tag_command.run(self.clirb.opts["force-tag"] ? ["--force-tag"] : [])
364
364
  @push_command.run([])
365
365
  end
366
366
 
@@ -392,13 +392,13 @@ class GGem::CLI
392
392
  begin
393
393
  cmd = klass.new
394
394
  rescue StandardError => err
395
- # don't add any commands you can't init
395
+ # don"t add any commands you can't init
396
396
  else
397
397
  ([name] + aliases).each{ |n| @lookup[n] = cmd }
398
398
  @to_s = nil
399
399
  @names << name
400
- @aliases[name] = aliases.empty? ? '' : "(#{aliases.join(', ')})"
401
- @summaries[name] = cmd.summary.to_s.empty? ? '' : "# #{cmd.summary}"
400
+ @aliases[name] = aliases.empty? ? "" : "(#{aliases.join(", ")})"
401
+ @summaries[name] = cmd.summary.to_s.empty? ? "" : "# #{cmd.summary}"
402
402
  end
403
403
  end
404
404
 
@@ -1,5 +1,5 @@
1
- require 'fileutils'
2
- require 'ggem/template'
1
+ require "fileutils"
2
+ require "ggem/template"
3
3
 
4
4
  module GGem
5
5
 
@@ -22,8 +22,8 @@ module GGem
22
22
 
23
23
  def module_name
24
24
  transforms = {
25
- '_' => '',
26
- '-' => ''
25
+ "_" => "",
26
+ "-" => ""
27
27
  }
28
28
  @module_name ||= transform_name(transforms){ |part| part.capitalize }
29
29
  end
@@ -36,8 +36,8 @@ module GGem
36
36
 
37
37
  def normalize_name(name)
38
38
  und_camelcs = [ /([A-Z])([a-z])/, '_\1\2' ]
39
- rm_dup_und = [ /_+/, '_' ]
40
- rm_lead_und = [ /^_/, '' ]
39
+ rm_dup_und = [ /_+/, "_" ]
40
+ rm_lead_und = [ /^_/, "" ]
41
41
  name.gsub(*und_camelcs).gsub(*rm_dup_und).sub(*rm_lead_und).downcase
42
42
  end
43
43
 
@@ -1,13 +1,13 @@
1
- require 'pathname'
2
- require 'scmd'
1
+ require "pathname"
2
+ require "scmd"
3
3
 
4
4
  module GGem
5
5
 
6
6
  class Gemspec
7
7
 
8
- PUSH_HOST_META_KEY = 'allowed_push_host'
9
- DEFAULT_PUSH_HOST = 'https://rubygems.org'.freeze
10
- BUILD_TO_DIRNAME = 'pkg'.freeze
8
+ PUSH_HOST_META_KEY = "allowed_push_host"
9
+ DEFAULT_PUSH_HOST = "https://rubygems.org".freeze
10
+ BUILD_TO_DIRNAME = "pkg".freeze
11
11
 
12
12
  attr_reader :path, :name, :version, :version_tag
13
13
  attr_reader :gem_file_name, :gem_file, :push_host
@@ -69,7 +69,7 @@ module GGem
69
69
  end
70
70
 
71
71
  def get_push_host(spec)
72
- ENV['GGEM_PUSH_HOST'] || get_meta(spec)[PUSH_HOST_META_KEY] || DEFAULT_PUSH_HOST
72
+ ENV["GGEM_PUSH_HOST"] || get_meta(spec)[PUSH_HOST_META_KEY] || DEFAULT_PUSH_HOST
73
73
  end
74
74
 
75
75
  def get_meta(spec)
@@ -1,5 +1,5 @@
1
- require 'pathname'
2
- require 'scmd'
1
+ require "pathname"
2
+ require "scmd"
3
3
 
4
4
  module GGem
5
5
 
@@ -1,5 +1,5 @@
1
- require 'erb'
2
- require 'fileutils'
1
+ require "erb"
2
+ require "fileutils"
3
3
 
4
4
  module GGem
5
5
 
@@ -11,6 +11,7 @@ module GGem
11
11
 
12
12
  def save
13
13
  save_folder # (gem root path)
14
+ save_folder ".circleci"
14
15
  save_folder "lib/#{@gem.ruby_name}"
15
16
  save_folder "test/support"
16
17
  save_folder "test/system"
@@ -18,20 +19,24 @@ module GGem
18
19
  save_folder "log"
19
20
  save_folder "tmp"
20
21
 
21
- save_file('gitignore.erb', '.gitignore')
22
- save_file('Gemfile.erb', 'Gemfile')
23
- save_file('gemspec.erb', "#{@gem.name}.gemspec")
24
- save_file('README.md.erb', 'README.md')
25
- save_file('LICENSE.erb', 'LICENSE')
22
+ save_file("circleci_config.yml.erb", ".circleci/config.yml")
26
23
 
27
- save_file('lib.rb.erb', "lib/#{@gem.ruby_name}.rb")
28
- save_file('lib_version.rb.erb', "lib/#{@gem.ruby_name}/version.rb")
24
+ save_file("gitignore.erb", ".gitignore")
25
+ save_file("Gemfile.erb", "Gemfile")
26
+ save_file("gemspec.erb", "#{@gem.name}.gemspec")
27
+ save_file("README.md.erb", "README.md")
28
+ save_file("LICENSE.erb", "LICENSE")
29
29
 
30
- save_file('test_helper.rb.erb', 'test/helper.rb')
31
- save_file('test_support_factory.rb.erb', 'test/support/factory.rb')
30
+ save_file("lib.rb.erb", "lib/#{@gem.ruby_name}.rb")
31
+ save_file("lib_version.rb.erb", "lib/#{@gem.ruby_name}/version.rb")
32
32
 
33
- save_empty_file('log/.gitkeep')
34
- save_empty_file('tmp/.gitkeep')
33
+ save_file("test_helper.rb.erb", "test/helper.rb")
34
+ save_file("test_support_factory.rb.erb", "test/support/factory.rb")
35
+
36
+ save_empty_file("log/.gitkeep")
37
+ save_empty_file("test/system/.gitkeep")
38
+ save_empty_file("test/unit/.gitkeep")
39
+ save_empty_file("tmp/.gitkeep")
35
40
  end
36
41
 
37
42
  private
@@ -47,15 +52,15 @@ module GGem
47
52
  end
48
53
 
49
54
  def save_file(source, output)
50
- source_file = File.join(File.dirname(__FILE__), 'template_file', source)
55
+ source_file = File.join(File.dirname(__FILE__), "template_file", source)
51
56
  output_file = File.join(@gem.root_path, @gem.name, output)
52
57
 
53
58
  if File.exists?(source_file)
54
59
  FileUtils.mkdir_p(File.dirname(output_file))
55
60
  erb = ERB.new(File.read(source_file))
56
- File.open(output_file, 'w') {|f| f << erb.result(binding) }
61
+ File.open(output_file, "w") {|f| f << erb.result(binding) }
57
62
  else
58
- raise ArgumentError, "the source file '#{source_file}' does not exist"
63
+ raise ArgumentError, "the source file `#{source_file}` does not exist"
59
64
  end
60
65
  end
61
66
 
@@ -2,4 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'pry', "~> 0.9.0"
5
+ gem "pry", "~> 0.11.3"
@@ -10,7 +10,7 @@ TODO: Write code samples and usage instructions here
10
10
 
11
11
  Add this line to your application's Gemfile:
12
12
 
13
- gem '<%= @gem.name %>'
13
+ gem "<%= @gem.name %>"
14
14
 
15
15
  And then execute:
16
16
 
@@ -24,6 +24,6 @@ Or install it yourself as:
24
24
 
25
25
  1. Fork it
26
26
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Added some feature'`)
27
+ 3. Commit your changes (`git commit -am "Added some feature"`)
28
28
  4. Push to the branch (`git push origin my-new-feature`)
29
29
  5. Create new Pull Request
@@ -0,0 +1,82 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+
7
+ jobs:
8
+ test_ruby_2.3.7:
9
+ working_directory: ~/todo_org_name/<%= @gem.name %>/ruby-2.3.7
10
+ docker:
11
+ - image: circleci/ruby:2.3.7
12
+ steps:
13
+ - checkout
14
+ - restore_cache:
15
+ keys:
16
+ - ruby-2.3.7-dependencies
17
+ - run:
18
+ name: install dependencies
19
+ command: |
20
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
21
+ - save_cache:
22
+ paths:
23
+ - ./vendor/bundle
24
+ key: ruby-2.3.7-dependencies
25
+ - run:
26
+ name: run Assert test suite
27
+ command: |
28
+ ruby -v
29
+ bundle exec assert
30
+
31
+ test_ruby_2.4.5:
32
+ working_directory: ~/todo_org_name/<%= @gem.name %>/ruby-2.4.5
33
+ docker:
34
+ - image: circleci/ruby:2.4.5
35
+ steps:
36
+ - checkout
37
+ - restore_cache:
38
+ keys:
39
+ - ruby-2.4.5-dependencies
40
+ - run:
41
+ name: install dependencies
42
+ command: |
43
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
44
+ - save_cache:
45
+ paths:
46
+ - ./vendor/bundle
47
+ key: ruby-2.4.5-dependencies
48
+ - run:
49
+ name: run Assert test suite
50
+ command: |
51
+ ruby -v
52
+ bundle exec assert
53
+
54
+ test_ruby_2.5.3:
55
+ working_directory: ~/todo_org_name/<%= @gem.name %>/ruby-2.5.3
56
+ docker:
57
+ - image: circleci/ruby:2.5.3
58
+ steps:
59
+ - checkout
60
+ - restore_cache:
61
+ keys:
62
+ - ruby-2.5.3-dependencies
63
+ - run:
64
+ name: install dependencies
65
+ command: |
66
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
67
+ - save_cache:
68
+ paths:
69
+ - ./vendor/bundle
70
+ key: ruby-2.5.3-dependencies
71
+ - run:
72
+ name: run Assert test suite
73
+ command: |
74
+ ruby -v
75
+ bundle exec assert
76
+ workflows:
77
+ version: 2
78
+ test_ruby_versions:
79
+ jobs:
80
+ - test_ruby_2.3.7
81
+ - test_ruby_2.4.5
82
+ - test_ruby_2.5.3