cowboycoded 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -15,4 +15,5 @@ end
15
15
  group :test do
16
16
  gem "rspec"
17
17
  gem "systemu"
18
+ gem "rails"
18
19
  end
data/README.md CHANGED
@@ -9,6 +9,12 @@ Utility classes, core_ext, generators and rake tasks to help ease development
9
9
  Add test group to your gemfile
10
10
 
11
11
  rails g cowboycoded:test_group
12
+
13
+ ## Core Extensions
14
+
15
+ ### String
16
+ "1,000.12".is_numeric? #=> true
17
+ "abc".is_numeric? #=> false
12
18
 
13
19
 
14
20
  ## Contributing to my_generators
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/cowboycoded.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cowboycoded}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John McAliley"]
12
- s.date = %q{2011-05-10}
12
+ s.date = %q{2011-05-19}
13
13
  s.description = %q{helps you code quicker}
14
14
  s.email = %q{john.mcaliley@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -24,11 +24,19 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "cowboycoded.gemspec",
27
+ "lib/core_ext/string.rb",
27
28
  "lib/cowboycoded.rb",
29
+ "lib/cowboycoded/cucumber_steps/browser.rb",
30
+ "lib/cowboycoded/cucumber_steps/file.rb",
28
31
  "lib/cowboycoded/railtie.rb",
32
+ "lib/generators/cowboycoded/common_app/USAGE",
33
+ "lib/generators/cowboycoded/common_app/common_app_generator.rb",
34
+ "lib/generators/cowboycoded/engine/engine_generator.rb",
35
+ "lib/generators/cowboycoded/railtie/railtie_generator.rb",
29
36
  "lib/generators/cowboycoded/test_group/USAGE",
30
37
  "lib/generators/cowboycoded/test_group/templates/Gemfile",
31
38
  "lib/generators/cowboycoded/test_group/test_group_generator.rb",
39
+ "spec/core_ext_spec.rb",
32
40
  "spec/spec_helper.rb",
33
41
  "spec/templates/Gemfile",
34
42
  "spec/test_generator_spec.rb",
@@ -81,6 +89,7 @@ Gem::Specification.new do |s|
81
89
  s.rubygems_version = %q{1.3.7}
82
90
  s.summary = %q{Utility classes, core_ext and generators to ease development}
83
91
  s.test_files = [
92
+ "spec/core_ext_spec.rb",
84
93
  "spec/spec_helper.rb",
85
94
  "spec/test_generator_spec.rb"
86
95
  ]
@@ -0,0 +1,9 @@
1
+ class String
2
+ def is_numeric?
3
+ self.gsub!(",","")
4
+ Float(self)
5
+ true
6
+ rescue
7
+ false
8
+ end
9
+ end
data/lib/cowboycoded.rb CHANGED
@@ -1,6 +1,9 @@
1
- COWBOYCODED_PATH = File.dirname(__FILE__) + "/cowboycoded"
2
- require "#{COWBOYCODED_PATH}/railtie.rb"
1
+ require 'cowboycoded/railtie'
2
+ require 'core_ext/string'
3
3
 
4
4
  module Cowboycoded
5
-
5
+ module CucumberSteps
6
+ autoload :BrowserSteps, 'cucumber_steps/browser_steps'
7
+ autoload :FileSteps, 'cucumber_steps/file_steps'
8
+ end
6
9
  end
@@ -0,0 +1,6 @@
1
+ module CowboyCoded
2
+ module CucumberSteps
3
+ module Browser
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,35 @@
1
+ module CowboyCoded
2
+ module CucumberSteps
3
+ module File
4
+ Given /^a working directory$/ do
5
+ @working_dir = File.dirname(__FILE__)+"/../../"
6
+ end
7
+
8
+ Then /^a timestamped file named "([^"]*)" is created in the "([^"]*)" directory$/ do |file,dir|
9
+ full_dir = @working_dir+dir
10
+ Dir.entries(full_dir).each do |timestamped_file|
11
+ file = timestamped_file if timestamped_file.include? file
12
+ end
13
+ assert File.exists?(full_dir+file), "#{file} expected to exist, but did not"
14
+ assert File.file?(full_dir+file), "#{file} expected to be a file, but is not"
15
+ end
16
+
17
+ When /^I run the "([^"]*)" generator$/ do |generator|
18
+ @generator_output = systemu("rails g #{generator}")
19
+ end
20
+
21
+ Then /^a file named "([^"]*)" is created in the "([^"]*)" directory$/ do |file,dir|
22
+ full_dir = @working_dir+dir
23
+ assert File.exists?(full_dir+file), "#{file} expected to exist, but did not"
24
+ assert File.file?(full_dir+file), "#{file} expected to be a file, but is not"
25
+ end
26
+
27
+ Then /^the file "([^"]*)" contains "([^"]*)"$/ do |file, text|
28
+ path = @working_dir+file
29
+ file_content = IO.read(path)
30
+ assert file_content.match(/#{text}/), "#{text} expected in #{path}"
31
+ end
32
+ end
33
+ end
34
+ end
35
+
File without changes
@@ -0,0 +1,14 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ module Cowboycoded
5
+ class CommonAppGenerator < Rails::Generators::Base
6
+ TEMPLATES_DIR = File.join(File.dirname(__FILE__), 'templates')
7
+ source_root TEMPLATES_DIR
8
+
9
+ def common_app
10
+ append_file("Gemfile", "\ngem 'boilerplate_engine', :git=>'git@github.com:charlotte-ruby/boilerplate_engine.git'")
11
+ append_file("Gemfile", "\ngem 'social_engine', :git=>'git@github.com:charlotte-ruby/social_engine.git'")
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ module Cowboycoded
5
+ class EngineGenerator < Rails::Generators::Base
6
+ TEMPLATES_DIR = File.join(File.dirname(__FILE__), 'templates')
7
+ source_root TEMPLATES_DIR
8
+
9
+ def generate
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe String do
4
+ it "should return true if string is numeric" do
5
+ "1".is_numeric?.should be true
6
+ "1.0".is_numeric?.should be true
7
+ ".1".is_numeric?.should be true
8
+ "1,000".is_numeric?.should be true
9
+ "1,000.123".is_numeric?.should be true
10
+ "0".is_numeric?.should be true
11
+ end
12
+
13
+ it "should return false if string is not numeric" do
14
+ "1t".is_numeric?.should be false
15
+ "".is_numeric?.should be false
16
+ "hello".is_numeric?.should be false
17
+ "1,000.a".is_numeric?.should be false
18
+ end
19
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - John McAliley
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-10 00:00:00 -04:00
17
+ date: 2011-05-19 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -90,11 +90,19 @@ files:
90
90
  - Rakefile
91
91
  - VERSION
92
92
  - cowboycoded.gemspec
93
+ - lib/core_ext/string.rb
93
94
  - lib/cowboycoded.rb
95
+ - lib/cowboycoded/cucumber_steps/browser.rb
96
+ - lib/cowboycoded/cucumber_steps/file.rb
94
97
  - lib/cowboycoded/railtie.rb
98
+ - lib/generators/cowboycoded/common_app/USAGE
99
+ - lib/generators/cowboycoded/common_app/common_app_generator.rb
100
+ - lib/generators/cowboycoded/engine/engine_generator.rb
101
+ - lib/generators/cowboycoded/railtie/railtie_generator.rb
95
102
  - lib/generators/cowboycoded/test_group/USAGE
96
103
  - lib/generators/cowboycoded/test_group/templates/Gemfile
97
104
  - lib/generators/cowboycoded/test_group/test_group_generator.rb
105
+ - spec/core_ext_spec.rb
98
106
  - spec/spec_helper.rb
99
107
  - spec/templates/Gemfile
100
108
  - spec/test_generator_spec.rb
@@ -154,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
162
  requirements:
155
163
  - - ">="
156
164
  - !ruby/object:Gem::Version
157
- hash: -571463661338661124
165
+ hash: -2488843122945949152
158
166
  segments:
159
167
  - 0
160
168
  version: "0"
@@ -174,5 +182,6 @@ signing_key:
174
182
  specification_version: 3
175
183
  summary: Utility classes, core_ext and generators to ease development
176
184
  test_files:
185
+ - spec/core_ext_spec.rb
177
186
  - spec/spec_helper.rb
178
187
  - spec/test_generator_spec.rb