Skip to content

Commit

Permalink
[gh-18] - Snake case fix for jack generation
Browse files Browse the repository at this point in the history
  • Loading branch information
brianknapp committed Jan 20, 2013
1 parent 8ab028f commit fdc35b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/generators/application_generator.rb
Expand Up @@ -150,22 +150,22 @@ class #{k}Contract < Contract
end
}

snake_name = name.gsub(/(.)([A-Z])/,'\1_\2').downcase
snake_name = k.gsub(/(.)([A-Z])/,'\1_\2').downcase

filename = "#{@app.dir}/contracts/#{snake_name}_jack_contract.rb"
filename = "#{@app.dir}/contracts/#{snake_name}_contract.rb"
File.open(filename, 'w') {|f| f.write(output) }

output = %Q{require_relative '../../contracts/#{snake_name}_jack_contract'
output = %Q{require_relative '../../contracts/#{snake_name}_contract'
describe #{k}Contract do
#{method_specs}
end
}

filename = "#{@app.dir}/spec/contracts/#{snake_name}_jack_spec.rb"
filename = "#{@app.dir}/spec/contracts/#{snake_name}_spec.rb"
File.open(filename, 'w') {|f| f.write(output) }

output = %Q{require_relative '../../contracts/#{snake_name}_jack_contract'
output = %Q{require_relative '../../contracts/#{snake_name}_contract'
class #{k}Double
def self.create behavior
Expand All @@ -187,7 +187,7 @@ class #{k}_BadOutput < #{k}Contract
end
}

filename = "#{@app.dir}/spec/doubles/#{snake_name}_jack_double.rb"
filename = "#{@app.dir}/spec/doubles/#{snake_name}_double.rb"
File.open(filename, 'w') {|f| f.write(output) }

end
Expand Down
2 changes: 1 addition & 1 deletion lib/obvious/version.rb
@@ -1,3 +1,3 @@
module Obvious
VERSION = "0.0.7"
VERSION = "0.0.8"
end

0 comments on commit fdc35b1

Please sign in to comment.