ggem 1.8.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ ruby "~> 2.5"
4
+
3
5
  gemspec
4
6
 
5
- gem 'pry', "~> 0.9.0"
7
+ gem "pry", "~> 0.12.2"
@@ -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,12 +18,12 @@ 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
 
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
@@ -1,24 +1,26 @@
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
- require "<%= @gem.ruby_name %>/version"
4
+ require "<%= @ggem.ruby_name %>/version"
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = "<%= @gem.name %>"
8
- gem.version = <%= @gem.module_name %>::VERSION
7
+ gem.name = "<%= @ggem.name %>"
8
+ gem.version = <%= @ggem.module_name %>::VERSION
9
9
  gem.authors = ["TODO: authors"]
10
10
  gem.email = ["TODO: emails"]
11
11
  gem.summary = "TODO: Write a gem summary"
12
12
  gem.description = "TODO: Write a gem description"
13
13
  gem.homepage = "TODO: homepage"
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.1"])
22
- # TODO: gem.add_dependency("gem-name", ["~> 0.0.0"])
21
+ gem.required_ruby_version = "~> 2.5"
22
+
23
+ gem.add_development_dependency("assert", ["~> 2.18.2"])
23
24
 
25
+ # TODO: gem.add_dependency("gem-name", ["~> 0.0.0"])
24
26
  end
@@ -1,5 +1,5 @@
1
- require "<%= @gem.ruby_name %>/version"
1
+ require "<%= @ggem.ruby_name %>/version"
2
2
 
3
- module <%= @gem.module_name %>
3
+ module <%= @ggem.module_name %>
4
4
  # TODO: your code goes here...
5
5
  end
@@ -1,3 +1,3 @@
1
- module <%= @gem.module_name %>
1
+ module <%= @ggem.module_name %>
2
2
  VERSION = "0.0.1"
3
3
  end
@@ -5,17 +5,8 @@
5
5
  $LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
6
6
 
7
7
  # require pry for debugging (`binding.pry`)
8
- require 'pry'
8
+ require "pry"
9
9
 
10
- require 'test/support/factory'
11
-
12
- # 1.8.7 backfills
13
-
14
- # Array#sample
15
- if !(a = Array.new).respond_to?(:sample) && a.respond_to?(:choice)
16
- class Array
17
- alias_method :sample, :choice
18
- end
19
- end
10
+ require "test/support/factory"
20
11
 
21
12
  # TODO: put test helpers here...
@@ -1,6 +1,5 @@
1
- require 'assert/factory'
1
+ require "assert/factory"
2
2
 
3
3
  module Factory
4
4
  extend Assert::Factory
5
-
6
5
  end
@@ -1,3 +1,3 @@
1
1
  module GGem
2
- VERSION = "1.8.1"
2
+ VERSION = "1.9.2"
3
3
  end
File without changes
@@ -2,22 +2,13 @@
2
2
  # put any test helpers here
3
3
 
4
4
  # add the root dir to the load path
5
- require 'pathname'
6
- ROOT_PATH = Pathname.new(File.expand_path('../..', __FILE__))
5
+ require "pathname"
6
+ ROOT_PATH = Pathname.new(File.expand_path("../..", __FILE__))
7
7
  $LOAD_PATH.unshift(ROOT_PATH.to_s)
8
- TMP_PATH = ROOT_PATH.join('tmp')
9
- TEST_SUPPORT_PATH = ROOT_PATH.join('test/support')
8
+ TMP_PATH = ROOT_PATH.join("tmp")
9
+ TEST_SUPPORT_PATH = ROOT_PATH.join("test/support")
10
10
 
11
11
  # require pry for debugging (`binding.pry`)
12
- require 'pry'
12
+ require "pry"
13
13
 
14
- require 'test/support/factory'
15
-
16
- # 1.8.7 backfills
17
-
18
- # Array#sample
19
- if !(a = Array.new).respond_to?(:sample) && a.respond_to?(:choice)
20
- class Array
21
- alias_method :sample, :choice
22
- end
23
- end
14
+ require "test/support/factory"
@@ -1,53 +1,48 @@
1
- require 'much-plugin'
2
- require 'scmd'
1
+ require "much-plugin"
2
+ require "scmd"
3
3
 
4
- module GGem
4
+ module GGem; end
5
+ module GGem::CmdTestsHelpers
6
+ include MuchPlugin
5
7
 
