rubynew 1.0.0 → 1.2

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
1
  ---
2
- SHA1:
3
- metadata.gz: 69431f4a2d406cc85339e4406e7df9869c542424
4
- data.tar.gz: e84baa2941b14073dde56ce538fdc03a8079146f
2
+ SHA256:
3
+ metadata.gz: 6100a33a0748bdc2bf4f7a6c7c33fc998d6df88ec93fdd2032b5132b6b904878
4
+ data.tar.gz: 31e466dcb6b233f3fc75190afa2704e6eba3d8569aa65ea3684ad8635f5fa0ec
5
5
  SHA512:
6
- metadata.gz: 05d092b8df397bbd70559af098cada1ee857e44ed5333bd255e290c40bd93c293b2dd87dd0d8bd29136cddacb0411ad0cf3041b9fbf15ce03656adb419c9eb76
7
- data.tar.gz: 2c8c8335966289162e6eb47ab27a00f6e7749f28d7ecb8e5c51a9ee3ba858b1e0aca47c1c30695a9d6020ca72320cc4a44fcbcc9278450bc314bddbb7659c9fa
6
+ metadata.gz: 1c8e66a37e227d3a36784caad40fdfcd34ee3b47435a4a5e9f4f7fd1fbe234eda0ab51ea6262e0042b387c15e7a1819ac24601565accd7121c000460938883c1
7
+ data.tar.gz: aa53ba20c7b172084b30d1248fb3cf63b1a1996c524623f416b7362824d3c2ae2822d28cdb50df3df69c98a62d55530a7185d73bd3e5e51ad23704e66f03423c
data/README.md CHANGED
@@ -21,11 +21,14 @@ Bundler works when creating a gem.
21
21
  $ rubynew tip_calculator
22
22
  ```
23
23
 
24
- It creates the following structure:
24
+ It creates the following structure and files:
25
25
 
26
26
  ```
27
27
  tip_calculator/
28
+ ├── Gemfile
28
29
  ├── Rakefile
30
+ ├── README.md
31
+ ├── LICENSE
29
32
  ├── bin
30
33
  │   └── tip_calculator
31
34
  ├── lib
@@ -33,6 +36,7 @@ tip_calculator/
33
36
  │   │   └── version.rb
34
37
  │   └── tip_calculator.rb
35
38
  └── test
39
+ └── test_helper.rb
36
40
  └── tip_calculator_test.rb
