technicalpickles-jeweler 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -6,33 +6,28 @@
6
6
  # Create a Rakefile:
7
7
 
8
8
  require 'rake'
9
- require 'jeweler'
10
-
11
- Jeweler.gemspec = Gem::Specification.new do |s|
12
- s.name = "jeweler"
13
- s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
14
- s.email = "josh@technicalpickles.com"
15
- s.homepage = "http://github.com/technicalpickles/jeweler"
16
- s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
17
- s.authors = ["Josh Nichols"]
18
- s.files = FileList["[A-Z]*", "{generators,lib,test}/**/*"]
19
- end
20
9
 
21
- Note, we don't include 'date', or 'version'. Jeweler takes care of that.
22
-
23
- Jeweler assumes you'll have either a class or module similar to your spec's name. This value gets camelized, so...
24
-
25
- Good:
10
+ begin
11
+ require 'jeweler'
12
+ Jeweler.gemspec = Gem::Specification.new do |s|
13
+ s.name = "jeweler"
14
+ s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
15
+ s.email = "josh@technicalpickles.com"
16
+ s.homepage = "http://github.com/technicalpickles/jeweler"
17
+ s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
18
+ s.authors = ["Josh Nichols", "Dan Croak"]
19
+ s.files = FileList["[A-Z]*", "{generators,lib,test}/**/*"]
20
+ end
21
+ rescue LoadError
22
+ puts "Jeweler not available. Try installing technicalpickles-jeweler."
23
+ end
26
24
 
27
- * safety\_valve -> SafetyValve
28
- * clearance -> Clearance
29
25
 
30
- Bad:
26
+ Note, we don't include 'date', or 'version'. Jeweler takes care of that.
31
27
 
32
- * shoulda-generator -> Shoulda-generator (not valid!)
33
- * ruby-debug -> Ruby-debug (not valid!)
28
+ If you don't specify `s.files`, it will use `s.files = FileList["[A-Z]*", "{generators,lib,test,spec}/**/*"]`
34
29
 
35
- We're opinionated and lazy.
30
+ For now, `s.name` should be lower-cased and underscored, without hyphens. That's because Jeweler camelizes and constantizes this value internally. For example, `ruby-debug` would be camelized/constanized to `Ruby-debug`, which isn't valid.
36
31
 
37
32
  # Create a version file
38
33
 
data/Rakefile CHANGED
@@ -2,14 +2,18 @@ require 'rake'
2
2
  require 'rake/testtask'
3
3
 
4
4
  $:.unshift('lib')
5
- require 'jeweler'
6
5
 
7
- Jeweler.gemspec = Gem::Specification.new do |s|
8
- s.name = "jeweler"
9
- s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
10
- s.email = "josh@technicalpickles.com"
11
- s.homepage = "http://github.com/technicalpickles/jeweler"
12
- s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
13
- s.authors = ["Josh Nichols"]
14
- s.files = FileList["[A-Z]*", "{generators,lib,test}/**/*"]
15
- end
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler.gemspec = Gem::Specification.new do |s|
9
+ s.name = "jeweler"
10
+ s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
11
+ s.email = "josh@technicalpickles.com"
12
+ s.homepage = "http://github.com/technicalpickles/jeweler"
13
+ s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
14
+ s.authors = ["Josh Nichols", "Dan Croak"]
15
+ s.files = FileList["[A-Z]*", "{generators,lib,test}/**/*"]
16
+ end
17
+ rescue LoadError
18
+ puts "Jeweler not available. Try installing technicalpickles-jeweler."
19
+ end
data/TODO ADDED
@@ -0,0 +1,6 @@
1
+ * Support dashes in spec names
2
+ * ruby-debug -> Ruby::Debug
3
+ * safety_valve -> SafetyValve
4
+ * Generator for making new Jeweler projects
5
+ * Git tagging/branching
6
+ * Release task
@@ -0,0 +1,38 @@
1
+ class Jeweler
2
+ # This stuff is blatently ripped out of active_support's inflector
3
+ module ActiveSupport
4
+ if Module.method(:const_get).arity == 1
5
+ def constantize(camel_cased_word)
6
+ names = camel_cased_word.split('::')
7
+ names.shift if names.empty? || names.first.empty?
8
+
9
+ constant = Object
10
+ names.each do |name|
11
+ constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
12
+ end
13
+ constant
14
+ end
15
+ else
16
+ def constantize(camel_cased_word) #:nodoc:
17
+ names = camel_cased_word.split('::')
18
+ names.shift if names.empty? || names.first.empty?
19
+
20
+ constant = Object
21
+ names.each do |name|
22
+ constant = constant.const_get(name, false) || constant.const_missing(name)
23
+ end
24
+ constant
25
+ end
26
+ end
27
+
28
+ def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
29
+ if first_letter_in_uppercase
30
+ lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
31
+ else
32
+ lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
33
+ end
34
+ end
35
+ end
36
+
37
+ extend ActiveSupport
38
+ end
data/lib/jeweler/tasks.rb CHANGED
@@ -15,6 +15,7 @@ namespace :version do
15
15
  major = Jeweler.major_version + 1
