blam 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +7 -5
- data/blam.gemspec +1 -1
- data/features/default.feature +33 -0
- data/lib/blam.rb +15 -9
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31009b908445b5df457b02052a723b47fce3a438
|
|
4
|
+
data.tar.gz: 62c14dec3e106ce2d9c8f5358f2b57aec1db0a46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50b15cfe33eb0344aa93056014c3af9009146ae04524d2adfcfb6f806af5df3663d74eb0a7db3aecd756e2b9aa4e69f6ee2a8db73590a31067881d270635066b
|
|
7
|
+
data.tar.gz: 6de192cacd7c3a94331c6e42c443e85d009083db764adb55be4666da780b432b41e5984b14fe2e990975c916ee919a5e736479a331f9c4c54054c6cc2d01a4ef
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# BLAM! [](https://travis-ci.org/neverstopbuilding/blam)
|
|
1
|
+
# BLAM! [](https://travis-ci.org/neverstopbuilding/blam) [](http://badge.fury.io/rb/blam)
|
|
2
2
|
|
|
3
3
|
##Create ruby files quickly on the command line. BLAM!
|
|
4
4
|
|
|
@@ -21,7 +21,7 @@ Or install it yourself as:
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
$ blam BeastlyModule::DopeClass
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
By default creates these files:
|
|
26
26
|
|
|
27
27
|
- lib
|
|
@@ -30,7 +30,7 @@ By default creates these files:
|
|
|
30
30
|
- spec
|
|
31
31
|
- beastly_module
|
|
32
32
|
- dope_class_spec.rb
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
The class file has:
|
|
35
35
|
|
|
36
36
|
```ruby
|
|
@@ -43,7 +43,7 @@ module BeastlyModule
|
|
|
43
43
|
end
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
The spec file has:
|
|
46
|
+
The spec file has:
|
|
47
47
|
|
|
48
48
|
```ruby
|
|
49
49
|
# Encoding: utf-8
|
|
@@ -60,8 +60,10 @@ end
|
|
|
60
60
|
|
|
61
61
|
- **--source-dir** - Pass an alternative directory to `lib` in which the source files will be created.
|
|
62
62
|
- **--tests-dir** - Pass an alternative directory to `spec` in which the test files will be created.
|
|
63
|
-
- **--test-suffix** - Change the suffix from the test files from the default `spec` to anything you like. Non spec suffixes will get a default class template rather than an rspec class template.
|
|
63
|
+
- **--test-suffix** - Change the suffix from the test files from the default `spec` to anything you like. Non spec suffixes will get a default class template rather than an rspec class template.
|
|
64
64
|
- **--additional-test-dirs** - Add other directories to create additional test files. This can be helpful for breaking up your tests into folders like `spec/unit` `spec/integration`
|
|
65
|
+
- **--no-tests** - Regardless of your settings it will not create the test files. This is bad. And you are lazy for using this option.
|
|
66
|
+
- **--just-unit** - This will not create files if you have specified additional test directories, helpful when you just want a unit test and don't need an integration test as well.
|
|
65
67
|
|
|
66
68
|
###.blam File
|
|
67
69
|
|
data/blam.gemspec
CHANGED
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'blam'
|
|
8
|
-
spec.version = '1.
|
|
8
|
+
spec.version = '1.1.0'
|
|
9
9
|
spec.authors = ['Jason Fox']
|
|
10
10
|
spec.email = ['jasonrobertfox@gmail.com']
|
|
11
11
|
spec.description = %q{Blam: quickly create ruby source and test files in the right place.}
|
data/features/default.feature
CHANGED
|
@@ -121,3 +121,36 @@ Important Code
|
|
|
121
121
|
"""
|
|
122
122
|
Important Code
|
|
123
123
|
"""
|
|
124
|
+
|
|
125
|
+
Scenario: Don't create test files if there is an over ride
|
|
126
|
+
Given a file named ".blam" with:
|
|
127
|
+
"""
|
|
128
|
+
tests_dir: spec/unit/lib
|
|
129
|
+
additional_test_dirs: [spec/integration/lib, spec/system/lib]
|
|
130
|
+
source_dir: src
|
|
131
|
+
test_suffix: test
|
|
132
|
+
"""
|
|
133
|
+
When I run `bundle exec blam --no-tests NameSpace::ClassName`
|
|
134
|
+
Then the following files should exist:
|
|
135
|
+
| src/name_space/class_name.rb |
|
|
136
|
+
And the output should contain "Skipped the tests, you lazy piece of shit!"
|
|
137
|
+
And the following files should not exist:
|
|
138
|
+
| spec/unit/lib/name_space/class_name_test.rb |
|
|
139
|
+
| spec/integration/lib/name_space/class_name_test.rb |
|
|
140
|
+
| spec/system/lib/name_space/class_name_test.rb |
|
|
141
|
+
|
|
142
|
+
Scenario: Only create the unit tests with an over ride
|
|
143
|
+
Given a file named ".blam" with:
|
|
144
|
+
"""
|
|
145
|
+
tests_dir: spec/unit/lib
|
|
146
|
+
additional_test_dirs: [spec/integration/lib, spec/system/lib]
|
|
147
|
+
source_dir: src
|
|
148
|
+
test_suffix: test
|
|
149
|
+
"""
|
|
150
|
+
When I run `bundle exec blam --just-unit NameSpace::ClassName`
|
|
151
|
+
Then the following files should exist:
|
|
152
|
+
| src/name_space/class_name.rb |
|
|
153
|
+
| spec/unit/lib/name_space/class_name_test.rb |
|
|
154
|
+
And the following files should not exist:
|
|
155
|
+
| spec/integration/lib/name_space/class_name_test.rb |
|
|
156
|
+
| spec/system/lib/name_space/class_name_test.rb |
|
data/lib/blam.rb
CHANGED
|
@@ -13,6 +13,8 @@ class Blam < Thor::Group
|
|
|
13
13
|
class_option :tests_dir
|
|
14
14
|
class_option :test_suffix
|
|
15
15
|
class_option :additional_test_dirs, type: :array
|
|
16
|
+
class_option :no_tests, type: :boolean
|
|
17
|
+
class_option :just_unit, type: :boolean
|
|
16
18
|
|
|
17
19
|
def self.source_root
|
|
18
20
|
File.dirname(__FILE__)
|
|
@@ -26,15 +28,19 @@ class Blam < Thor::Group
|
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
def create_test_file
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
if opts[:no_tests]
|
|
32
|
+
puts 'Skipped the tests, you lazy piece of shit!'
|
|
33
|
+
else
|
|
34
|
+
dirs = [opts[:tests_dir]]
|
|
35
|
+
test_suffix = opts[:test_suffix]
|
|
36
|
+
test_template = test_suffix == 'spec' ? 'rspec' : 'test'
|
|
37
|
+
dirs.concat opts[:additional_test_dirs] if opts[:additional_test_dirs] && ! opts[:just_unit]
|
|
38
|
+
dirs.each do |dir|
|
|
39
|
+
@name = name
|
|
40
|
+
@path = get_path(name)
|
|
41
|
+
file_name = "#{dir}/#{get_path(name)}_#{test_suffix}.rb"
|
|
42
|
+
template("templates/#{test_template}.tt", file_name) unless File.exists?(file_name)
|
|
43
|
+
end
|
|
38
44
|
end
|
|
39
45
|
end
|
|
40
46
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blam
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Fox
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-10-
|
|
11
|
+
date: 2013-10-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|