texst 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/texst +2 -0
  3. data/lib/texst.rb +262 -0
  4. metadata +46 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ce06e044ecb7e6c9e3ff785635daf3e14bae327f
4
+ data.tar.gz: 06702a9a033333d7dfa03d3da4a2b71f92173011
5
+ SHA512:
6
+ metadata.gz: cb780d507dba2a837cc1aa255cacd8fdab208a810ca765b6ef0ce1e27f49925516f448ae4eb820b4d438425120eac3924c6e3c9292b730fa445ba55af8c9ffce
7
+ data.tar.gz: c2ccf23e4b4f6489eff16683911d8d4e4159244b320bb397f63dc521a58045fa4f77fcd8281cb26f11800512d80c58f3577e96ecb270c2668af31f82fb0af338
@@ -0,0 +1,2 @@
1
+ require 'texst'
2
+ puts Texst::Format::Program.start(ARGV[0])
@@ -0,0 +1,262 @@
1
+ module Texst
2
+ module Available
3
+ class Parameter
4
+ # To Wellcome For Users
5
+ def self.input
6
+ puts "+---------------------------------------------------------+"
7
+ puts "|\t| Hello Wellcome To Programing File Creator|\t |"
8
+ puts "+---------------------------------------------------------+"
9
+ end
10
+
11
+ end
12
+ end
13
+ module Format
14
+ class Program
15
+ # For Create Folder For Langs
16
+ def self.folder
17
+ filer = Dir.pwd
18
+ Dir.mkdir("#{filer}/texst")
19
+ folders = ["c", "lisp", "c++", "java", "cobol",
20
+ "cs", "d", "exilir", "haskell", "erlang", "clujure",
21
+ "matlab", "pascal", "r", "scala", "swift",
22
+ "python", "php", "perl", "lua", "ruby"]
23
+ folders.each do |fld|
24
+ path = Dir.pwd
25
+ Dir.mkdir("#{path}/texst/#{fld}") unless File.exists?("#{path}/texst/#{fld}")
26
+ end
27
+ end
28
+ # For Begin Get Type And Lang If Was Right First Time
29
+ def self.init
30
+ folder
31
+ @type_arr = ["functional", "oop"]
32
+ print "Enter Your Type [functional] or [oop] : "
33
+ $type = gets.chomp
34
+ if $type == "functional"
35
+ print "Enter Your Lang [ c | haskell | erlang | clojure ] : "
36
+ elsif $type == "oop"
37
+ print "Enter Your Lang [c++ | java | python | ruby | php | prel | elixir | lisp | d | r | swift | scala | lua | pascal | matlab | cobol | cs |]: "
38
+ else
39
+ while !@type_arr.include?($type)
40
+ print "Plese Enter Right Charachter [functional] or [oop]:"
41
+ $type = gets.chomp
42
+ end
43
+ erase
44
+ end
45
+ $lang = gets.chomp
46
+ @lang_arr = ["c++", "java", "python", "ruby", "php", "perl", "elixir",
47
+ "lisp", "d", "r", "swift", "scala", "lua",
48
+ "pascal", "matlab", "cobol", "cs"]
49
+ @lang_arr_f = ["c", "haskell", "erlang", "clojure"]
50
+ lang_check
51
+ end
52
+ # This Function For Print Details Before Get Right Type
53
+ def self.erase
54
+ if $type == "functional"
55
+ print "Enter Your Lang [ c | haskell | erlang | clojure ] : "
56
+ elsif $type == "oop"
57
+ print "Enter Your Lang [c++ | java | python | ruby | php | prel | elixir | lisp | d | r | swift | scala | lua | pascal | matlab | cobol | cs |]: "
58
+ end
59
+ end
60
+ # This Function Check For Input Right Lang For Type
61
+ def self.lang_check
62
+ if $type == "functional"
63
+ case $lang
64
+ when "c"
65
+ when "lisp"
66
+ else
67
+ while !@lang_arr_f.include?($lang)
68
+ print "Plese Enter Right Lang :"
69
+ $lang = gets.chomp
70
+ end
71
+ end
72
+ elsif $type == "oop"
73
+ case $lang
74
+ when "c++"
75
+ when "java"
76
+ else
77
+ while !@lang_arr.include?($lang)
78
+ print "Plese Enter Right Lang :"
79
+ $lang = gets.chomp
80
+ end
81
+ end
82
+ end
83
+ end
84
+ # This Function For Get Inputs
85
+ def initialize(lang, type)
86
+ @type = type
87
+ @filename = "texst/#{$lang}/"
88
+ if lang == "functional"
89
+ @lang = lang
90
+
91
+ functional
92
+ elsif lang == "oop"
93
+ @lang = lang
94
+
95
+ oop
96
+ end
97
+ end
98
+ # Make Priject Dir
99
+ def project_dir
100
+ print "Enter Project Name : "
101
+ @project_name = gets.chomp
102
+ make = Dir.pwd
103
+ if File.exists?("#{make}/texst/#{$lang}/#{@project_name}")
104
+ print "Project Exist Do You Want To Merge?[y/n] : "
105
+ answer = gets.chomp
106
+ if answer == "y"
107
+ Dir.mkdir("#{make}/texst/#{$lang}/#{@project_name}") unless File.exists?("#{make}/texst/#{$lang}/#{@project_name}")
108
+ @filename += @project_name + "/"
109
+ print "Enter Main Filename :"
110
+ elsif answer == "n"
111
+ project_dir
112
+ else
113
+ project_dir
114
+ end
115
+ else
116
+ Dir.mkdir("#{make}/texst/#{$lang}/#{@project_name}") unless File.exists?("#{make}/texst/#{$lang}/#{@project_name}")
117
+ @filename += @project_name + "/"
118
+ print "Enter Main Filename :"
119
+ end
120
+
121
+ end
122
+ # This Function For Create File And Open And Exit From Editor
123
+ def run_func
124
+ project_dir
125
+ @filename += gets.chomp + @run_exep
126
+ text = File.open(@filename, "w+")
127
+ puts "Write [quit] Or [exit] And Enter To Exit Editor"
128
+ puts "Plese Enter #{@run_lang} Code"
129
+ i = 1
130
+ @code = ""
131
+ loop do
132
+ print i, " -> "
133
+ #plain
134
+
135
+ @code = gets.chomp + "\n"
136
+ if @code == "quit\n" || @code == "exit\n"
137
+ puts "GoodBye"
138
+ exit
139
+ end
140
+
141
+ # Hard way
142
+
143
+ # @code = gets.chomp + "\n"
144
+ # if @code.chomp.eql? "quit"
145
+ # puts "GoodBye"
146
+ # exit
147
+ # end
148
+
149
+ i += 1
150
+ text.syswrite(@code)
151
+ end
152
+ end
153
+ # This Function Is For Indicate Functional Langs
154
+ def functional
155
+ case @type
156
+ when "c"
157
+ @run_exep = ".c"
158
+ @run_lang = "C"
159
+ run_func
160
+ when "haskell"
161
+ @run_exep = ".hs"
162
+ @run_lang = "Haskell"
163
+ run_func
164
+ when "erlang"
165
+ @run_exep = ".erl"
166
+ @run_lang = "Erlang"
167
+ run_func
168
+ when "clojure"
169
+ @run_exep = ".clj"
170
+ @run_lang = "Clojure"
171
+ run_func
172
+ end
173
+ end
174
+ # This Function Is For Indicate Objective Langs
175
+ def oop
176
+ case @type
177
+ when "c++"
178
+ @run_exep = ".cpp"
179
+ @run_lang = "c++"
180
+ run_func
181
+
182
+ when "java"
183
+ @run_exep = ".java"
184
+ @run_lang = "java"
185
+ run_func
186
+ when "cs"
187
+ @run_exep = ".cs"
188
+ @run_lang = "cs"
189
+ run_func
190
+ when "cobol"
191
+ @run_exep = ".cobol"
192
+ @run_lang = "Cobol"
193
+ run_func
194
+ when "pascal"
195
+ @run_exep = ".pas"
196
+ @run_lang = "Pascal"
197
+ run_func
198
+ when "swift"
199
+ @run_exep = ".swift"
200
+ @run_lang = "Swift"
201
+ run_func
202
+ when "python"
203
+ @run_exep = ".py"
204
+ @run_lang = "Python"
205
+ run_func
206
+ when "php"
207
+ @run_exep = ".php"
208
+ @run_lang = "PHP"
209
+ run_func
210
+ when "ruby"
211
+ @run_exep = ".rb"
212
+ @run_lang = "Ruby"
213
+ run_func
214
+ when "scala"
215
+ @run_exep = ".scala"
216
+ @run_lang = "Scala"
217
+ run_func
218
+ when "r"
219
+ @run_exep = ".r"
220
+ @run_lang = "R"
221
+ run_func
222
+ when "lisp"
223
+ @run_exep = ".lisp"
224
+ @run_lang = "Lisp"
225
+ run_func
226
+ when "d"
227
+ @run_exep = ".d"
228
+ @run_lang = "D"
229
+ run_func
230
+ when "elixir"
231
+ @run_exep = ".ex"
232
+ @run_lang = "Elixir"
233
+ when "perl"
234
+ @run_exep = ".pl"
235
+ @run_lang = "Perl"
236
+ run_func
237
+ when "lua"
238
+ @run_exep = ".lua"
239
+ @run_lang = "Lua"
240
+ run_func
241
+ when "matlab"
242
+ @run_exep = ".m"
243
+ @run_lang = "Matlab"
244
+ run_func
245
+ end
246
+ end
247
+ # This Class For Start program
248
+ class << self
249
+ def start
250
+ Texst::Available::Parameter.input
251
+ Texst::Format::Program.init
252
+ if $type and $lang
253
+ Texst::Format::Program.new($type, $lang)
254
+ end
255
+ end
256
+ end
257
+
258
+ end
259
+ end
260
+ end
261
+ # To Start This Program Write This Line
262
+ Texst::Format::Program.start
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: texst
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Amin Abbasiy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: You Can Create Vairiuos Programing Language Projects
14
+ email: rubyprogrameramin@gmail.com
15
+ executables:
16
+ - texst
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/texst
21
+ - lib/texst.rb
22
+ homepage: https://github.com/amin-abbasiy/texst
23
+ licenses:
24
+ - GPL
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.6.12
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Texst Is a Tool For Manage Create Projects
46
+ test_files: []