37
41
  ```
38
42
 
@@ -50,18 +54,31 @@ To contribute:
50
54
  4. Push to the branch (`git push origin my-new-feature`)
51
55
  5. Create a new Pull Request
52
56
 
53
- ## License
54
-
55
- MIT. See LICENSE.txt.
56
57
 
57
58
  ## History
58
59
 
59
- 2016-03-05
60
+ 2025-01-25 v1.2
61
+ * Replace deprecated methods to support modern Ruby.
62
+
63
+
64
+ 2016-08-21 v1.1
65
+
66
+ * Added `README.md`, `LICENSE`, and `Gemfile`
67
+ * Added `test/test_helper.rb` for tests to use as their setup instead of directly loading `minitest/autorun`
68
+ * Added `minitest/reporters` gem and added configuration to `test_helper` so test reports are colorized.
69
+ * `bin` program now displays name and version
70
+ * More detailed help message for `rubynew` when no options are passed
71
+ * `rubynew` no longer crashes when you use a folder that already exists. This behavior is no longer allowed.
72
+
73
+
74
+ 2016-03-05 v1.0.0
60
75
 
61
76
  * Added `bin` folder and default bin file.
62
- * 1.0.0 version
63
77
 
64
78
  2015-08-23
65
79
 
66
80
  * Initial version
67
81
 
82
+ ## License
83
+
84
+ MIT. See LICENSE.txt.
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
- require 'rake/testtask'
3
+ require "minitest/test_task"
4
4
 
5
- Rake::TestTask.new do |t|
5
+ Minitest::TestTask.create(:test) do |t|
6
6
  t.libs << "test"
7
- t.test_files = FileList['test/*_test.rb']
8
- t.verbose = true
7
+ t.libs << "lib"
8
+ t.warning = false
9
+ t.test_globs = ["test/**/*_test.rb"]
9
10
  end
10
11
 
12
+ task :default => :test
data/bin/rubynew CHANGED
@@ -4,12 +4,34 @@ require "rubynew"
4
4
 
5
5
  folder = ARGV[0]
6
6
 
7
+ def banner
8
+ puts "rubynew v#{Rubynew::VERSION} (C) 2015-2025 Brian P Hogan"
9
+ end
10
+
11
+ banner
12
+
7
13
  if folder.nil?
8
- puts "Specify a folder name and I'll create it."
14
+ puts %Q{
15
+ Specify a folder and I'll create a Ruby project in that folder with
16
+
17
+ * A lib/ folder with version.rb and a main Ruby file
18
+ * A test/ folder with a test_helpr file and example test
19
+ * A Rakefile
20
+ * A Gemfile
21
+ * A bin/ folder with everything wired up.
22
+
23
+ Example:
24
+
25
+ rubynew awesome_project
26
+ }
9
27
  else
10
- project = Rubynew::Project.new(folder)
11
- project.create
12
- puts "\nCreated folder #{folder}."
13
- puts "To use it, type: \n\tcd #{folder}\n\nand run tests with\n\n\trake test"
14
- puts "Run the program with \n\truby bin/#{folder}."
28
+ if File.exist?(folder)
29
+ puts "This folder already exists. Please specify a folder that doesn't exist."
30
+ else
31
+ project = Rubynew::Project.new(folder)
32
+ project.create
33
+ puts "\nCreated new Ruby project in #{folder}.\n\n"
34
+ puts "To use this project, type: \n\n\tcd #{folder}\n\nInstall dependencies with\n\n\tbundle install\n\nand run tests with\n\n\trake test\n\n"
35
+ puts "Run the program with \n\n\truby bin/#{folder}\n\n"
36
+ end
15
37
  end
@@ -28,11 +28,10 @@ module Rubynew
28
28
  File.join(@name, "bin", @underscored_name),
29
29
  File.join(@name, "lib", "#{@underscored_name}.rb"),
30
30
  File.join(@name, "lib", @underscored_name, "version.rb"),
31
- File.join(@name, "test", "#{@underscored_name}_test.rb")
31
+ File.join(@name, "test", "#{@underscored_name}_test.rb"),
32
+ File.join(@name, "README.md")
32
33
  ].each { |file| render_template_to_file file, binding }
33
34
 
34
-
35
-
36
35
  end
37
36
 
38
37
  private
@@ -40,7 +39,7 @@ module Rubynew
40
39
  def render_template_to_file(template, context)
41
40
  t = File.read(template)
42
41
  File.open(template, "w") do |f|
43
- f << ERB.new(t, nil, "-").result(context)
42
+ f << ERB.new(t, trim_mode:"-").result(context)
44
43
  end
45
44
  end
46
45
 
@@ -1,3 +1,3 @@
1
1
  module Rubynew
2
- VERSION = "1.0.0"
2
+ VERSION = "1.2"
3
3
  end
data/rubynew.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = %q{Ruby project generator. Creates bin/, lib/ and test/ folders with a module and a Rakefile so you can quickly develop an app with tests.}
13
13
  spec.homepage = "http://github.com/napcs/rubynew"
14
14
  spec.license = "MIT"
15
+ spec.required_ruby_version = '>= 3.0.0'
15
16
 
16
17
  spec.files = [
17
18
  "bin/rubynew",
@@ -23,6 +24,10 @@ Gem::Specification.new do |spec|
23
24
  "template/lib/app/version.rb",
24
25
  "template/lib/app.rb",
25
26
  "template/test/app_test.rb",
27
+ "template/test/test_helper.rb",
28
+ "template/Gemfile",
29
+ "template/README.md",
30
+ "template/LICENSE",
26
31
  "test/rubynew_test.rb",
27
32
  "Rakefile",
28
33
  "Gemfile",
@@ -35,7 +40,8 @@ Gem::Specification.new do |spec|
35
40
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
36
41
  spec.require_paths = ["lib"]
37
42
 
38
- spec.add_development_dependency "bundler", "~> 1.6"
39
- spec.add_development_dependency "rake"
40
- spec.add_development_dependency "minitest"
43
+ spec.add_development_dependency "bundler", "~> 2"
44
+ spec.add_development_dependency "rake", "~> 10"
45
+ spec.add_development_dependency "minitest", "~> 5"
46
+ spec.add_development_dependency 'minitest-reporters', "~> 1.7"
41
47
  end
data/template/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ group :test do
6
+ gem 'minitest'
7
+ gem 'minitest-reporters'
8
+ end
9
+
data/template/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) <year> <copyright holders>
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
1
+ # <%= @underscored_name %>
2
+
3
+ This software...
4
+
5
+ ## Installation
6
+
7
+
8
+ ## Usage
9
+
10
+ ## Contributing
11
+
12
+ ## Changelog
13
+
14
+ ### Version 0.0.1
15
+
16
+ * Initial release
17
+
18
+ ## License
19
+
20
+ See LICENSE
data/template/Rakefile CHANGED
@@ -1,7 +1,10 @@
1
- require "rake/testtask"
1
+ require "minitest/test_task"
2
2
 
3
- Rake::TestTask.new do |t|
3
+ Minitest::TestTask.create(:test) do |t|
4
4
  t.libs << "test"
5
- t.test_files = FileList["test/*_test.rb"]
6
- t.verbose = true
5
+ t.libs << "lib"
6
+ t.warning = false
7
+ t.test_globs = ["test/**/*_test.rb"]
7
8
  end
9
+
10
+ task :default => :test
data/template/bin/app CHANGED
@@ -3,4 +3,8 @@
3
3
  $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + '/../lib')
4
4
  require '<%= @underscored_name %>'
5
5
 
6
- puts "This is the <%= @underscored_name %> app."
6
+ def banner
7
+ puts "<%= @underscored_name %> v#{<%= @constant_name %>::VERSION}."
8
+ end
9
+
10
+ banner
@@ -1,3 +1,3 @@
1
1
  module <%= @constant_name %>
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.1"
3
3
  end
data/template/lib/app.rb CHANGED
@@ -1,5 +1,14 @@
1
+ # Load Bundler and load all your gems
2
+ require "bundler/setup"
3
+
4
+ # Explicitly load any gems you need.
5
+
1
6
  require "<%= @underscored_name %>/version"
2
7
 
3
8
  module <%= @constant_name %>
4
9
  # Your code goes here...
10
+ # Good place for your main application logic if this is a library.
11
+ #
12
+ # Create classes in the <%= @underscored_name %> folder and
13
+ # be sure to create unit tests for them too.
5
14
  end
@@ -1,8 +1,11 @@
1
- require "minitest/autorun"
1
+ require "test_helper"
2
+
2
3
  require "<%= @underscored_name %>"
3
4
 
4
5
  class <%= @constant_name %>Test < Minitest::Test
6
+
5
7
  def test_fails
6
8
  flunk "Gotta write a test!"
7
9
  end
10
+
8
11
  end
@@ -0,0 +1,6 @@
1
+ # Your tests should require this file which sets up the test harness.
2
+ require "minitest/autorun"
3
+ require 'minitest/reporters'
4
+
5
+ reporter_options = { color: true }
6
+ Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(reporter_options)]
data/test/rubynew_test.rb CHANGED
@@ -1,9 +1,9 @@
1
- require 'minitest/autorun'
2
1
  require 'rubynew/project'
3
2
 
3
+ require "test_helper"
4
4
  require 'pathname'
5
5
  # Not really a unit test - more of an integration test.
6
- class RubynewTest < MiniTest::Test
6
+ class RubynewTest < Minitest::Test
7
7
 
8
8
  def setup
9
9
  @folder = "tmpproject"
@@ -19,6 +19,9 @@ class RubynewTest < MiniTest::Test
19
19
  Rubynew::Project.new(@folder).create
20
20
 
21
21
  assert File.exist?(File.join(@folder, "Rakefile"))
22
+ assert File.exist?(File.join(@folder, "Gemfile"))
23
+ assert File.exist?(File.join(@folder, "README.md"))
24
+ assert File.exist?(File.join(@folder, "LICENSE"))
22
25
  assert File.exist?(File.join(@folder, "lib", "#{@folder}.rb"))
23
26
  assert File.exist?(File.join(@folder, "lib", @folder, "version.rb"))
24
27
  assert File.exist?(File.join(@folder, "test", "#{@folder}_test.rb"))
@@ -30,7 +33,7 @@ class RubynewTest < MiniTest::Test
30
33
  Rubynew::Project.new(@folder).create
31
34
 
32
35
  file = Pathname.new(File.join(@folder, "Rakefile"))
33
- assert file.read.include?("require \"rake/testtask\"")
36
+ assert file.read.include?("require \"minitest/test_task\"")
34
37
  end
35
38
 
36
39
  def test_class_has_constant_name
@@ -76,11 +79,22 @@ class RubynewTest < MiniTest::Test
76
79
  end
77
80
 
78
81
  def test_has_bin
79
-
80
82
  Rubynew::Project.new(@folder).create
81
83
 
82
84
  file = Pathname.new(File.join(@folder, "bin", @folder))
83
85
  assert file.read.include?("$LOAD_PATH")
84
86
  assert file.read.include?("require 'tmpproject'")
85
87
  end
88
+
89
+ def test_bin_displays_name_and_version
90
+ Rubynew::Project.new(@folder).create
91
+ file = Pathname.new(File.join(@folder, "bin", @folder))
92
+ assert file.read.include?('tmpproject v#{Tmpproject::VERSION}')
93
+ end
94
+
95
+ def readme_has_project_name_as_header
96
+ Rubynew::Project.new(@folder).create
97
+ file = Pathname.new(File.join(@folder, "README.md"))
98
+ assert file.read.include?("# tmpproject\n")
99
+ end
86
100
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubynew
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Hogan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-05 00:00:00.000000000 Z
11
+ date: 2025-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,42 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest-reporters
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: '1.7'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ">="
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: '1.7'
55
69
  description: Ruby project generator. Creates bin/, lib/ and test/ folders with a module
56
70
  and a Rakefile so you can quickly develop an app with tests.
57
71
  email:
@@ -70,17 +84,21 @@ files:
70
84
  - lib/rubynew/project.rb
71
85
  - lib/rubynew/version.rb
72
86
  - rubynew.gemspec
87
+ - template/Gemfile
88
+ - template/LICENSE
89
+ - template/README.md
73
90
  - template/Rakefile
74
91
  - template/bin/app
75
92
  - template/lib/app.rb
76
93
  - template/lib/app/version.rb
77
94
  - template/test/app_test.rb
95
+ - template/test/test_helper.rb
78
96
  - test/rubynew_test.rb
79
97
  homepage: http://github.com/napcs/rubynew
80
98
  licenses:
81
99
  - MIT
82
100
  metadata: {}
83
- post_install_message:
101
+ post_install_message:
84
102
  rdoc_options: []
85
103
  require_paths:
86
104
  - lib
@@ -88,18 +106,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
106
  requirements:
89
107
  - - ">="
90
108
  - !ruby/object:Gem::Version
91
- version: '0'
109
+ version: 3.0.0
92
110
  required_rubygems_version: !ruby/object:Gem::Requirement
93
111
  requirements:
94
112
  - - ">="
95
113
  - !ruby/object:Gem::Version
96
114
  version: '0'
97
115
  requirements: []
98
- rubyforge_project:
99
- rubygems_version: 2.4.6
100
- signing_key:
116
+ rubygems_version: 3.5.22
117
+ signing_key:
101
118
  specification_version: 4
102
119
  summary: Generate new Ruby projects with tests.
103
120
  test_files:
104
121
  - test/rubynew_test.rb
105
- has_rdoc: