mtgen 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +3 -0
- data/Rakefile +1 -0
- data/bin/mtgen +4 -0
- data/lib/minitest_files/spec/sample_spec.rb +7 -0
- data/lib/minitest_files/spec/spec_helper.rb +1 -0
- data/lib/minitest_files/test/sample_test.rb +10 -0
- data/lib/minitest_files/test/test_helper.rb +2 -0
- data/lib/mtgen.rb +26 -0
- data/mtgen.gemspec +27 -0
- data/readme.md +13 -0
- data/spec/mtgen_spec.rb +35 -0
- data/spec/spec_helper.rb +5 -0
- metadata +118 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/mtgen
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'minitest/autorun'
|
data/lib/mtgen.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module MtGen
|
5
|
+
VERSION = "0.1.2"
|
6
|
+
|
7
|
+
class CLI < Thor
|
8
|
+
desc "test", "Generates minitest skeleton in current directory"
|
9
|
+
def test
|
10
|
+
generate("test")
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "spec", "Generates minitest skeleton (spec) in current directory"
|
14
|
+
def spec
|
15
|
+
generate("spec")
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def generate(type)
|
21
|
+
src = File.dirname(__FILE__) + "/minitest_files/#{type}"
|
22
|
+
dest = "."
|
23
|
+
FileUtils.cp_r(src, dest)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/mtgen.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require(File.expand_path('../lib/mtgen', __FILE__))
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "mtgen"
|
7
|
+
s.version = MtGen::VERSION
|
8
|
+
s.authors = ["Richard Nystrom"]
|
9
|
+
s.email = ["ricny046@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/ricn/mtgen"
|
11
|
+
s.summary = %q{Creates a minitest spec or test directory and some starter code on a blank project. Perfect for Ruby library development.}
|
12
|
+
s.description = %q{Creates a minitest spec or test directory and some starter code on a blank project. It's very similar to rspec --init. Perfect for Ruby library development.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "mtgen"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_development_dependency "minitest"
|
22
|
+
s.add_development_dependency "rake"
|
23
|
+
s.add_development_dependency "turn"
|
24
|
+
|
25
|
+
s.add_runtime_dependency "thor"
|
26
|
+
s.add_runtime_dependency "minitest"
|
27
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Mtgen
|
2
|
+
|
3
|
+
mtgen creates a minitest test/spec directory and some starter code on a blank project. It's very similar to rspec --init. Perfect for Ruby library development.
|
4
|
+
|
5
|
+
## Examples:
|
6
|
+
|
7
|
+
```bash
|
8
|
+
mtgen spec # generates a spec directory, spec_helper.rb and a sample_spec.rb with a working spec
|
9
|
+
```
|
10
|
+
|
11
|
+
```bash
|
12
|
+
mtgen test # generates a test directory, test_helper.rb and a sample_test.rb with a working test
|
13
|
+
```
|
data/spec/mtgen_spec.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MtGen::CLI do
|
4
|
+
|
5
|
+
it "must create a test folder with test files in current directory" do
|
6
|
+
random_folder = rand(36**10).to_s(36)
|
7
|
+
folder_to_use = "/tmp/#{random_folder}"
|
8
|
+
FileUtils.mkdir_p(folder_to_use)
|
9
|
+
Dir.chdir(folder_to_use)
|
10
|
+
|
11
|
+
MtGen::CLI.start(["test"])
|
12
|
+
|
13
|
+
File.directory?("./test").must_equal true
|
14
|
+
File.file?("./test/test_helper.rb").must_equal true
|
15
|
+
File.file?("./test/sample_test.rb").must_equal true
|
16
|
+
|
17
|
+
FileUtils.rm_rf(folder_to_use)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "must create a spec folder with spec files in current directory" do
|
21
|
+
random_folder = rand(36**10).to_s(36)
|
22
|
+
folder_to_use = "/tmp/#{random_folder}"
|
23
|
+
FileUtils.mkdir_p(folder_to_use)
|
24
|
+
Dir.chdir(folder_to_use)
|
25
|
+
|
26
|
+
MtGen::CLI.start(["spec"])
|
27
|
+
|
28
|
+
File.directory?("./spec").must_equal true
|
29
|
+
File.file?("./spec/spec_helper.rb").must_equal true
|
30
|
+
File.file?("./spec/sample_spec.rb").must_equal true
|
31
|
+
|
32
|
+
FileUtils.rm_rf(folder_to_use)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mtgen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Richard Nystrom
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: minitest
|
16
|
+
requirement: &70320044736120 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70320044736120
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &70320044735560 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70320044735560
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: turn
|
38
|
+
requirement: &70320044755340 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70320044755340
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: thor
|
49
|
+
requirement: &70320044754700 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70320044754700
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: minitest
|
60
|
+
requirement: &70320044754280 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70320044754280
|
69
|
+
description: Creates a minitest spec or test directory and some starter code on a
|
70
|
+
blank project. It's very similar to rspec --init. Perfect for Ruby library development.
|
71
|
+
email:
|
72
|
+
- ricny046@gmail.com
|
73
|
+
executables:
|
74
|
+
- mtgen
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- Gemfile
|
80
|
+
- Rakefile
|
81
|
+
- bin/mtgen
|
82
|
+
- lib/minitest_files/spec/sample_spec.rb
|
83
|
+
- lib/minitest_files/spec/spec_helper.rb
|
84
|
+
- lib/minitest_files/test/sample_test.rb
|
85
|
+
- lib/minitest_files/test/test_helper.rb
|
86
|
+
- lib/mtgen.rb
|
87
|
+
- mtgen.gemspec
|
88
|
+
- readme.md
|
89
|
+
- spec/mtgen_spec.rb
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
homepage: https://github.com/ricn/mtgen
|
92
|
+
licenses: []
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project: mtgen
|
111
|
+
rubygems_version: 1.8.10
|
112
|
+
signing_key:
|
113
|
+
specification_version: 3
|
114
|
+
summary: Creates a minitest spec or test directory and some starter code on a blank
|
115
|
+
project. Perfect for Ruby library development.
|
116
|
+
test_files:
|
117
|
+
- spec/mtgen_spec.rb
|
118
|
+
- spec/spec_helper.rb
|