aipim-rails 0.0.23 → 0.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/aipim +32 -8
- data/lib/aipim-rails/convert_to_html.rb +3 -2
- data/lib/aipim-rails/parser.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d25188c189a2fe95c0981e899ba2a959c976f3d3
|
4
|
+
data.tar.gz: 9c034938385d82d7c46e12af5f0b6ff94ef38ac7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83dcf3f78ac4116979132242670e4ca07b4f459a8b987197e65195bd7450f91730b7ed70ad7d78d4d94d97f547bd8908717423e0f1b6a481c96c29301cb091b9
|
7
|
+
data.tar.gz: f9c478b5ea787c71066f430556a76afa3f01d8525775e8ff8171dbef68c216695b77633624574d63fab18ad47aed6eec5c3a698298af705ae93967778f683c56
|
data/bin/aipim
CHANGED
@@ -8,13 +8,37 @@ if ARGV[0] == 'generate'
|
|
8
8
|
system('mkdir -p aipim')
|
9
9
|
system('mkdir -p aipim/screenshots')
|
10
10
|
system('cp '+path+'lib/screenshot.rb features/support/')
|
11
|
-
|
12
|
-
system('cp '+path+'lib/bootstrap.min.css public/aipim/')
|
13
|
-
system('cp '+path+'lib/jquery-1.9.1.js public/aipim/')
|
11
|
+
|
14
12
|
elsif ARGV[0] == 'html'
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
%x[rm -rf aipim/markdown]
|
14
|
+
files = []
|
15
|
+
ARGV.delete_at(0)
|
16
|
+
ARGV.each do |arg|
|
17
|
+
ls = %x[ls #{arg}].split("\n")
|
18
|
+
ls.each do |f|
|
19
|
+
f = f.split('/')
|
20
|
+
f.delete_at(0)
|
21
|
+
f = f.join('/')
|
22
|
+
files << f if !(f =~ /.feature\z/).nil?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
files.each { |f| Parser.init(f) }
|
26
|
+
files.each { |f| ConvertToHtml.init(f) }
|
27
|
+
system('cp '+path+'lib/bootstrap.min.css aipim/html')
|
28
|
+
system('cp '+path+'lib/jquery-1.9.1.js aipim/html')
|
29
|
+
|
30
|
+
elsif ARGV[0] == 'markdown' || ARGV[0] == 'md'
|
31
|
+
%x[rm -rf aipim/markdown]
|
32
|
+
files = []
|
33
|
+
ARGV.delete_at(0)
|
34
|
+
ARGV.each do |arg|
|
35
|
+
ls = %x[ls #{arg}].split("\n")
|
36
|
+
ls.each do |f|
|
37
|
+
f = f.split('/')
|
38
|
+
f.delete_at(0)
|
39
|
+
f = f.join('/')
|
40
|
+
files << f if !(f =~ /.feature\z/).nil?
|
41
|
+
end
|
42
|
+
end
|
43
|
+
files.each { |f| Parser.init(f) }
|
20
44
|
end
|
@@ -4,11 +4,12 @@ module ConvertToHtml
|
|
4
4
|
|
5
5
|
def self.md_to_html(filename)
|
6
6
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
|
7
|
-
markdown.render(File.read(filename))
|
7
|
+
markdown.render(File.read("aipim/markdown/"+filename+".md"))
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.init(filename)
|
11
|
-
|
11
|
+
system("mkdir -p aipim/html")
|
12
|
+
output = File.open("aipim/html/"+filename+".html", "w")
|
12
13
|
output.puts '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
|
13
14
|
output.puts '<html>'
|
14
15
|
output.puts ' <head>'
|
data/lib/aipim-rails/parser.rb
CHANGED
@@ -15,8 +15,9 @@ module Parser
|
|
15
15
|
|
16
16
|
def self.read_links(filename)
|
17
17
|
cenario_counter = 1
|
18
|
-
|
19
|
-
|
18
|
+
system("mkdir -p aipim/markdown")
|
19
|
+
output = File.new("aipim/markdown/#{filename}.md", "w")
|
20
|
+
file = File.new("features/#{filename}", "r")
|
20
21
|
while(line = read_line(file))
|
21
22
|
if ParserHelper.is_cenario?(line)
|
22
23
|
output.puts "[#{cenario_counter}. #{ParserHelper.get_cenario(line)}](#) "
|
@@ -29,12 +30,12 @@ module Parser
|
|
29
30
|
|
30
31
|
def self.read_content(filename)
|
31
32
|
|
32
|
-
file = File.new(filename, "r")
|
33
|
-
output = File.new("aipim/markdown.md", "a")
|
33
|
+
file = File.new("features/#{filename}", "r")
|
34
|
+
output = File.new("aipim/markdown/#{filename}.md", "a")
|
34
35
|
|
35
36
|
screenshot = false
|
36
37
|
cenario_counter = 1
|
37
|
-
result = %x[ls aipim/screenshots
|
38
|
+
result = %x[ls aipim/screenshots/#{filename}].split("\n")
|
38
39
|
counter_screenshot = 0
|
39
40
|
|
40
41
|
output.puts ""
|
@@ -62,7 +63,7 @@ module Parser
|
|
62
63
|
end
|
63
64
|
end
|
64
65
|
if screenshot
|
65
|
-
output.puts '> [![Alt text](screenshots/'+result[counter_screenshot].to_s+')](screenshots/'+result[counter_screenshot].to_s+') '
|
66
|
+
output.puts '> [![Alt text](../screenshots/'+filename+'/'+result[counter_screenshot].to_s+')](../screenshots/'+filename+'/'+result[counter_screenshot].to_s+') '
|
66
67
|
counter_screenshot = counter_screenshot+1
|
67
68
|
screenshot = false
|
68
69
|
end
|