gemstub 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ app_rake_file:
10
10
  app_readme_file:
11
11
  type: file
12
12
  template_path: <%= File.join(templates_directory_path, "README.template") %>
13
- output_path: <%= File.join(app, "README") %>
13
+ output_path: <%= File.join(app, "README.textile") %>
14
14
 
15
15
  app_license_file:
16
16
  type: file
data/lib/gemstub.rb CHANGED
@@ -74,13 +74,13 @@ module Gemstub
74
74
  end
75
75
 
76
76
  desc 'regenerate the gemspec'
77
- task :gemspec do
77
+ task :gemspec => [:readme] do
78
78
  @gem_spec.version = "#{@gem_spec.version}.#{Time.now.strftime('%Y%m%d%H%M%S')}"
79
79
  File.open(File.join("#{@gem_spec.name}.gemspec"), 'w') {|f| f.puts @gem_spec.to_ruby}
80
80
  end
81
81
 
82
82
  desc "Install the gem"
83
- task :install => [:package] do |t|
83
+ task :install => [:readme, :package] do |t|
84
84
  sudo = ENV['SUDOLESS'] == 'true' || RUBY_PLATFORM =~ /win32|cygwin/ ? '' : 'sudo'
85
85
  puts `#{sudo} gem install #{File.join("pkg", @gem_spec.name)}-#{@gem_spec.version}.gem --no-update-sources --no-ri --no-rdoc`
86
86
  end
@@ -117,6 +117,35 @@ module Gemstub
117
117
  end
118
118
  end
119
119
  end
120
+
121
+ task :readme do
122
+ txt = File.read(File.join(FileUtils.pwd, 'README.textile'))
123
+ plain = File.join(FileUtils.pwd, 'README')
124
+
125
+ # txt.gsub!(/[\s](@\S+@)[\s]/, "<tt>#{$1}</tt>")
126
+ txt.scan(/[\s]@(\S+)@[\s|\.]/).flatten.each do |word|
127
+ puts "replacing: @#{word}@ w/ <tt>#{word}</tt>"
128
+ txt.gsub!("@#{word}@", "<tt>#{word}</tt>")
129
+ end
130
+
131
+ ['h1', 'h2', 'h3'].each_with_index do |h, i|
132
+ txt.scan(/(#{h}.\s)/).flatten.each do |word|
133
+ eq = '=' * (i + 1)
134
+ puts "replacing: '#{word}' w/ #{eq}"
135
+ txt.gsub!(word, eq)
136
+ end
137
+ end
138
+
139
+ ['<pre><code>', '</code></pre>'].each do |h|
140
+ txt.scan(/(#{h}.*$)/).flatten.each do |word|
141
+ puts "replacing: '#{word}' with nothing"
142
+ txt.gsub!(word, '')
143
+ end
144
+ end
145
+
146
+ txt.gsub!("\n\n\n", "\n\n")
147
+ File.open(plain, 'w') {|f| f.write txt}
148
+ end
120
149
 
121
150
  end # gem_spec
122
151
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemstub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Bates