gem-release 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gem_release/gemspec.rb +1 -2
- data/lib/gem_release/helpers.rb +11 -7
- data/lib/gem_release/template.rb +5 -2
- data/lib/gem_release/version.rb +1 -1
- metadata +2 -2
data/lib/gem_release/gemspec.rb
CHANGED
@@ -7,8 +7,7 @@ module GemRelease
|
|
7
7
|
|
8
8
|
@authors ||= [`git config --get user.name`.strip]
|
9
9
|
@email ||= `git config --get user.email`.strip
|
10
|
-
@
|
11
|
-
@homepage ||= "http://github.com/#{@github_user}/#{name}" || "[your github name]"
|
10
|
+
@homepage ||= "http://github.com/#{github_user}/#{name}" || "[your github name]"
|
12
11
|
|
13
12
|
@summary ||= '[summary]'
|
14
13
|
@description ||= '[description]'
|
data/lib/gem_release/helpers.rb
CHANGED
@@ -5,25 +5,29 @@ module GemRelease
|
|
5
5
|
def github_user
|
6
6
|
@github_user ||= `git config --get github.user`.strip
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def github_token
|
10
10
|
@github_token ||= `git config --get github.token`.strip
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def gem_name
|
14
|
-
@gem_name ||= gemspec ? gemspec.name :
|
14
|
+
@gem_name ||= gemspec ? gemspec.name : gem_name_from_directory
|
15
|
+
end
|
16
|
+
|
17
|
+
def gem_name_from_directory
|
18
|
+
File.basename(Dir.pwd)
|
15
19
|
end
|
16
|
-
|
20
|
+
|
17
21
|
def gem_filename
|
18
22
|
gemspec.file_name
|
19
23
|
end
|
20
|
-
|
24
|
+
|
21
25
|
def gem_version
|
22
26
|
gemspec.version.to_s
|
23
27
|
end
|
24
|
-
|
28
|
+
|
25
29
|
def gemspec
|
26
|
-
@gemspec ||=
|
30
|
+
@gemspec ||= Gem::Specification.load(gemspec_filename) # silence { }
|
27
31
|
rescue LoadError, RuntimeError
|
28
32
|
nil
|
29
33
|
end
|
data/lib/gem_release/template.rb
CHANGED
@@ -4,12 +4,15 @@ require 'core_ext/string/camelize'
|
|
4
4
|
|
5
5
|
module GemRelease
|
6
6
|
class Template
|
7
|
-
|
7
|
+
include GemRelease::Helpers
|
8
|
+
|
9
|
+
attr_reader :name, :module_name, :module_path, :options
|
8
10
|
|
9
11
|
def initialize(options = {})
|
12
|
+
@options = options
|
10
13
|
options.each { |key, value| instance_variable_set(:"@#{key}", value) }
|
11
14
|
|
12
|
-
@name ||=
|
15
|
+
@name ||= gem_name_from_directory
|
13
16
|
@module_path ||= name.gsub('-', '_')
|
14
17
|
@module_name ||= module_path.camelize
|
15
18
|
end
|
data/lib/gem_release/version.rb
CHANGED