Skip to content

Commit ac44496

Browse files
committed
v1.1
1 parent cb10693 commit ac44496

File tree

15 files changed

+132
-20
lines changed

15 files changed

+132
-20
lines changed

‎README.md‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@ Bundler works when creating a gem.
2121
$ rubynew tip_calculator
2222
```
2323

24-
It creates the following structure:
24+
It creates the following structure and files:
2525

2626
```
2727
tip_calculator/
28+
├── Gemfile
2829
├── Rakefile
30+
├── README.md
31+
├── LICENSE
2932
├── bin
3033
│   └── tip_calculator
3134
├── lib
3235
│   ├── tip_calculator
3336
│   │   └── version.rb
3437
│   └── tip_calculator.rb
3538
└── test
39+
└── test_helper.rb
3640
└── tip_calculator_test.rb
3741
```
3842

@@ -50,18 +54,27 @@ To contribute:
5054
4. Push to the branch (`git push origin my-new-feature`)
5155
5. Create a new Pull Request
5256

53-
## License
54-
55-
MIT. See LICENSE.txt.
5657

5758
## History
5859

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
6071

6172
* Added `bin` folder and default bin file.
62-
* 1.0.0 version
6373

6474
2015-08-23
6575

6676
* Initial version
6777

78+
## License
79+
80+
MIT. See LICENSE.txt.

‎bin/rubynew‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,35 @@ require "rubynew"
44

55
folder = ARGV[0]
66

7+
def banner
8+
puts "rubynew v#{Rubynew::VERSION} (C) 2015-2016 Brian P Hogan"
9+
end
10+
11+
banner
12+
713
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+
}
927
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
1538
end

‎lib/rubynew/project.rb‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ def create
2828
File.join(@name, "bin", @underscored_name),
2929
File.join(@name, "lib", "#{@underscored_name}.rb"),
3030
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")
3233
].each { |file| render_template_to_file file, binding }
3334

34-
35-
3635
end
3736

3837
private

‎lib/rubynew/version.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Rubynew
2-
VERSION = "1.0.0"
2+
VERSION = "1.1"
33
end

‎rubynew.gemspec‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Gem::Specification.new do |spec|
2323
"template/lib/app/version.rb",
2424
"template/lib/app.rb",
2525
"template/test/app_test.rb",
26+
"template/test/test_helper.rb",
27+
"template/Gemfile",
28+
"template/README.md",
29+
"template/LICENSE",
2630
"test/rubynew_test.rb",
2731
"Rakefile",
2832
"Gemfile",

‎template/Gemfile‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+

‎template/LICENSE‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

‎template/README.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

‎template/Rakefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ Rake::TestTask.new do |t|
55
t.test_files = FileList["test/*_test.rb"]
66
t.verbose = true
77
end
8+
9+
task :default => :test

‎template/bin/app‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + '/../lib')
44
require '<%= @underscored_name %>'
55

6-
puts "This is the <%= @underscored_name %> app."
6+
def banner
7+
puts "<%= @underscored_name %> v#{<%= @constant_name %>::VERSION}."
8+
end
9+
10+
banner

0 commit comments

Comments
 (0)