rubynew 1.0.0 → 1.1

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
2
  SHA1:
3
- metadata.gz: 69431f4a2d406cc85339e4406e7df9869c542424
4
- data.tar.gz: e84baa2941b14073dde56ce538fdc03a8079146f
3
+ metadata.gz: a6063f5baba77f1be01af65181e27d24e40feb84
4
+ data.tar.gz: 41664657d14639f6d299873b6b51d32c9064c0c1
5
5
  SHA512:
6
- metadata.gz: 05d092b8df397bbd70559af098cada1ee857e44ed5333bd255e290c40bd93c293b2dd87dd0d8bd29136cddacb0411ad0cf3041b9fbf15ce03656adb419c9eb76
7
- data.tar.gz: 2c8c8335966289162e6eb47ab27a00f6e7749f28d7ecb8e5c51a9ee3ba858b1e0aca47c1c30695a9d6020ca72320cc4a44fcbcc9278450bc314bddbb7659c9fa
6
+ metadata.gz: 2941e817ff57c3852d80bdaf89654994c4772aa21e54fbb75aa966c1ddd58d90f93fa12de414285c9c66b54f64eff03fa81b1d3d874641566f5fc481d962cbe8
7
+ data.tar.gz: c099b1c63f3c16c6aaa683993488f77375fdcf5db4a80723d99b9ae868983ed7e41d5c5d26989f6b13b6638895518c97578d28ccc4c63e32e00898f6881ebd85
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,27 @@ 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
+ 2016-08-21 v1.1
61
+
62
+ * Added `README.md`, `LICENSE`, and `Gemfile`
63
+ * Added `test/test_helper.rb` for tests to use as their setup instead of directly loading `minitest/autorun`
64
+ * Added `minitest/reporters` gem and added configuration to `test_helper` so test reports are colorized.
65
+ * `bin` program now displays name and version
66
+ * More detailed help message for `rubynew` when no options are passed
67
+ * `rubynew` no longer crashes when you use a folder that already exists. This behavior is no longer allowed.
68
+
69
+
70
+ 2016-03-05 v1.0.0
60
71
 
61
72
  * Added `bin` folder and default bin file.
62
- * 1.0.0 version
63
73
 
64
74
  2015-08-23
65
75
 
66
76
  * Initial version
67
77
 
78
+ ## License
79
+
80
+ MIT. See LICENSE.txt.
@@ -4,12 +4,35 @@ require "rubynew"
4
4
 
5
5
  folder = ARGV[0]
6
6
 
7
+ def banner
8
+ puts "rubynew v#{Rubynew::VERSION} (C) 2015-2016 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.exists?(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
+
37
+ end
15
38
  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
@@ -1,3 +1,3 @@
1
1
  module Rubynew
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1"
3
3
  end
@@ -23,6 +23,10 @@ Gem::Specification.new do |spec|
23
23
  "template/lib/app/version.rb",
24
24
  "template/lib/app.rb",
25
25
  "template/test/app_test.rb",
26
+ "template/test/test_helper.rb",
27
+ "template/Gemfile",
28
+ "template/README.md",
29
+ "template/LICENSE",
26
30
  "test/rubynew_test.rb",
27
31
  "Rakefile",
28
32
  "Gemfile",
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ gem 'minitest', group: :test
6
+ gem 'minitest-reporters', group: :test
7
+
@@ -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
@@ -5,3 +5,5 @@ Rake::TestTask.new do |t|
5
5
  t.test_files = FileList["test/*_test.rb"]
6
6
  t.verbose = true
7
7
  end
8
+
9
+ task :default => :test
@@ -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,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,3 +1,3 @@
1
1
  module <%= @constant_name %>
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.1"
3
3
  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)]
@@ -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"))
@@ -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.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Hogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-05 00:00:00.000000000 Z
11
+ date: 2016-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,11 +70,15 @@ files:
70
70
  - lib/rubynew/project.rb
71
71
  - lib/rubynew/version.rb
72
72
  - rubynew.gemspec
73
+ - template/Gemfile
74
+ - template/LICENSE
75
+ - template/README.md
73
76
  - template/Rakefile
74
77
  - template/bin/app
75
78
  - template/lib/app.rb
76
79
  - template/lib/app/version.rb
77
80
  - template/test/app_test.rb
81
+ - template/test/test_helper.rb
78
82
  - test/rubynew_test.rb
79
83
  homepage: http://github.com/napcs/rubynew
80
84
  licenses:
@@ -96,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
100
  version: '0'
97
101
  requirements: []
98
102
  rubyforge_project:
99
- rubygems_version: 2.4.6
103
+ rubygems_version: 2.5.1
100
104
  signing_key:
101
105
  specification_version: 4
102
106
  summary: Generate new Ruby projects with tests.