dolzenko 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
data/bin/camelize ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ puts ARGV[0].gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
File without changes
data/bin/generate_spec ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ parts = ARGV[0].split(/[\\\/]/)
6
+
7
+ def camelize(s)
8
+ s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
9
+ end
10
+
11
+ def underscore(camel_cased_word)
12
+ word = camel_cased_word.to_s.dup
13
+ word.gsub!(/::/, '/')
14
+ word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
15
+ word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
16
+ word.tr!("-", "_")
17
+ word.downcase!
18
+ word
19
+ end
20
+
21
+
22
+ if parts.include?("lib")
23
+ project_root = parts[0 .. parts.index('lib') - 1].join("/")
24
+
25
+ class_path = parts[parts.index('lib') .. -2].join("/")
26
+
27
+ class_file_path = parts[parts.index('lib') + 1 .. -1].join("/")
28
+
29
+ spec_name = File.basename(parts[-1]).sub(/\.rb$/, "_spec.rb")
30
+
31
+ FileUtils.mkdir_p(File.join(project_root, "spec", class_path))
32
+
33
+ spec_path = File.join(project_root, "spec", class_path, spec_name)
34
+
35
+ raise "#{ spec_path } already exists" if File.exist?(spec_path)
36
+
37
+ spec_class_name = camelize class_file_path.sub(/\.rb$/, "")
38
+
39
+ File.open(spec_path, "w") do |f|
40
+ f.puts "require \"#{ class_file_path.sub(/\.rb$/, "") }\""
41
+ f.puts ""
42
+ f.puts "describe #{ spec_class_name } do"
43
+ f.puts "end"
44
+ end
45
+
46
+ puts "#{ spec_path } generated"
47
+ else
48
+ raise "Don't know how to generate spec for #{ ARGV[0] }"
49
+ end
data/bin/underscore ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
4
+ #
5
+ # Changes '::' to '/' to convert namespaces to paths.
6
+ #
7
+ # Examples:
8
+ # "ActiveRecord".underscore # => "active_record"
9
+ # "ActiveRecord::Errors".underscore # => active_record/errors
10
+ def underscore(camel_cased_word)
11
+ word = camel_cased_word.to_s.dup
12
+ word.gsub!(/::/, '/')
13
+ word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
14
+ word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
15
+ word.tr!("-", "_")
16
+ word.downcase!
17
+ word
18
+ end
19
+
20
+ puts underscore(ARGV[0])
data/dolzenko.gemspec CHANGED
@@ -8,7 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.email = ["dolzenko@gmail.com"]
9
9
  s.homepage = "http://github.com/dolzenko/dolzenko-gem"
10
10
  s.summary = "Tiny meta gem which makes dolzenko happy"
11
- s.files = Dir.glob("lib/**/*") + %w(dolzenko.gemspec)
11
+ s.files = Dir.glob("{bin,lib}/**/*") + %w(dolzenko.gemspec)
12
+ s.executables = Dir.glob("bin/*").to_a.map { |path| File.basename(path) }
12
13
  s.add_dependency("facets", "2.8.3")
13
14
  s.add_dependency("activesupport", "3.0.0.beta3")
14
15
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 17
9
- version: 0.0.17
8
+ - 18
9
+ version: 0.0.18
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evgeniy Dolzhenko
@@ -14,14 +14,13 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-28 00:00:00 -07:00
17
+ date: 2010-05-31 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: facets
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
24
  requirements:
26
25
  - - "="
27
26
  - !ruby/object:Gem::Version
@@ -36,7 +35,6 @@ dependencies:
36
35
  name: activesupport
37
36
  prerelease: false
38
37
  requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
38
  requirements:
41
39
  - - "="
42
40
  - !ruby/object:Gem::Version
@@ -51,13 +49,20 @@ dependencies:
51
49
  description:
52
50
  email:
53
51
  - dolzenko@gmail.com
54
- executables: []
55
-
52
+ executables:
53
+ - camelize
54
+ - generate_binary.rb
55
+ - generate_spec
56
+ - underscore
56
57
  extensions: []
57
58
 
58
59
  extra_rdoc_files: []
59
60
 
60
61
  files:
62
+ - bin/camelize
63
+ - bin/generate_binary.rb
64
+ - bin/generate_spec
65
+ - bin/underscore
61
66
  - lib/dolzenko/acts_as.rb
62
67
  - lib/dolzenko/alias_method_chain_once.rb
63
68
  - lib/dolzenko/django_f_object.rb
@@ -83,7 +88,6 @@ rdoc_options: []
83
88
  require_paths:
84
89
  - lib
85
90
  required_ruby_version: !ruby/object:Gem::Requirement
86
- none: false
87
91
  requirements:
88
92
  - - ">="
89
93
  - !ruby/object:Gem::Version
@@ -91,7 +95,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
95
  - 0
92
96
  version: "0"
93
97
  required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
98
  requirements:
96
99
  - - ">="
97
100
  - !ruby/object:Gem::Version
@@ -101,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
104
  requirements: []
102
105
 
103
106
  rubyforge_project:
104
- rubygems_version: 1.3.7
107
+ rubygems_version: 1.3.6
105
108
  signing_key:
106
109
  specification_version: 3
107
110
  summary: Tiny meta gem which makes dolzenko happy