Runapk 3.0.1 → 3.1.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 +4 -4
  2. data/lib/runapk/version.rb +1 -1
  3. data/lib/runapk.rb +82 -8
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 960472bcf63450cd4b0a29c51862913dd779dc62fdf5b6182b69a42c377c73c4
4
- data.tar.gz: b81749e854a84b04e4c2db92aa9128f3486b02f218150b5389895eb5a7ad95e5
3
+ metadata.gz: 95bad2353b047840d5b36ad12c33cb7ff28a5726f0bfe914884d672c6903e39e
4
+ data.tar.gz: 4761e5d65c4536f6cc08976effb0e65396511a6bec5252ec17e1c3a788092760
5
5
  SHA512:
6
- metadata.gz: 455903a473bd3b0fb2831cc9617c74ac674aee83b2c85daecca30da02c4db6a7305d92e2cf47048294bca1331ba988a2ad464bb867bf99cda46ffc933675ca38
7
- data.tar.gz: e2f2b8dd279e4e72973f45514fb6e3192827b6dc2a1033de80eb9b7fd8dadddd0a37e34642a5cc7256e4344025ad16100fea99f77ad505089726520e5a086e7c
6
+ metadata.gz: ff200e772bd076fd8ddfbc16cab482530c27b6f4a977f70034b7a261a813ecc3574c6a48a2f67ba78d419b95527340d7c89e3e7e1fb2d18181c41bdf5f83b008
7
+ data.tar.gz: '06368a50ffe2c784c907ff68f92c8f1469967af022cd2cd9b67e156bf6318e316a01b2e195b0bc8b7f77833c5f02b077fdbe76a02f5fa23b7986f6efac1be761'
@@ -1,3 +1,3 @@
1
1
  module Runapk
2
- VERSION = "3.0.1"
2
+ VERSION = "3.1.0"
3
3
  end
data/lib/runapk.rb CHANGED
@@ -53,13 +53,14 @@ def compiler(doc, mode)
53
53
 
54
54
  path = prompt.ask("Localização do apk:")
55
55
 
56
- phrase 'Agora informe a localização da sua keystore'.white
57
-
58
- keystore_path = prompt.ask("Localização da keystore:")
59
-
60
- phrase "Iniciando processo de assinatura do apk"
56
+ case mode
57
+ when 'prod'
58
+ phrase 'Agora informe a localização da sua keystore'.white
59
+ keystore_path = prompt.ask("Localização da keystore:")
61
60
 
62
- cmd("(jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore #{keystore_path} #{path} alias_name)")
61
+ phrase "Iniciando processo de assinatura do apk"
62
+ cmd("(jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore #{keystore_path} #{path} alias_name)")
63
+ end
63
64
 
64
65
  phrase "Comprimindo app"
65
66
 
@@ -71,6 +72,60 @@ def compiler(doc, mode)
71
72
  phrase_simple "Obrigado por utilizar o RunApk!".green
72
73
  end
73
74
 
