blam 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: df6152c10aa10cb0cdd110436922f08bcd5e0873
4
+ data.tar.gz: 5ccd624ec7f32c0c647af63722a630d592603e5c
5
+ SHA512:
6
+ metadata.gz: 7d0cdaa1250fd2007e5fbe0918aba1110f9972809e79345b3457759805b88c9b93e394518d6d89521f9b952b76d8a9757a85f8ae74d0b8660b504300409d973b
7
+ data.tar.gz: fbfda026c42feb2f59373c26cb9f8202f7806211ab0dbe5f88bab079b82025fa22d58496eed6242b18f59f74d9b0e81d9c5c7874a6567ba133ea10faf91df541
@@ -4,9 +4,6 @@ LineLength:
4
4
  MethodLength:
5
5
  Max: 30
6
6
 
7
- SymbolName:
8
- AllowCamelCase: false
9
-
10
7
  Documentation:
11
8
  Enabled: false
12
9
 
@@ -1,3 +1,7 @@
1
+ #1.3.0 (2014-01-02)
2
+ - removed blank line from generated source which was throwing a rubocop error in projects
3
+ - added a catch if you just specify a module name: `blam MyModule`, this will now create a correct top level module.
4
+
1
5
  #1.2.0 (2013-12-02)
2
6
  - added the `--init` option to create a default `.blam` file
3
7
 
@@ -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.2.0'
8
+ spec.version = '1.3.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.}
@@ -10,6 +10,19 @@ Then the following directories should exist:
10
10
  | lib/name_space/class_name.rb |
11
11
  | spec/name_space/class_name_spec.rb |
12
12
 
13
+ Scenario: Creating a top level module
14
+ Given I run `bundle exec blam ModuleName`
15
+ Then the file "lib/module_name.rb" should contain exactly:
16
+ """
17
+ # Encoding: utf-8
18
+
19
+ module ModuleName
20
+ end
21
+
22
+ """
23
+ And the following files should exist:
24
+ | spec/module_name_spec.rb |
25
+
13
26
  Scenario: Specifying the source path
14
27
  Given I run `bundle exec blam NameSpace::ClassName --source_dir=other/dir`
15
28
  Then the following files should exist:
@@ -89,7 +102,6 @@ Given I run `bundle exec blam NameSpace::OtherSpace::ClassName`
89
102
  module NameSpace
90
103
  module OtherSpace
91
104
  class ClassName
92
-
93
105
  end
94
106
  end
95
107
  end
@@ -103,7 +115,6 @@ require 'spec_helper'
103
115
  require 'name_space/other_space/class_name'
104
116
 
105
117
  describe NameSpace::OtherSpace::ClassName do
106
-
107
118
  end
108
119
 
109
120
  """
@@ -117,7 +128,6 @@ Given I run `bundle exec blam NameSpace::OtherSpace::ClassName --test_suffix=tes
117
128
  require 'name_space/other_space/class_name'
118
129
 
119
130
  class NameSpace::OtherSpace::ClassNameTest do
120
-
121
131
  end
122
132
 
123
133
  """
@@ -31,7 +31,11 @@ class Blam < Thor::Group
31
31
  dir = opts[:source_dir]
32
32
  @class_parts = name.split('::')
33
33
  file_name = "#{dir}/#{get_path(name)}.rb"
34
- template('templates/source.tt', file_name) unless File.exists?(file_name)
34
+ if @class_parts.count == 1
35
+ template('templates/module.tt', file_name) unless File.exists?(file_name)
36
+ else
37
+ template('templates/source.tt', file_name) unless File.exists?(file_name)
38
+ end
35
39
  end
36
40
 
37
41
  def create_test_file
@@ -53,24 +57,24 @@ class Blam < Thor::Group
53
57
 
54
58
  private
55
59
 
56
- def get_path(name)
57
- name.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr('-', '_').downcase
58
- end
60
+ def get_path(name)
61
+ name.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr('-', '_').downcase
62
+ end
59
63
 
