pario 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pario.rb +0 -1
- data/lib/pario/cli.rb +17 -7
- data/lib/pario/version.rb +1 -1
- metadata +3 -4
- data/lib/pario/inflector.rb +0 -16
data/lib/pario.rb
CHANGED
data/lib/pario/cli.rb
CHANGED
@@ -54,6 +54,14 @@ module Pario
|
|
54
54
|
def game_name
|
55
55
|
@game_name ||= @arguments.delete_at(0)
|
56
56
|
end
|
57
|
+
|
58
|
+
def game_name_camelcase
|
59
|
+
game_name.gsub(/(.)([A-Z])/,'\1_\2').downcase
|
60
|
+
end
|
61
|
+
|
62
|
+
def game_name_capitalize
|
63
|
+
game_name.to_s.gsub(/\b\w/){$&.upcase}
|
64
|
+
end
|
57
65
|
|
58
66
|
def create_base_files
|
59
67
|
build_main
|
@@ -63,7 +71,8 @@ module Pario
|
|
63
71
|
end
|
64
72
|
|
65
73
|
def build_game_class
|
66
|
-
|
74
|
+
Dir.chdir('game')
|
75
|
+
game_file = File.open("#{game_name_camelcase}.rb", "w+")
|
67
76
|
game_file.puts game_class
|
68
77
|
end
|
69
78
|
|
@@ -76,14 +85,14 @@ module Pario
|
|
76
85
|
def build_extra_classes
|
77
86
|
Dir.chdir("game") unless Dir.getwd.split("/").last == "game"
|
78
87
|
@arguments.each do |new_class|
|
79
|
-
class_file = File.open("#{new_class.
|
88
|
+
class_file = File.open("#{new_class.gsub(/(.)([A-Z])/,'\1_\2').downcase}.rb", "w+")
|
80
89
|
class_file.puts class_template(new_class)
|
81
90
|
end
|
82
91
|
end
|
83
92
|
|
84
93
|
def class_template(name)
|
85
94
|
template = ERB.new <<-EOF
|
86
|
-
class #{name.
|
95
|
+
class #{name.to_s.gsub(/\b\w/){$&.upcase}}
|
87
96
|
def initialize
|
88
97
|
end
|
89
98
|
end
|
@@ -99,7 +108,7 @@ require 'gosu'
|
|
99
108
|
Dir.glob(File.join("game", "*.rb")).each {|file| require file }
|
100
109
|
|
101
110
|
|
102
|
-
game = #{
|
111
|
+
game = #{game_name_capitalize}.new(800, 600)
|
103
112
|
game.show
|
104
113
|
EOF
|
105
114
|
main_template.result(binding)
|
@@ -107,7 +116,7 @@ main_template.result(binding)
|
|
107
116
|
|
108
117
|
def game_class
|
109
118
|
game_template = ERB.new <<-EOF
|
110
|
-
class #{
|
119
|
+
class #{game_name_capitalize} < Gosu::Window
|
111
120
|
def initialize(window_width, window_height)
|
112
121
|
super(window_width,window_height,0)
|
113
122
|
end
|
@@ -127,8 +136,9 @@ game_template.result(binding)
|
|
127
136
|
end
|
128
137
|
|
129
138
|
def create_directories
|
130
|
-
|
131
|
-
Dir.
|
139
|
+
folder_name = game_name.gsub(/(.)([A-Z])/,'\1_\2').downcase!
|
140
|
+
Dir.mkdir(folder_name) unless File.directory?(folder_name)
|
141
|
+
Dir.chdir(folder_name)
|
132
142
|
Directories.each do |sub_folder|
|
133
143
|
Dir.mkdir sub_folder unless File.directory?(sub_folder)
|
134
144
|
end
|
data/lib/pario/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pario
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bill Davenport
|
@@ -53,7 +53,6 @@ files:
|
|
53
53
|
- lib/docs/README
|
54
54
|
- lib/pario.rb
|
55
55
|
- lib/pario/cli.rb
|
56
|
-
- lib/pario/inflector.rb
|
57
56
|
- lib/pario/media/pario_background.png
|
58
57
|
- lib/pario/version.rb
|
59
58
|
- lib/util.rb
|
data/lib/pario/inflector.rb
DELETED