ggem 1.9.0 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
5
+ ruby "~> 2.5"
6
+
3
7
  gemspec
4
8
 
5
- gem "pry", "~> 0.11.3"
9
+ gem "pry"
@@ -1,4 +1,4 @@
1
- # <%= @gem.module_name %>
1
+ # <%= @ggem.module_name %>
2
2
 
3
3
  TODO: Write a gem description
4
4
 
@@ -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 "<%= @ggem.name %>"
14
14
 
15
15
  And then execute:
16
16
 
@@ -18,7 +18,7 @@ And then execute:
18
18
 
19
19
  Or install it yourself as:
20
20
 
21
- $ gem install <%= @gem.name %>
21
+ $ gem install <%= @ggem.name %>
22
22
 
23
23
  ## Contributing
24
24
 
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # -*- encoding: utf-8 -*-
2
4
  lib = File.expand_path("../lib", __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "<%= @gem.ruby_name %>/version"
6
+ require "<%= @ggem.ruby_name %>/version"
5
7
 
6
8
  Gem::Specification.new do |gem|
7
- gem.name = "<%= @gem.name %>"
8
- gem.version = <%= @gem.module_name %>::VERSION
9
+ gem.name = "<%= @ggem.name %>"
10
+ gem.version = <%= @ggem.module_name %>::VERSION
9
11
  gem.authors = ["TODO: authors"]
10
12
  gem.email = ["TODO: emails"]
11
13
  gem.summary = "TODO: Write a gem summary"
@@ -13,12 +15,14 @@ Gem::Specification.new do |gem|
13
15
  gem.homepage = "TODO: homepage"
14
16
  gem.license = "MIT"
15
17
 
16
- gem.files = `git ls-files`.split($/)
18
+ gem.files = `git ls-files | grep "^[^.]"`.split($/)
17
19
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
20
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
21
  gem.require_paths = ["lib"]
20
22
 
21
- gem.add_development_dependency("assert", ["~> 2.16.5"])
22
- # TODO: gem.add_dependency("gem-name", ["~> 0.0.0"])
23
+ gem.required_ruby_version = "~> 2.5"
23
24
 
25
+ gem.add_development_dependency("assert", ["~> 2.19.2"])
26
+
27
+ # TODO: gem.add_dependency("gem-name", ["~> 0.0.0"])
24
28
  end
@@ -1,5 +1,7 @@
1
- require "<%= @gem.ruby_name %>/version"
1
+ # frozen_string_literal: true
2
2
 
3
- module <%= @gem.module_name %>
3
+ require "<%= @ggem.ruby_name %>/version"
4
+
5
+ module <%= @ggem.module_name %>
4
6
  # TODO: your code goes here...
5
7
  end
@@ -1,3 +1,5 @@
1
- module <%= @gem.module_name %>
1
+ # frozen_string_literal: true
2
+
3
+ module <%= @ggem.module_name %>
2
4
  VERSION = "0.0.1"
3
5
  end
@@ -1,10 +1,12 @@
1
- # this file is automatically required when you run `assert`
2
- # put any test helpers here
1
+ # frozen_string_literal: true
3
2
 
4
- # add the root dir to the load path
3
+ # This file is automatically required when you run `assert`; put any test
4
+ # helpers here.
5
+
6
+ # Add the root dir to the load path.
5
7
  $LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
6
8
 
7
- # require pry for debugging (`binding.pry`)
9
+ # Require pry for debugging (`binding.pry`).
8
10
  require "pry"
9
11
 
10
12
  require "test/support/factory"
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert/factory"
2
4
 
3
5
  module Factory
4
6
  extend Assert::Factory
5
-
6
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GGem
2
- VERSION = "1.9.0"
4
+ VERSION = "1.9.5"
3
5
  end
File without changes
@@ -1,14 +1,16 @@
1
- # this file is automatically required when you run `assert`
2
- # put any test helpers here
1
+ # frozen_string_literal: true
3
2
 
4
- # add the root dir to the load path
3
+ # This file is automatically required when you run `assert`; put any test
4
+ # helpers here.
5
+
6
+ # Add the root dir to the load path.
5
7
  require "pathname"
6
8
  ROOT_PATH = Pathname.new(File.expand_path("../..", __FILE__))
7
9
  $LOAD_PATH.unshift(ROOT_PATH.to_s)
8
10
  TMP_PATH = ROOT_PATH.join("tmp")
9
11
  TEST_SUPPORT_PATH = ROOT_PATH.join("test/support")
10
12
 
11
- # require pry for debugging (`binding.pry`)
13
+ # Require pry for debugging (`binding.pry`).
12
14
  require "pry"
13
15
 
14
16
  require "test/support/factory"
@@ -1,53 +1,50 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "much-plugin"
2
4
  require "scmd"
3
5
 
4
- module GGem
5
-
6
- module CmdTestsHelpers
7
- include MuchPlugin
6
+ module GGem; end
7
+ module GGem::CmdTestsHelpers
8
+ include MuchPlugin
8
9
 
9
- plugin_included do
10
- setup do
11
- ENV["SCMD_TEST_MODE"] = "1"
10
+ plugin_included do
11
+ setup do
12
+ ENV["SCMD_TEST_MODE"] = "1"
12
13
 
13
- @cmd_spy = nil
14
- Scmd.reset
14
+ @cmd_spy = nil
15
+ Scmd.reset
15
16
 
16
- @exp_cmds_run = []
17
- end
18
- teardown do
19
- Scmd.reset
20
- ENV.delete("SCMD_TEST_MODE")
21
- end
17
+ @exp_cmds_run = []
18
+ end
19
+ teardown do
20
+ Scmd.reset
21
+ ENV.delete("SCMD_TEST_MODE")
22
+ end
22
23
 
23
- private
24
+ private
24
25
 
25
- def assert_exp_cmds_run(&run_cmd_block)
26
- cmd_str, exitstatus, stdout = run_cmd_block.call
27
- assert_equal @exp_cmds_run, Scmd.calls.map(&:cmd_str)
26
+ def assert_exp_cmds_run(&run_cmd_block)
27
+ cmd_str, exitstatus, stdout = run_cmd_block.call
28
+ assert_equal @exp_cmds_run, Scmd.calls.map(&:cmd_str)
28
29
 
29
- assert_equal Scmd.calls.first.cmd_str, cmd_str
30
- assert_equal Scmd.calls.first.cmd.exitstatus, exitstatus
31
- assert_equal Scmd.calls.first.cmd.stdout, stdout
32
- end
30
+ assert_equal Scmd.calls.first.cmd_str, cmd_str
31
+ assert_equal Scmd.calls.first.cmd.exitstatus, exitstatus
32
+ assert_equal Scmd.calls.first.cmd.stdout, stdout
33
+ end
33
34
 
34
- def assert_exp_cmds_error(cmd_error_class, &run_cmd_block)
35
- err_cmd_str = @exp_cmds_run.sample
36
- Scmd.add_command(err_cmd_str) do |cmd|
37
- cmd.exitstatus = 1
38
- cmd.stderr = Factory.string
39
- @cmd_spy = cmd
40
- end
41
- err = nil
42
- begin; run_cmd_block.call; rescue StandardError => err; end
43
-
44
- assert_kind_of cmd_error_class, err
45
- exp = "#{@cmd_spy.cmd_str}\n#{@cmd_spy.stderr}"
46
- assert_equal exp, err.message
35
+ def assert_exp_cmds_error(cmd_error_class, &run_cmd_block)
36
+ err_cmd_str = @exp_cmds_run.sample
37
+ Scmd.add_command(err_cmd_str) do |cmd|
38
+ cmd.exitstatus = 1
39
+ cmd.stderr = Factory.string
40
+ @cmd_spy = cmd
47
41
  end
42
+ err = nil
43
+ begin; run_cmd_block.call; rescue StandardError => err; end
48
44
 
45
+ assert_kind_of cmd_error_class, err
46
+ exp = "#{@cmd_spy.cmd_str}\n#{@cmd_spy.stderr}"
47
+ assert_equal exp, err.message
49
48
  end
50
-
51
49
  end
52
-
53
50
  end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert/factory"
2
4
 
3
5
  module Factory
4
6
  extend Assert::Factory
5
-
6
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # -*- encoding: utf-8 -*-
2
4
  Gem::Specification.new do |gem|
3
5
  gem.name = "gem1"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # -*- encoding: utf-8 -*-
2
4
  Gem::Specification.new do |gem|
3
5
  gem.name = "gem2"
@@ -1,72 +1,69 @@
1
- module GGem
2
- module NameSet
1
+ # frozen_string_literal: true
3
2
 
4
- class Base
5
- attr_reader :variations, :name, :module_name, :ruby_name
3
+ module GGem; end
4
+ module GGem::NameSet
5
+ class Base
6
+ attr_reader :variations, :name, :module_name, :ruby_name
6
7
 
7
- def expected_folders
8
- [ "",
9
- ".circleci",
10
- "lib",
11
- "lib/#{@ruby_name}",
12
- "test",
13
- "test/support",
14
- "test/system",
15
- "test/unit",
16
- "log",
17
- "tmp"
18
- ]
19
- end
20
-
21
- def expected_files
22
- [ ".circleci/config.yml",
8
+ def expected_folders
9
+ [ "",
10
+ "lib",
11
+ "lib/#{@ruby_name}",
12
+ "test",
13
+ "test/support",
14
+ "test/system",
15
+ "test/unit",
16
+ "log",
17
+ "tmp"
18
+ ]
19
+ end
23
20
 
24
- ".gitignore",
25
- "Gemfile",
26
- "#{@name}.gemspec",
27
- "README.md",
28
- "LICENSE",
21
+ def expected_files
22
+ [ ".ruby-version",
23
+ ".gitignore",
24
+ "Gemfile",
25
+ "#{@name}.gemspec",
26
+ "README.md",
27
+ "LICENSE",
29
28
 
30
- "lib/#{@ruby_name}.rb",
31
- "lib/#{@ruby_name}/version.rb",
29
+ "lib/#{@ruby_name}.rb",
30
+ "lib/#{@ruby_name}/version.rb",
32
31
 
33
- "test/helper.rb",
34
- "test/support/factory.rb",
32
+ "test/helper.rb",
33
+ "test/support/factory.rb",
35
34
 
36
- "log/.gitkeep",
37
- "test/system/.gitkeep",
38
- "test/unit/.gitkeep",
39
- "tmp/.gitkeep",
40
- ]
41
- end
35
+ "log/.keep",
36
+ "test/system/.keep",
37
+ "test/unit/.keep",
38
+ "tmp/.keep",
39
+ ]
42
40
  end
41
+ end
43
42
 
44
- class Simple < Base
45
- def initialize
46
- @variations = ["simple"]
47
- @name = "simple"
48
- @module_name = "Simple"
49
- @ruby_name = "simple"
50
- end
43
+ class Simple < Base
44
+ def initialize
45
+ @variations = ["simple"]
46
+ @name = "simple"
47
+ @module_name = "Simple"
48
+ @ruby_name = "simple"
51
49
  end
50
+ end
52
51
 
53
- class Underscored < Base
54
- def initialize
55
- @variations = ["my_gem", "my__gem", "MyGem", "myGem", "My_Gem"]
56
- @name = "my_gem"
57
- @module_name = "MyGem"
58
- @ruby_name = "my_gem"
59
- end
52
+ class Underscored < Base
53
+ def initialize
54
+ @variations = ["my_gem", "my__gem", "MyGem", "myGem", "My_Gem"]
55
+ @name = "my_gem"
56
+ @module_name = "MyGem"
57
+ @ruby_name = "my_gem"
60
58
  end
59
+ end
61
60
 
62
- class HyphenatedOther < Base
63
- def initialize
64
- @variations = ["my-gem"]
65
- @name = "my-gem"
66
- @module_name = "MyGem"
67
- @ruby_name = "my-gem"
68
- end
61
+ class HyphenatedOther < Base
62
+ def initialize
63
+ @variations = ["my-gem"]
64
+ @name = "my-gem"
65
+ @module_name = "MyGem"
66
+ @ruby_name = "my-gem"
69
67
  end
70
-
71
68
  end
72
69
  end
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "ggem"
3
5
 
4
6
  require "test/support/name_set"
5
7
 
6
8
  module GGem
7
-
8
9
  class SystemTests < Assert::Context
9
10
 
10
11
  NS_SIMPLE = GGem::NameSet::Simple
@@ -12,7 +13,6 @@ module GGem
12
13
  NS_HYPHEN = GGem::NameSet::HyphenatedOther
13
14
 
14
15
  desc "GGem"
15
-
16
16
  end
17
17
 
18
18
  class GemTests < SystemTests
@@ -34,7 +34,6 @@ module GGem
34
34
  assert_equal name_set.ruby_name, the_gem.ruby_name
35
35
  end
36
36
  end
37
-
38
37
  end
39
38
 
40
39
  class GemSaveTests < GemTests
@@ -67,7 +66,5 @@ module GGem
67
66
  assert File.exists?(path), "`#{path}` does not exist"
68
67
  end
69
68
  end
70
-
71
69
  end
72
-
73
70
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "ggem/cli"
3
5
 
@@ -9,7 +11,6 @@ require "ggem/git_repo"
9
11
  require "much-plugin"
10
12
 
11
13
  class GGem::CLI
12
-
13
14
  class UnitTests < Assert::Context
14
15
  desc "GGem::CLI"
15
16
  setup do
@@ -47,7 +48,6 @@ class GGem::CLI
47
48
  assert_same COMMANDS["tag"], COMMANDS["t"]
48
49
  assert_same COMMANDS["release"], COMMANDS["r"]
49
50
  end
50
-
51
51
  end
52
52
 
53
53
  class InitTests < UnitTests
@@ -62,7 +62,6 @@ class GGem::CLI
62
62
  subject{ @cli }
63
63
 
64
64
  should have_imeths :run
65
-
66
65
  end
67
66
 
68
67
  class RunSetupTests < InitTests
@@ -80,7 +79,6 @@ class GGem::CLI
80
79
  teardown do
81
80
  COMMANDS.remove(@command_name)
82
81
  end
83
-
84
82
  end
85
83
 
86
84
  class RunTests < RunSetupTests
@@ -96,7 +94,6 @@ class GGem::CLI
96
94
  should "have successfully exited" do
97
95
  assert_equal 0, @kernel_spy.exit_status
98
96
  end
99
-
100
97
  end
101
98
 
102
99
  class RunWithNoArgsTests < RunSetupTests
@@ -113,7 +110,6 @@ class GGem::CLI
113
110
  should "have successfully exited" do
114
111
  assert_equal 0, @kernel_spy.exit_status
115
112
  end
116
-
117
113
  end
118
114
 
119
115
  class RunWithInvalidCommandTests < RunSetupTests
@@ -133,7 +129,6 @@ class GGem::CLI
133
129
  should "have unsuccessfully exited" do
134
130
  assert_equal 1, @kernel_spy.exit_status
135
131
  end
136
-
137
132
  end
138
133
 
139
134
  class RunWithCommandExitErrorTests < RunSetupTests
@@ -147,7 +142,6 @@ class GGem::CLI
147
142
  assert_equal 1, @kernel_spy.exit_status
148
143
  assert_empty @stderr.read
149
144
  end
150
-
151
145
  end
152
146
 
153
147
  class RunWithHelpTests < RunSetupTests
@@ -164,7 +158,6 @@ class GGem::CLI
164
158
  should "have successfully exited" do
165
159
  assert_equal 0, @kernel_spy.exit_status
166
160
  end
167
-
168
161
  end
169
162
 
170
163
  class RunWithVersionTests < RunSetupTests
@@ -181,7 +174,6 @@ class GGem::CLI
181
174
  should "have successfully exited" do
182
175
  assert_equal 0, @kernel_spy.exit_status
183
176
  end
184
-
185
177
  end
186
178
 
187
179
  class RunWithErrorTests < RunSetupTests
@@ -201,7 +193,6 @@ class GGem::CLI
201
193
  should "have unsuccessfully exited" do
202
194
  assert_equal 1, @kernel_spy.exit_status
203
195
  end
204
-
205
196
  end
206
197
 
207
198
  class InvalidCommandTests < UnitTests
@@ -247,7 +238,6 @@ class GGem::CLI
247
238
  "#{COMMANDS.to_s.split("\n").map{ |l| " #{l}" }.join("\n")}\n"
248
239
  assert_equal exp, subject.help
249
240
  end
250
-
251
241
  end
252
242
 
253
243
  class IOCommandTests < UnitTests
@@ -256,7 +246,6 @@ class GGem::CLI
256
246
  @stdout, @stderr = IOSpy.new, IOSpy.new
257
247
  end
258
248
  subject{ @cmd }
259
-
260
249
  end
261
250
 
262
251
  class ValidCommandTests < IOCommandTests
@@ -289,7 +278,6 @@ class GGem::CLI
289
278
  should "default its summary" do
290
279
  assert_equal "", subject.summary
291
280
  end
292
-
293
281
  end
294
282
 
295
283
  class GitRepoCommandTests < IOCommandTests
@@ -314,7 +302,6 @@ class GGem::CLI
314
302
  @command_class.new
315
303
  assert_equal [Dir.pwd], gitrepo_new_called_with
316
304
  end
317
-
318
305
  end
319
306
 
320
307
  module RootPathTests
@@ -326,7 +313,6 @@ class GGem::CLI
326
313
  Assert.stub(Dir, :pwd){ @root_path }
327
314
  end
328
315
  end
329
-
330
316
  end
331
317
 
332
318
  module GitRepoSpyTests
@@ -339,9 +325,7 @@ class GGem::CLI
339
325
  @repo_spy = nil
340
326
  Assert.stub(GGem::GitRepo, :new){ |*args| @repo_spy = GitRepoSpy.new(*args) }
341
327
  end
342
-
343
328
  end
344
-
345
329
  end
346
330
 
347
331
  class GenerateCommandTests < IOCommandTests
@@ -411,7 +395,6 @@ class GGem::CLI
411
395
  assert_equal exp, err.message
412
396
  assert_not_empty err.backtrace
413
397
  end
414
-
415
398
  end
416
399
 
417
400
  class GemspecCommandTests < IOCommandTests
@@ -449,7 +432,6 @@ class GGem::CLI
449
432
  exp = "There are no gemspecs at #{Dir.pwd}"
450
433
  assert_equal exp, err.message
451
434
  end
452
-
453
435
  end
454
436
 
455
437
  module GemspecSpyTests
@@ -463,7 +445,6 @@ class GGem::CLI
463
445
  Assert.stub(GGem::Gemspec, :new){ |*args| @spec_spy = GemspecSpy.new(*args) }
464
446
  end
465
447
  end
466
-
467
448
  end
468
449
 
469
450
  class BuildCommandTests < IOCommandTests
@@ -513,7 +494,6 @@ class GGem::CLI
513
494
  assert_raises(CommandExitError){ subject.run([], @stdout, @stderr) }
514
495
  assert_equal "#{err_msg}\n", @stderr.read
515
496
  end
516
-
517
497
  end
518
498
 
519
499
  class InstallCommandTests < IOCommandTests
@@ -571,7 +551,6 @@ class GGem::CLI
571
551
  assert_raises(CommandExitError){ subject.run(@argv, @stdout, @stderr) }
572
552
  assert_equal "#{err_msg}\n", @stderr.read
573
553
  end
574
-
575
554
  end
576
555
 
577
556
  class PushCommandTests < IOCommandTests
@@ -630,7 +609,6 @@ class GGem::CLI
630
609
  assert_raises(CommandExitError){ subject.run(@argv, @stdout, @stderr) }
631
610
  assert_equal "#{err_msg}\n", @stderr.read
632
611
  end
633
-
634
612
  end
635
613
 
636
614
  class ForceTagOptionCommandTests < IOCommandTests
@@ -648,7 +626,6 @@ class GGem::CLI
648
626
  subject.run(["-f"], @stdout, @stderr)
649
627
  assert_true subject.clirb.opts["force-tag"]
650
628
  end
651
-
652
629
  end
653
630
 
654
631
  class TagCommandTests < IOCommandTests
@@ -757,7 +734,6 @@ class GGem::CLI
757
734
  assert_raises(CommandExitError){ subject.run([], @stdout, @stderr) }
758
735
  assert_equal "#{err_msg}\n", @stderr.read
759
736
  end
760
-
761
737
  end
762
738
 
763
739
  class ReleaseCommandTests < IOCommandTests
@@ -821,7 +797,6 @@ class GGem::CLI
821
797
  assert_true @push_spy.run_called
822
798
  assert_equal [], @push_spy.argv
823
799
  end
824
-
825
800
  end
826
801
 
827
802
  class CommandSetTests < UnitTests
@@ -878,7 +853,6 @@ class GGem::CLI
878
853
  subject[unknown_cmd_name]
879
854
  assert_equal [unknown_cmd_name], @unknown_cmd_block_called_with
880
855
  end
881
-
882
856
  end
883
857
 
884
858
  class CLISpy
@@ -1003,7 +977,6 @@ class GGem::CLI
1003
977
  @run_push_cmd_called = true
1004
978
  ["push", 0, "push cmd was run"]
1005
979
  end
1006
-
1007
980
  end
1008
981
 
1009
982
  class GitRepoSpy
@@ -1056,7 +1029,5 @@ class GGem::CLI
1056
1029
  @run_push_cmd_called = true
1057
1030
  ["push", 0, "push cmd was run"]
1058
1031
  end
1059
-
1060
1032
  end
1061
-
1062
1033
  end