gemsmith 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +9 -0
- data/README.rdoc +14 -10
- data/lib/gemsmith/cli.rb +14 -37
- data/lib/gemsmith/templates/README.rdoc.tmp +5 -3
- data/lib/gemsmith/templates/bin/gem.tmp +2 -1
- data/lib/gemsmith/templates/spec/gem_spec.rb.tmp +1 -2
- data/lib/gemsmith/version.rb +1 -1
- data/spec/settings_spec.rb +8 -10
- metadata +53 -56
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
= v1.2.0
|
2
|
+
|
3
|
+
* Updated README and README template with new layout for test instructions.
|
4
|
+
* Upgraded to Thor+ 0.2.0 and removed the settings_file, settings, and load_settings methods.
|
5
|
+
* Added Why You Should Use a BSD license to the README Best Practices section.
|
6
|
+
* Added the Best Practices While Cutting Gems to the Best Practices section of the README.
|
7
|
+
* Added the ruby warning and encoding option formats to the binary template.
|
8
|
+
* Removed the do block from RSpec template so that initial tests show pending instead of successful results.
|
9
|
+
|
1
10
|
= v1.1.0
|
2
11
|
|
3
12
|
* Fixed bug where args, options, and config were not being passed to super for CLI initialize for gem and gem template generation.
|
data/README.rdoc
CHANGED
@@ -16,9 +16,9 @@ gem. Gemsmith is essentially an enhanced version of Bundler's gem building capab
|
|
16
16
|
|
17
17
|
= Requirements
|
18
18
|
|
19
|
-
1.
|
20
|
-
2.
|
21
|
-
3.
|
19
|
+
1. A UNIX-based system.
|
20
|
+
2. {Ruby 1.9.x}[http://www.ruby-lang.org]
|
21
|
+
3. RubyGems[http://rubygems.org]
|
22
22
|
4. Bundler[https://github.com/carlhuda/bundler]
|
23
23
|
|
24
24
|
= Setup
|
@@ -77,20 +77,24 @@ available to you via Bundler (i.e. rake -T):
|
|
77
77
|
rake install # Build and install <gem>-<version>.gem into system gems
|
78
78
|
rake release # Create tag v0.1.1 and build and push <gem>-<version>.gem to Rubygems
|
79
79
|
|
80
|
-
=
|
80
|
+
= Best Practices
|
81
81
|
|
82
|
-
|
82
|
+
1. {Best Practices While Cutting Gems}[http://rubysource.com/crafting-rubies-best-practices-while-cutting-gems].
|
83
|
+
2. {Ruby on Rails Gem Packaging}[http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices].
|
84
|
+
3. {Why You Should Use a BSD Style License}[http://www.freebsd.org/doc/en/articles/bsdl-gpl/article.html].
|
85
|
+
4. Ensure the RUBYOPT env variable includes the -w option. {Details}[http://avdi.org/devblog/2011/06/23/how-ruby-helps-you-fix-your-broken-code].
|
83
86
|
|
84
|
-
|
87
|
+
= Tests
|
85
88
|
|
86
|
-
|
89
|
+
To test, do the following:
|
87
90
|
|
88
|
-
1.
|
89
|
-
2.
|
91
|
+
1. cd to the gem root.
|
92
|
+
2. bundle install
|
93
|
+
3. bundle exec rspec spec
|
90
94
|
|
91
95
|
= Contributions
|
92
96
|
|
93
|
-
Please log all feedback/issues via {GitHub Issues}[https://github.com/bkuhlmann/gemsmith/issues]
|
97
|
+
Please log all feedback/issues via {GitHub Issues}[https://github.com/bkuhlmann/gemsmith/issues]. Thanks.
|
94
98
|
|
95
99
|
= Credits
|
96
100
|
|
data/lib/gemsmith/cli.rb
CHANGED
@@ -16,7 +16,8 @@ module Gemsmith
|
|
16
16
|
# Initialize.
|
17
17
|
def initialize args = [], options = {}, config = {}
|
18
18
|
super args, options, config
|
19
|
-
|
19
|
+
@settings_file = File.join ENV["HOME"], ".gemsmith", "settings.yml"
|
20
|
+
@settings = load_yaml @settings_file
|
20
21
|
end
|
21
22
|
|
22
23
|
desc "-c, [create=GEM_NAME]", "Create new gem."
|
@@ -117,7 +118,7 @@ module Gemsmith
|
|
117
118
|
desc "-e, [edit]", "Edit gem settings in default editor (assumes $EDITOR environment variable)."
|
118
119
|
map "-e" => :edit
|
119
120
|
def edit
|
120
|
-
`$EDITOR #{settings_file}`
|
121
|
+
`$EDITOR #{@settings_file}`
|
121
122
|
end
|
122
123
|
|
123
124
|
desc "-v, [version]", "Show version."
|
@@ -133,30 +134,6 @@ module Gemsmith
|
|
133
134
|
|
134
135
|
private
|
135
136
|
|
136
|
-
# Answers the default settings file path.
|
137
|
-
def settings_file
|
138
|
-
@settings_file ||= File.join ENV["HOME"], ".gemsmith", "settings.yml"
|
139
|
-
end
|
140
|
-
|
141
|
-
# Load settings.
|
142
|
-
# ==== Parameters
|
143
|
-
# * +file+ - Required. The path to the settings (YAML) file.
|
144
|
-
def load_settings file
|
145
|
-
if file && File.exists?(file)
|
146
|
-
begin
|
147
|
-
settings = YAML::load_file file
|
148
|
-
@settings = settings.reject {|key, value| value.nil?}
|
149
|
-
rescue
|
150
|
-
error "Invalid settings: #{file}."
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
# Answers current settings.
|
156
|
-
def settings
|
157
|
-
@settings ||= {}
|
158
|
-
end
|
159
|
-
|
160
137
|
# Builds template options with default and/or custom settings (where the custom
|
161
138
|
# settings trump default settings).
|
162
139
|
# ==== Parameters
|
@@ -165,23 +142,23 @@ module Gemsmith
|
|
165
142
|
def build_template_options name, options = {}
|
166
143
|
gem_name = Thor::Util.snake_case name
|
167
144
|
gem_class = Thor::Util.camel_case name
|
168
|
-
author_name = settings[:author_name] || `git config user.name`.chomp || "TODO: Add full name here."
|
169
|
-
author_email = settings[:author_email] || `git config user.email`.chomp || "TODO: Add email address here."
|
170
|
-
author_url = settings[:author_url] || "https://www.unknown.com"
|
145
|
+
author_name = @settings[:author_name] || `git config user.name`.chomp || "TODO: Add full name here."
|
146
|
+
author_email = @settings[:author_email] || `git config user.email`.chomp || "TODO: Add email address here."
|
147
|
+
author_url = @settings[:author_url] || "https://www.unknown.com"
|
171
148
|
{
|
172
149
|
gem_name: gem_name,
|
173
150
|
gem_class: gem_class,
|
174
|
-
gem_platform: (settings[:gem_platform] || "Gem::Platform::RUBY"),
|
151
|
+
gem_platform: (@settings[:gem_platform] || "Gem::Platform::RUBY"),
|
175
152
|
author_name: author_name,
|
176
153
|
author_email: author_email,
|
177
154
|
author_url: (author_url || "http://www.unknown.com"),
|
178
|
-
gem_url: (settings[:gem_url] || author_url),
|
179
|
-
company_name: (settings[:company_name] || author_name),
|
180
|
-
company_url: (settings[:company_url] || author_url),
|
181
|
-
year: (settings[:year] || Time.now.year),
|
182
|
-
ruby_version: (settings[:ruby_version] || "1.9.0"),
|
183
|
-
rails_version: (settings[:rails_version] || "3.1.0"),
|
184
|
-
post_install_message: settings[:post_install_message],
|
155
|
+
gem_url: (@settings[:gem_url] || author_url),
|
156
|
+
company_name: (@settings[:company_name] || author_name),
|
157
|
+
company_url: (@settings[:company_url] || author_url),
|
158
|
+
year: (@settings[:year] || Time.now.year),
|
159
|
+
ruby_version: (@settings[:ruby_version] || "1.9.0"),
|
160
|
+
rails_version: (@settings[:rails_version] || "3.1.0"),
|
161
|
+
post_install_message: @settings[:post_install_message],
|
185
162
|
bin: (options[:bin] || false),
|
186
163
|
rails: (options[:rails] || false),
|
187
164
|
rspec: (options[:rspec].nil? ? true : options[:rspec]),
|
@@ -25,14 +25,16 @@ Add the following to your Gemfile:
|
|
25
25
|
<%- if config[:rspec] -%>
|
26
26
|
= Tests
|
27
27
|
|
28
|
-
To test,
|
28
|
+
To test, do the following:
|
29
29
|
|
30
|
-
|
30
|
+
1. cd to the gem root.
|
31
|
+
2. bundle install
|
32
|
+
3. bundle exec rspec spec
|
31
33
|
<%- end -%>
|
32
34
|
|
33
35
|
= Contributions
|
34
36
|
|
35
|
-
Please log all feedback/issues via GitHub Issues
|
37
|
+
Please log all feedback/issues via GitHub Issues. Thanks.
|
36
38
|
|
37
39
|
= Credits
|
38
40
|
|
data/lib/gemsmith/version.rb
CHANGED
data/spec/settings_spec.rb
CHANGED
@@ -4,28 +4,26 @@ describe "Settings" do
|
|
4
4
|
before :each do
|
5
5
|
# Default settings.
|
6
6
|
class Gemsmith::CLI
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@settings_file = File.join File.dirname(__FILE__), "support", "settings.yml"
|
10
|
+
@settings = {}
|
10
11
|
end
|
11
12
|
end
|
12
13
|
@cli_default = Gemsmith::CLI.new
|
13
14
|
|
14
15
|
# Custom settings.
|
15
16
|
class Gemsmith::CLI
|
16
|
-
|
17
|
-
|
18
|
-
File.join File.dirname(__FILE__), "support", "settings.yml"
|
17
|
+
def initialize
|
18
|
+
super
|
19
|
+
@settings_file = File.join File.dirname(__FILE__), "support", "settings.yml"
|
20
|
+
@settings = load_yaml @settings_file
|
19
21
|
end
|
20
22
|
end
|
21
23
|
@cli_custom = Gemsmith::CLI.new
|
22
24
|
end
|
23
25
|
|
24
26
|
context "Load" do
|
25
|
-
it "should be empty" do
|
26
|
-
@cli_default.send(:settings).should be_empty
|
27
|
-
end
|
28
|
-
|
29
27
|
it "should build defaults" do
|
30
28
|
author_name = `git config user.name`.chomp || "TODO: Add full name here."
|
31
29
|
author_url = "https://www.unknown.com"
|
metadata
CHANGED
@@ -1,70 +1,68 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemsmith
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 1.1.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Brooke Kuhlmann
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-01-02 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: thor
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70133761355280 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
18
|
+
requirements:
|
21
19
|
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
23
21
|
version: 0.14.0
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: thor_plus
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *70133761355280
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thor_plus
|
27
|
+
requirement: &70133761354820 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
34
32
|
version: 0.1.0
|
35
33
|
type: :runtime
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rspec
|
39
34
|
prerelease: false
|
40
|
-
|
35
|
+
version_requirements: *70133761354820
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70133761354440 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
46
44
|
type: :development
|
47
|
-
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: aruba
|
50
45
|
prerelease: false
|
51
|
-
|
46
|
+
version_requirements: *70133761354440
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: aruba
|
49
|
+
requirement: &70133761384180 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
57
55
|
type: :development
|
58
|
-
|
59
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70133761384180
|
58
|
+
description: ! 'Ruby gem skeleton generation for the professional gemsmith. Includes
|
59
|
+
custom settings, binary, Ruby on Rails, and RSpec support. '
|
60
60
|
email: brooke@redalchemist.com
|
61
|
-
executables:
|
61
|
+
executables:
|
62
62
|
- gemsmith
|
63
63
|
extensions: []
|
64
|
-
|
65
64
|
extra_rdoc_files: []
|
66
|
-
|
67
|
-
files:
|
65
|
+
files:
|
68
66
|
- .gitignore
|
69
67
|
- .rspec
|
70
68
|
- CHANGELOG.rdoc
|
@@ -104,33 +102,32 @@ files:
|
|
104
102
|
- spec/spec_helper.rb
|
105
103
|
- spec/support/settings.yml
|
106
104
|
homepage: http://www.redalchemist.com
|
107
|
-
licenses:
|
105
|
+
licenses:
|
108
106
|
- MIT
|
109
|
-
post_install_message:
|
110
|
-
rdoc_options:
|
107
|
+
post_install_message: ! '(W): www.redalchemist.com. (T): @ralchemist.'
|
108
|
+
rdoc_options:
|
111
109
|
- CHANGELOG.rdoc
|
112
|
-
require_paths:
|
110
|
+
require_paths:
|
113
111
|
- lib
|
114
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
113
|
none: false
|
116
|
-
requirements:
|
114
|
+
requirements:
|
117
115
|
- - ~>
|
118
|
-
- !ruby/object:Gem::Version
|
116
|
+
- !ruby/object:Gem::Version
|
119
117
|
version: 1.9.0
|
120
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
119
|
none: false
|
122
|
-
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version:
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
126
124
|
requirements: []
|
127
|
-
|
128
125
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.8.
|
126
|
+
rubygems_version: 1.8.13
|
130
127
|
signing_key:
|
131
128
|
specification_version: 3
|
132
129
|
summary: Ruby gem skeleton generation for the professional gemsmith.
|
133
|
-
test_files:
|
130
|
+
test_files:
|
134
131
|
- spec/settings_spec.rb
|
135
132
|
- spec/spec_helper.rb
|
136
133
|
- spec/support/settings.yml
|