60
- def opts
61
- default_opts = { source_dir: 'lib', tests_dir: 'spec', test_suffix: 'spec' }
62
- cli_opts = symbolize(options)
63
- return default_opts.merge(cli_opts) unless File.exists?('.blam')
64
- raw_file_opts = ::YAML.load_file('.blam') || {}
65
- file_opts = symbolize(raw_file_opts)
66
- default_opts.merge(file_opts).merge(cli_opts)
67
- end
64
+ def opts
65
+ default_opts = { source_dir: 'lib', tests_dir: 'spec', test_suffix: 'spec' }
66
+ cli_opts = symbolize(options)
67
+ return default_opts.merge(cli_opts) unless File.exists?('.blam')
68
+ raw_file_opts = ::YAML.load_file('.blam') || {}
69
+ file_opts = symbolize(raw_file_opts)
70
+ default_opts.merge(file_opts).merge(cli_opts)
71
+ end
68
72
 
69
- def symbolize(hash)
70
- new_hash = {}
71
- hash.each do |key, value|
72
- new_hash[key.to_sym] = value
73
- end
74
- new_hash
73
+ def symbolize(hash)
74
+ new_hash = {}
75
+ hash.each do |key, value|
76
+ new_hash[key.to_sym] = value
75
77
  end
78
+ new_hash
79
+ end
76
80
  end
@@ -0,0 +1,4 @@
1
+ # Encoding: utf-8
2
+
3
+ module <%= @class_parts.first %>
4
+ end
@@ -4,5 +4,4 @@ require 'spec_helper'
4
4
  require '<%= @path %>'
5
5
 
6
6
  describe <%= @name %> do
7
-
8
7
  end
@@ -7,7 +7,6 @@ spacing = ''
7
7
  <%
8
8
  spacing+= ' '
9
9
  end %><%= spacing + 'class ' + @class_parts.last %>
10
-
11
10
  <%= spacing + 'end' %><% loop do
12
11
  l = spacing.length - 2
13
12
  spacing = l >= 0 ? ' '*l : ''
@@ -3,5 +3,4 @@
3
3
  require '<%= @path %>'
4
4
 
5
5
  class <%= @name + 'Test' %> do
6
-
7
6
  end
metadata CHANGED
@@ -1,97 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blam
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- prerelease:
4
+ version: 1.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jason Fox
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-02 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: aruba
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rubocop
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: thor
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
- description: ! 'Blam: quickly create ruby source and test files in the right place.'
83
+ description: 'Blam: quickly create ruby source and test files in the right place.'
95
84
  email:
96
85
  - jasonrobertfox@gmail.com
97
86
  executables:
@@ -99,11 +88,11 @@ executables:
99
88
  extensions: []
100
89
  extra_rdoc_files: []
101
90
  files:
102
- - .gitignore
103
- - .rubocop.yml
104
- - .ruby-gemset
105
- - .ruby-version
106
- - .travis.yml
91
+ - ".gitignore"
92
+ - ".rubocop.yml"
93
+ - ".ruby-gemset"
94
+ - ".ruby-version"
95
+ - ".travis.yml"
107
96
  - CHANGELOG.md
108
97
  - Gemfile
109
98
  - LICENSE.txt
@@ -115,33 +104,33 @@ files:
115
104
  - features/support/env.rb
116
105
  - lib/blam.rb
117
106
  - lib/templates/blam.tt
107
+ - lib/templates/module.tt
118
108
  - lib/templates/rspec.tt
119
109
  - lib/templates/source.tt
120
110
  - lib/templates/test.tt
121
111
  homepage: https://github.com/neverstopbuilding/blam
122
112
  licenses:
123
113
  - MIT
114
+ metadata: {}
124
115
  post_install_message:
125
116
  rdoc_options: []
126
117
  require_paths:
127
118
  - lib
128
119
  required_ruby_version: !ruby/object:Gem::Requirement
129
- none: false
130
120
  requirements:
131
- - - ! '>='
121
+ - - ">="
132
122
  - !ruby/object:Gem::Version
133
123
  version: '0'
134
124
  required_rubygems_version: !ruby/object:Gem::Requirement
135
- none: false
136
125
  requirements:
137
- - - ! '>='
126
+ - - ">="
138
127
  - !ruby/object:Gem::Version
139
128
  version: '0'
140
129
  requirements: []
141
130
  rubyforge_project:
142
- rubygems_version: 1.8.25
131
+ rubygems_version: 2.1.11
143
132
  signing_key:
144
- specification_version: 3
133
+ specification_version: 4
145
134
  summary: With a single command Blam will create your source file and any test files
146
135
  in the right directories based on namespace.
147
136
  test_files: