gem-release 0.0.24 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gem_release/gemspec.rb +2 -2
- data/lib/gem_release/helpers.rb +0 -8
- data/lib/gem_release/template.rb +12 -4
- data/lib/gem_release/templates/gemspec +1 -1
- data/lib/gem_release/templates/version.rb +12 -3
- data/lib/gem_release/version.rb +1 -1
- data/lib/gem_release/version_file.rb +9 -1
- data/lib/rubygems/commands/bootstrap_command.rb +8 -5
- metadata +4 -4
data/lib/gem_release/gemspec.rb
CHANGED
@@ -9,8 +9,8 @@ module GemRelease
|
|
9
9
|
@email ||= user_email
|
10
10
|
@homepage ||= "https://github.com/#{github_user}/#{name}" || "[your github name]"
|
11
11
|
|
12
|
-
@summary ||= '[summary]'
|
13
|
-
@description ||= '[description]'
|
12
|
+
@summary ||= '[TODO: summary]'
|
13
|
+
@description ||= '[TODO: description]'
|
14
14
|
|
15
15
|
@strategy = options[:strategy]
|
16
16
|
end
|
data/lib/gem_release/helpers.rb
CHANGED
data/lib/gem_release/template.rb
CHANGED
@@ -6,7 +6,7 @@ module GemRelease
|
|
6
6
|
class Template
|
7
7
|
include GemRelease::Helpers
|
8
8
|
|
9
|
-
attr_reader :template, :name, :
|
9
|
+
attr_reader :template, :name, :module_names, :module_path
|
10
10
|
|
11
11
|
def initialize(template, options = {})
|
12
12
|
@template = template
|
@@ -16,9 +16,9 @@ module GemRelease
|
|
16
16
|
meta_class.send(:attr_reader, key)
|
17
17
|
end
|
18
18
|
|
19
|
-
@name
|
20
|
-
@module_path
|
21
|
-
@
|
19
|
+
@name ||= gem_name_from_directory
|
20
|
+
@module_path ||= name
|
21
|
+
@module_names ||= module_names_from_path(module_path)
|
22
22
|
end
|
23
23
|
|
24
24
|
def write
|
@@ -32,6 +32,14 @@ module GemRelease
|
|
32
32
|
|
33
33
|
protected
|
34
34
|
|
35
|
+
def module_names_from_path(path)
|
36
|
+
names = []
|
37
|
+
path.split('-').each do |segment|
|
38
|
+
names << segment.camelize
|
39
|
+
end
|
40
|
+
names
|
41
|
+
end
|
42
|
+
|
35
43
|
def render
|
36
44
|
ERB.new(read_template, nil, "%").result(binding)
|
37
45
|
end
|
@@ -5,7 +5,7 @@ require '<%= module_path %>/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = <%= name.inspect %>
|
8
|
-
s.version = <%=
|
8
|
+
s.version = <%= module_names.join('::') %>::VERSION
|
9
9
|
s.authors = [<%= author.inspect %>]
|
10
10
|
s.email = <%= email.inspect %>
|
11
11
|
s.homepage = <%= homepage.inspect %>
|
@@ -1,3 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<%=
|
2
|
+
i = 0
|
3
|
+
opening = ""
|
4
|
+
closing = ""
|
5
|
+
module_names.each do |n|
|
6
|
+
opening += "#{' ' * i}module #{n}\n"
|
7
|
+
closing = "#{' ' * i}end\n" + closing
|
8
|
+
i += 2
|
9
|
+
end
|
10
|
+
|
11
|
+
opening + "#{' ' * i}VERSION = #{version.inspect}\n" + closing
|
12
|
+
%>
|
data/lib/gem_release/version.rb
CHANGED
@@ -29,11 +29,19 @@ module GemRelease
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def filename
|
32
|
-
|
32
|
+
path = gem_name
|
33
|
+
path = path.gsub('-', '/') unless File.exists?(path_to_version_file(path))
|
34
|
+
path = path.gsub('/', '_') unless File.exists?(path_to_version_file(path))
|
35
|
+
|
36
|
+
File.expand_path(path_to_version_file(path))
|
33
37
|
end
|
34
38
|
|
35
39
|
protected
|
36
40
|
|
41
|
+
def path_to_version_file(path)
|
42
|
+
"lib/#{path}/version.rb"
|
43
|
+
end
|
44
|
+
|
37
45
|
def require_version
|
38
46
|
silence { require(filename) }
|
39
47
|
end
|
@@ -8,7 +8,7 @@ class Gem::Commands::BootstrapCommand < Gem::Command
|
|
8
8
|
DEFAULTS = {
|
9
9
|
:gemspec => true,
|
10
10
|
:strategy => 'git',
|
11
|
-
:scaffold =>
|
11
|
+
:scaffold => true,
|
12
12
|
:github => false,
|
13
13
|
:quiet => false
|
14
14
|
}
|
@@ -19,8 +19,8 @@ class Gem::Commands::BootstrapCommand < Gem::Command
|
|
19
19
|
super 'bootstrap', 'Bootstrap a new gem source repository', DEFAULTS.merge(options)
|
20
20
|
|
21
21
|
option :gemspec, '-g', 'Generate a .gemspec'
|
22
|
-
option :strategy, '-f', 'Strategy for collecting files [glob|git] in .gemspec'
|
23
22
|
option :scaffold, '-s', 'Scaffold lib/[gem_name]/version.rb README test/'
|
23
|
+
option :strategy, '-f', 'Strategy for collecting files [glob|git] in .gemspec'
|
24
24
|
option :github, '-h', 'Bootstrap a git repo, create on github and push'
|
25
25
|
option :quiet, '-q', 'Do not output status messages'
|
26
26
|
|
@@ -32,6 +32,7 @@ class Gem::Commands::BootstrapCommand < Gem::Command
|
|
32
32
|
in_bootstrapped_dir do
|
33
33
|
write_scaffold if options[:scaffold]
|
34
34
|
write_gemspec if options[:gemspec]
|
35
|
+
init_git if options[:github] || options[:args] # safe to 'git init' in new dir
|
35
36
|
create_repo if options[:github]
|
36
37
|
end
|
37
38
|
end
|
@@ -64,13 +65,15 @@ class Gem::Commands::BootstrapCommand < Gem::Command
|
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
68
|
+
def init_git
|
69
|
+
say 'Initializing git repository'
|
70
|
+
`git init`
|
71
|
+
end
|
72
|
+
|
67
73
|
def create_repo
|
68
74
|
options = { :login => github_user, :token => github_token, :name => gem_name }
|
69
75
|
options = options.map { |name, value| "-F '#{name}=#{value}'" }.join(' ')
|
70
76
|
|
71
|
-
say 'Bootstrapializing git repository'
|
72
|
-
`git init`
|
73
|
-
|
74
77
|
say 'Staging files'
|
75
78
|
`git add .`
|
76
79
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.24
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sven Fuchs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-29 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|