6
- module CmdTestsHelpers
7
- include MuchPlugin
8
+ plugin_included do
9
+ setup do
10
+ ENV["SCMD_TEST_MODE"] = "1"
8
11
 
9
- plugin_included do
10
- setup do
11
- ENV['SCMD_TEST_MODE'] = '1'
12
+ @cmd_spy = nil
13
+ Scmd.reset
12
14
 
13
- @cmd_spy = nil
14
- Scmd.reset
15
-
16
- @exp_cmds_run = []
17
- end
18
- teardown do
19
- Scmd.reset
20
- ENV.delete('SCMD_TEST_MODE')
21
- end
15
+ @exp_cmds_run = []
16
+ end
17
+ teardown do
18
+ Scmd.reset
19
+ ENV.delete("SCMD_TEST_MODE")
20
+ end
22
21
 
23
- private
22
+ private
24
23
 
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)
24
+ def assert_exp_cmds_run(&run_cmd_block)
25
+ cmd_str, exitstatus, stdout = run_cmd_block.call
26
+ assert_equal @exp_cmds_run, Scmd.calls.map(&:cmd_str)
28
27
 
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
28
+ assert_equal Scmd.calls.first.cmd_str, cmd_str
29
+ assert_equal Scmd.calls.first.cmd.exitstatus, exitstatus
30
+ assert_equal Scmd.calls.first.cmd.stdout, stdout
31
+ end
33
32
 
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
33
+ def assert_exp_cmds_error(cmd_error_class, &run_cmd_block)
34
+ err_cmd_str = @exp_cmds_run.sample
35
+ Scmd.add_command(err_cmd_str) do |cmd|
36
+ cmd.exitstatus = 1
37
+ cmd.stderr = Factory.string
38
+ @cmd_spy = cmd
47
39
  end
40
+ err = nil
41
+ begin; run_cmd_block.call; rescue StandardError => err; end
48
42
 
43
+ assert_kind_of cmd_error_class, err
44
+ exp = "#{@cmd_spy.cmd_str}\n#{@cmd_spy.stderr}"
45
+ assert_equal exp, err.message
49
46
  end
50
-
51
47
  end
52
-
53
48
  end
@@ -1,6 +1,5 @@
1
- require 'assert/factory'
1
+ require "assert/factory"
2
2
 
3
3
  module Factory
4
4
  extend Assert::Factory
5
-
6
5
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = []
7
7
  gem.summary = %q{Gem 1 summary}
8
8
  gem.description = %q{Gem 1 description}
9
- gem.license = 'MIT'
9
+ gem.license = "MIT"
10
10
 
11
11
  gem.files = []
12
12
  gem.executables = []
@@ -6,9 +6,9 @@ Gem::Specification.new do |gem|
6
6
  gem.email = []
7
7
  gem.summary = %q{Gem 2 summary}
8
8
  gem.description = %q{Gem 2 description}
9
- gem.license = 'MIT'
9
+ gem.license = "MIT"
10
10
 
11
- gem.metadata['allowed_push_host'] = 'http://gems.example.com'
11
+ gem.metadata["allowed_push_host"] = "http://gems.example.com"
12
12
 
13
13
  gem.files = []
14
14
  gem.executables = []
@@ -1,67 +1,67 @@
1
- module GGem
2
- module NameSet
1
+ module GGem; end
2
+ module GGem::NameSet
3
+ class Base
4
+ attr_reader :variations, :name, :module_name, :ruby_name
3
5
 
4
- class Base
5
- attr_reader :variations, :name, :module_name, :ruby_name
6
-
7
- def expected_folders
8
- [ '',
9
- 'lib',
10
- "lib/#{@ruby_name}",
11
- 'test',
12
- 'test/support',
13
- 'test/system',
14
- 'test/unit',
15
- 'log',
16
- 'tmp'
17
- ]
18
- end
6
+ def expected_folders
7
+ [ "",
8
+ "lib",
9
+ "lib/#{@ruby_name}",
10
+ "test",
11
+ "test/support",
12
+ "test/system",
13
+ "test/unit",
14
+ "log",
15
+ "tmp"
16
+ ]
17
+ end
19
18
 