16
16
  Jeweler.bump_version(major, 0, 0)
17
17
  Jeweler.write_gemspec
18
+ puts "Version bumped to #{Jeweler.version}"
18
19
  end
19
20
 
20
21
  desc "Bump the gemspec a minor version."
@@ -22,6 +23,7 @@ namespace :version do
22
23
  minor = Jeweler.minor_version + 1
23
24
  Jeweler.bump_version(Jeweler.major_version, minor, 0)
24
25
  Jeweler.write_gemspec
26
+ puts "Version bumped to #{Jeweler.version}"
25
27
  end
26
28
 
27
29
  desc "Bump the gemspec a patch version."
@@ -29,6 +31,7 @@ namespace :version do
29
31
  patch = Jeweler.patch_version + 1
30
32
  Jeweler.bump_version(Jeweler.major_version, Jeweler.minor_version, patch)
31
33
  Jeweler.write_gemspec
34
+ puts "Version bumped to #{Jeweler.version}"
32
35
  end
33
36
  end
34
37
  end
@@ -2,6 +2,6 @@ class Jeweler
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
6
6
  end
7
7
  end
data/lib/jeweler.rb CHANGED
@@ -3,8 +3,9 @@ require 'date'
3
3
  class Jeweler
4
4
  def self.gemspec=(gemspec)
5
5
  @@gemspec = gemspec
6
- require version_module_path
6
+ load version_module_path
7
7
  @@gemspec.version = version
8
+ @@gemspec.files ||= FileList["[A-Z]*", "{generators,lib,test,spec}/**/*"]
8
9
  end
9
10
 
10
11
  def self.major_version
@@ -51,6 +52,7 @@ end
51
52
  END
52
53
  end
53
54
  @@gemspec.version = "#{major}.#{minor}.#{patch}"
55
+ refresh_version
54
56
  end
55
57
 
56
58
  def self.write_gemspec
@@ -78,37 +80,17 @@ end
78
80
  camelize(@@gemspec.name)
79
81
  end
80
82
 
81
- if Module.method(:const_get).arity == 1
82
- def self.constantize(camel_cased_word)
83
- names = camel_cased_word.split('::')
84
- names.shift if names.empty? || names.first.empty?
85
-
86
- constant = Object
87
- names.each do |name|
88
- constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
89
- end
90
- constant
91
- end
92
- else
93
- def self.constantize(camel_cased_word) #:nodoc:
94
- names = camel_cased_word.split('::')
95
- names.shift if names.empty? || names.first.empty?
96
-
97
- constant = Object
98
- names.each do |name|
99
- constant = constant.const_get(name, false) || constant.const_missing(name)
100
- end
101
- constant
102
- end
103
- end
104
-
105
- def self.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
106
- if first_letter_in_uppercase
107
- lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
108
- else
109
- lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
83
+ def self.refresh_version
84
+ # Remove the constants, so we can reload the version_module
85
+ version_module.module_eval do
86
+ remove_const(:MAJOR)
87
+ remove_const(:MINOR)
88
+ remove_const(:PATCH)
110
89
  end
90
+ load version_module_path
111
91
  end
112
92
  end
113
93
 
94
+ require 'jeweler/active_support' # Adds the stolen camelize and constantize
95
+
114
96
  require 'jeweler/tasks'
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technicalpickles-jeweler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
8
+ - Dan Croak
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2008-10-11 00:00:00 -07:00
13
+ date: 2008-10-12 00:00:00 -07:00
13
14
  default_executable:
14
15
  dependencies: []
15
16
 
@@ -24,7 +25,9 @@ extra_rdoc_files: []
24
25
  files:
25
26
  - Rakefile
26
27
  - README.markdown
28
+ - TODO
27
29
  - lib/jeweler
30
+ - lib/jeweler/active_support.rb
28
31
  - lib/jeweler/tasks.rb
29
32
  - lib/jeweler/version.rb
30
33
  - lib/jeweler.rb