75
+ def compiler_en(doc, mode)
76
+
77
+ name = doc.at_css("name").content
78
+ version = doc.at_css("widget").attribute('version')
79
+ phrase_simple 'App name: ' + name.blue
80
+ phrase_simple 'App version: ' + version
81
+ phrase_simple ""
82
+ app_name_export = name + '-' + version
83
+ app_name_export = app_name_export.gsub!(/\s/, '')
84
+ end_app_phrase = "Your apk will be called: ".white + "#{app_name_export}.apk".blue
85
+ phrase_simple end_app_phrase
86
+
87
+ case mode
88
+ when 'dev'
89
+ params = ''
90
+ prod = false
91
+ when 'prod'
92
+ params = '--prod --release'
93
+ prod = true
94
+ end
95
+
96
+ phrase 'Starting the build process'
97
+
98
+ cmd("(ionic cordova build android #{params})")
99
+
100
+ phrase 'Your apk has been build, however to continue you need to inform the apk directory, it is above, just copy it and paste it below'.white
101
+
102
+ phrase_simple 'It looks like this: Built the following apk (s): /Users/apk/path/apk.apk, copy that line and paste it below'.green
103
+ phrase_simple ""
104
+
105
+ prompt = TTY::Prompt.new
106
+
107
+ path = prompt.ask("Apk location:")
108
+
109
+ case mode
110
+ when 'prod'
111
+ phrase 'Now enter the location of your keystore'.white
112
+ keystore_path = prompt.ask("Keystore location:")
113
+
114
+ phrase "Starting the apk signing process"
115
+ cmd("(jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore #{keystore_path} #{path} alias_name)")
116
+ end
117
+
118
+ phrase "Compressing app"
119
+
120
+ cmd("(zipalign -v 4 #{path} #{app_name_export}.apk)")
121
+ phrase_simple ""
122
+ phrase_simple "Your app is ready!"
123
+ phrase_simple "Just browse the root folder of your ionic project"
124
+ phrase_simple ""
125
+ phrase_simple "Thanks for using RunApk!".green
126
+ end
127
+
128
+
74
129
  def setup()
75
130
  case ARGV[0]
76
131
  when 'skip'
@@ -94,7 +149,7 @@ def setup()
94
149
  phrase_simple ""
95
150
  phrase_simple '👩‍🚀 Brr Dr, ei onde está o meu comp... 👩‍🚀'.white
96
151
  phrase_simple ""
97
- platform = prompt.select("👩‍🚀 Para qual plataform você deseja exportar?", %w(Android iOS))
152
+ platform = prompt.select("👩‍🚀 Para qual plataform você deseja exportar?", %w(Android))
98
153
  phrase_simple ""
99
154
  type = prompt.select("👩‍🚀 Que tipo de apk você deseja?", ['Desenvolvimento (Build rápida, recomendado para testes locais)', 'Produção (Inclui todas as otimizações necessárias para exportar o app para a Play Store ou Apple Store) Se for para android, você vai precisar de uma keystore: https://runapk.page.link/keystore'])
100
155
  phrase_simple ""
@@ -104,13 +159,32 @@ def setup()
104
159
  when 'É claro'
105
160
  @doc = Nokogiri::XML(File.open("config.xml"))
106
161
  case type
107
- when 'Development'
162
+ when 'Desenvolvimento (Build rápida, recomendado para testes locais)'
108
163
  compiler @doc, 'dev'
109
164
  else
110
165
  compiler @doc, 'prod'
111
166
  end
112
167
  end
113
168
  else
169
+ phrase_simple ""
170
+ phrase_simple '👩‍🚀 Brr Dr, where is my comp... 👩‍🚀'.white
171
+ phrase_simple ""
172
+ platform = prompt.select("👩‍🚀 For which plataform you want to export?", %w(Android))
173
+ phrase_simple ""
174
+ type = prompt.select("👩‍🚀 What kind of apk do you want?", ["Development (Fast build, recommended for local testing)", "Production (Includes all the optimizations needed to export the app to the Play Store or Apple Store) If it's for android, you'll need a keystore: https://runapk.page.link/keystore"])
175
+ phrase_simple ""
176
+ load_config = prompt.select("👩‍🚀 I don't know the name and version of your app, do you want me to load them from your configuration file? It's the config.xml file by the way ...", ['Sure'])
177
+ phrase_simple ""
178
+ case load_config
179
+ when 'Sure'
180
+ @doc = Nokogiri::XML(File.open("config.xml"))
181
+ case type
182
+ when 'Development (Fast build, recommended for local testing)'
183
+ compiler_en @doc, 'dev'
184
+ else
185
+ compiler_en @doc, 'prod'
186
+ end
187
+ end
114
188
  end
115
189
  end
116
190
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Runapk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GabrielLacerda