20
- def expected_files
21
- [ ".gitignore",
22
- "Gemfile",
23
- "#{@name}.gemspec",
24
- "README.md",
25
- "LICENSE",
19
+ def expected_files
20
+ [ ".ruby-version",
21
+ ".gitignore",
22
+ "Gemfile",
23
+ "#{@name}.gemspec",
24
+ "README.md",
25
+ "LICENSE",
26
26
 
27
- "lib/#{@ruby_name}.rb",
28
- "lib/#{@ruby_name}/version.rb",
27
+ "lib/#{@ruby_name}.rb",
28
+ "lib/#{@ruby_name}/version.rb",
29
29
 
30
- "test/helper.rb",
31
- "test/support/factory.rb",
30
+ "test/helper.rb",
31
+ "test/support/factory.rb",
32
32
 
33
- "log/.gitkeep",
34
- "tmp/.gitkeep",
35
- ]
36
- end
33
+ "log/.keep",
34
+ "test/system/.keep",
35
+ "test/unit/.keep",
36
+ "tmp/.keep",
37
+ ]
37
38
  end
39
+ end
38
40
 
39
- class Simple < Base
40
- def initialize
41
- @variations = ['simple']
42
- @name = 'simple'
43
- @module_name = 'Simple'
44
- @ruby_name = 'simple'
45
- end
41
+ class Simple < Base
42
+ def initialize
43
+ @variations = ["simple"]
44
+ @name = "simple"
45
+ @module_name = "Simple"
46
+ @ruby_name = "simple"
46
47
  end
48
+ end
47
49
 
48
- class Underscored < Base
49
- def initialize
50
- @variations = ['my_gem', 'my__gem', 'MyGem', 'myGem', 'My_Gem']
51
- @name = 'my_gem'
52
- @module_name = 'MyGem'
53
- @ruby_name = 'my_gem'
54
- end
50
+ class Underscored < Base
51
+ def initialize
52
+ @variations = ["my_gem", "my__gem", "MyGem", "myGem", "My_Gem"]
53
+ @name = "my_gem"
54
+ @module_name = "MyGem"
55
+ @ruby_name = "my_gem"
55
56
  end
57
+ end
56
58
 
57
- class HyphenatedOther < Base
58
- def initialize
59
- @variations = ['my-gem']
60
- @name = 'my-gem'
61
- @module_name = 'MyGem'
62
- @ruby_name = 'my-gem'
63
- end
59
+ class HyphenatedOther < Base
60
+ def initialize
61
+ @variations = ["my-gem"]
62
+ @name = "my-gem"
63
+ @module_name = "MyGem"
64
+ @ruby_name = "my-gem"
64
65
  end
65
-
66
66
  end
67
67
  end
@@ -1,10 +1,9 @@
1
- require 'assert'
2
- require 'ggem'
1
+ require "assert"
2
+ require "ggem"
3
3
 
4
- require 'test/support/name_set'
4
+ require "test/support/name_set"
5
5
 
6
6
  module GGem
7
-
8
7
  class SystemTests < Assert::Context
9
8
 
10
9
  NS_SIMPLE = GGem::NameSet::Simple
@@ -12,7 +11,6 @@ module GGem
12
11
  NS_HYPHEN = GGem::NameSet::HyphenatedOther
13
12
 
14
13
  desc "GGem"
15
-
16
14
  end
17
15
 
18
16
  class GemTests < SystemTests
@@ -29,12 +27,11 @@ module GGem
29
27
  def assert_gem_name_set(name_set)
30
28
  name_set.variations.each do |variation|
31
29
  the_gem = GGem::Gem.new(TMP_PATH, variation)
32
- [:name, :module_name, :ruby_name].each do |name_type|
33
- assert_equal name_set.send(name_type), the_gem.send(name_type)
34
- end
30
+ assert_equal name_set.name, the_gem.name
31
+ assert_equal name_set.module_name, the_gem.module_name
32
+ assert_equal name_set.ruby_name, the_gem.ruby_name
35
33
  end
36
34
  end
37
-
38
35
  end
39
36
 
40
37
  class GemSaveTests < GemTests
@@ -64,10 +61,8 @@ module GGem
64
61
  paths = (folders + files).collect{ |p| File.join(TMP_PATH, name_set.name, p) }
65
62
 
66
63
  paths.flatten.each do |path|
67
- assert File.exists?(path), "'#{path}' does not exist"
64
+ assert File.exists?(path), "`#{path}` does not exist"
68
65
  end
69
66
  end
70
-
71
67
  end
72
-
73
68
  end