gemsmith 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ = v0.4.0
2
+
3
+ * Fixed bug with options not being supplied as second argument to write_inheritable_attribute for ActionController and ActiveRecord class method templates.
4
+ * Changed the -R option to -r for Rails and added the -s option for RSpec.
5
+ * Trimmed ERB whitespace from templates where apt.
6
+ * Cleaned up the source_root code for both the install and upgrade generator templates.
7
+ * Renamed the copy_files method to the execute method for both the install and upgrade generator templates.
8
+ * Moved desc method next to execution method for both the install and upgrade generator templates.
9
+ * Removed the banners from the install and upgrade generator templates since this is auto-generated by Thor.
10
+
1
11
  = v0.3.0
2
12
 
3
13
  * Added Best Practices section to the README.
@@ -1,8 +1,8 @@
1
1
  = Overview
2
2
 
3
- Gemsmith allows you to easily craft new gems via the command line with custom settings (if desired). If you are a fan
4
- of Bundler[https://github.com/carlhuda/bundler] and appreciate the quick and easy setup you get via the +bundle gem+
5
- command then you'll enjoy this gem since it is essentially an enhanced version of Bundler.
3
+ Gemsmith allows you to easily craft new gems via the command line with custom settings (if desired). If you are
4
+ a fan of Bundler[https://github.com/carlhuda/bundler], then you'll appreciate the quick and easy setup. Gemsmith
5
+ is essentially an enhanced version of Bundler's gem building capabilities.
6
6
 
7
7
  = Features
8
8
 
@@ -24,8 +24,7 @@ Type the following from the command line to install:
24
24
 
25
25
  gem install gemsmith
26
26
 
27
- You can also configure common custom settings that you would like to apply to all new gems that you build. To do this,
28
- simply create the following file:
27
+ You can also configure common settings for future gem builds by creating the following file:
29
28
 
30
29
  ~/.gemsmith/settings.yml
31
30
 
@@ -39,8 +38,7 @@ simply create the following file:
39
38
  :company_name: Red Alchmist
40
39
  :company_url: http://www.redalchemist.com
41
40
 
42
- NOTE: All options above are optional. You don't have to create the setting.yml at all or you can pick and
43
- choose what options to define. Up to you. If no options are configured, then the default options are as follows:
41
+ NOTE: All options above are optional. If no options are configured, then the defaults are as follows:
44
42
 
45
43
  gem_platform: Gem::Platform::RUBY
46
44
  author_name: <git user name>
@@ -60,10 +58,10 @@ From the command line, type: gemsmith help
60
58
 
61
59
  For more gem creation options, type: gemsmith help create
62
60
 
63
- -r, [--rspec] # Add RSpec support.
61
+ -b, [--bin] # Add binary support.
62
+ -r, [--rails] # Add Rails support.
63
+ -s, [--rspec] # Add RSpec support.
64
64
  # Default: true
65
- -b, [--bin] # Adds binary support.
66
- -R, [--rails] # Adds Rails support.
67
65
 
68
66
  Also, don't forget that once you have created your gem skeleton, the following rake tasks are also
69
67
  available to you via Bundler (i.e. rake -T):
@@ -22,8 +22,8 @@ module Gemsmith
22
22
  desc "-c, [create=GEM_NAME]", "Create new gem."
23
23
  map "-c" => :create
24
24
  method_option :bin, :aliases => "-b", :desc => "Add binary support.", :type => :boolean, :default => false
25
- method_option :rails, :aliases => "-R", :desc => "Add Rails support.", :type => :boolean, :default => false
26
- method_option :rspec, :aliases => "-r", :desc => "Add RSpec support.", :type => :boolean, :default => true
25
+ method_option :rails, :aliases => "-r", :desc => "Add Rails support.", :type => :boolean, :default => false
26
+ method_option :rspec, :aliases => "-s", :desc => "Add RSpec support.", :type => :boolean, :default => true
27
27
  def create name
28
28
  say
29
29
  say_info "Creating gem..."
@@ -3,19 +3,23 @@
3
3
  = Features
4
4
 
5
5
  = Requirements
6
- <% if config[:rails] %>
6
+
7
+ <%- if config[:rails] -%>
7
8
  1. {Ruby on Rails}[http://rubyonrails.org].
8
- <% end %>
9
+ <%- end -%>
10
+
9
11
  = Setup
10
12
 
11
13
  Type the following from the command line to install:
12
14
 
13
15
  gem install <%= config[:gem_name] %>
14
- <% if config[:rails] %>
16
+
17
+ <%- if config[:rails] -%>
15
18
  Add the following to your Gemfile:
16
19
 
17
20
  gem "<%= config[:gem_name] %>"
18
- <% end %>
21
+ <%- end -%>
22
+
19
23
  = Usage
20
24
 
21
25
  = Author
@@ -13,10 +13,18 @@ Gem::Specification.new do |s|
13
13
  s.description = "TODO: Write gem description."
14
14
 
15
15
  s.rdoc_options << "CHANGELOG.rdoc"
16
- <% if config[:bin] %>s.add_dependency "thor"<% end %>
17
- <% if config[:rspec] %>s.add_development_dependency "rspec"<% end %>
18
- <% if config[:bin] %>s.add_development_dependency "aruba"<% end %>
19
- <% if config[:bin] %>s.executables << "<%= config[:gem_name] %>"<% end %>
16
+ <%- if config[:bin] -%>
17
+ s.add_dependency "thor"
18
+ <%- end -%>
19
+ <%- if config[:rspec] -%>
20
+ s.add_development_dependency "rspec"
21
+ <%- end -%>
22
+ <%- if config[:bin] -%>
23
+ s.add_development_dependency "aruba"
24
+ <%- end -%>
25
+ <%- if config[:bin] -%>
26
+ s.executables << "<%= config[:gem_name] %>"
27
+ <%- end -%>
20
28
 
21
29
  s.files = `git ls-files`.split("\n")
22
30
  s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
@@ -1,18 +1,19 @@
1
1
  # Dependencies
2
2
  require File.join File.dirname(__FILE__), "<%= config[:gem_name] %>", "version.rb"
3
- <% if config[:rails] %>
3
+ <%- if config[:rails] -%>
4
4
  require File.join File.dirname(__FILE__), "<%= config[:gem_name] %>", "active_record", "class_methods.rb"
5
5
  require File.join File.dirname(__FILE__), "<%= config[:gem_name] %>", "active_record", "instance_methods.rb"
6
6
  require File.join File.dirname(__FILE__), "<%= config[:gem_name] %>", "action_view", "instance_methods.rb"
7
7
  require File.join File.dirname(__FILE__), "<%= config[:gem_name] %>", "action_controller", "class_methods.rb"
8
8
  require File.join File.dirname(__FILE__), "<%= config[:gem_name] %>", "action_controller", "instance_methods.rb"
9
- <% end %>
9
+ <%- end -%>
10
10
 
11
11
  # Namespace
12
12
  module <%= config[:gem_class] %>
13
13
  # Placeholder.
14
14
  end
15
- <% if config[:rails] %>
15
+
16
+ <%- if config[:rails] -%>
16
17
  # Rails Enhancements
17
18
  if defined? Rails
18
19
  # Model
@@ -30,4 +31,4 @@ if defined? Rails
30
31
  ActionController::Base.send :include, <%= config[:gem_class] %>::ActionController
31
32
  end
32
33
  end
33
- <% end %>
34
+ <%- end -%>
@@ -11,7 +11,7 @@ module <%= config[:gem_class] %>
11
11
 
12
12
  # Default Options
13
13
  class_inheritable_reader :<%= config[:gem_name] %>_options
14
- write_inheritable_attribute :<%= config[:gem_name] %>_options
14
+ write_inheritable_attribute :<%= config[:gem_name] %>_options, options
15
15
  end
16
16
  end
17
17
  end
@@ -11,7 +11,7 @@ module <%= config[:gem_class] %>
11
11
 
12
12
  # Default Options
13
13
  class_inheritable_reader :<%= config[:gem_name] %>_options
14
- write_inheritable_attribute :<%= config[:gem_name] %>_options
14
+ write_inheritable_attribute :<%= config[:gem_name] %>_options, options
15
15
  end
16
16
  end
17
17
  end
@@ -1,19 +1,9 @@
1
1
  module <%= config[:gem_class] %>
2
2
  class InstallGenerator < Rails::Generators::Base
3
- desc "Installs additional <%= config[:gem_class] %> resources."
4
-
5
- # Override the default source path by pulling from a shared templates directory for all generators.
6
- def self.source_root
7
- @source_root ||= File.join(File.dirname(__FILE__), "..", "templates")
8
- end
3
+ source_root File.join(File.dirname(__FILE__), "..", "templates")
9
4
 
10
- # Let others know about you.
11
- def self.banner
12
- "rails generate <%= config[:gem_name] %>:install"
13
- end
14
-
15
- # TODO - Explain yourself.
16
- def copy_files
5
+ desc "Installs additional <%= config[:gem_class] %> resources."
6
+ def execute
17
7
  # TODO - Add your fancy/schmancy install code here.
18
8
  end
19
9
  end
@@ -1,19 +1,9 @@
1
1
  module <%= config[:gem_class] %>
2
2
  class UpgradeGenerator < Rails::Generators::Base
3
- desc "Upgrades previously installed <%= config[:gem_class] %> resources."
4
-
5
- # Override the default source path by pulling from a shared templates directory for all generators.
6
- def self.source_root
7
- @source_root ||= File.join(File.dirname(__FILE__), "..", "templates")
8
- end
3
+ source_root File.join(File.dirname(__FILE__), "..", "templates")
9
4
 
10
- # Let others know about you.
11
- def self.banner
12
- "rails generate <%= config[:gem_name] %>:upgrade"
13
- end
14
-
15
- # TODO - Explain yourself.
16
- def copy_files
5
+ desc "Upgrades previously installed <%= config[:gem_class] %> resources."
6
+ def execute
17
7
  # TODO - Add your fancy/schmancy upgrade code here.
18
8
  end
19
9
  end
@@ -1,3 +1,3 @@
1
1
  module Gemsmith
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemsmith
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brooke Kuhlmann
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-10 00:00:00 Z
18
+ date: 2011-07-31 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: thor
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  requirements: []
136
136
 
137
137
  rubyforge_project:
138
- rubygems_version: 1.8.5
138
+ rubygems_version: 1.8.6
139
139
  signing_key:
140
140
  specification_version: 3
141
141
  summary: Ruby gem skeleton generation for the professional gemsmith.