Runapk 2.0.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb40bc237d0548ac1f6de538b6086235a18b3d146fd30e6a5ac0fcfab08e49d5
4
- data.tar.gz: 3561ed54bb3b229b187e2be5441e4bc8c8d7995caa741af2c2cbf384bd76165c
3
+ metadata.gz: e7aa028d7ee9882b6d6e49f107726e56539fdd61f708df3c51dafd949fd4351b
4
+ data.tar.gz: e5257f1fe102594db0ea5fe9bc145526d7aea9fa2f79b49f7173a9aaa836f73a
5
5
  SHA512:
6
- metadata.gz: a785fad0bf9a894b0a9074663193bfe6445df292ae7f5fae7e793aef796ae34620935d3f25e8dc62d0dafe218ad1b726ae03fe9cf359c0d9c45ba526778240cb
7
- data.tar.gz: 4067debecc97fe8c7c6fd31b5ac03e253519afd3bc1d4daabbcad272b6563d6547a2ee3ce312223a467c727b853a26f0c02e07f861a99b4d0b5d478930c16fa2
6
+ metadata.gz: 16ebba3c1ad220bf936eb2afca8e6e44c15f6d492a4994ea1e2b0f02c54293228eabba57118724ab7cb005ace4c5a64bd6322a1af887166ebff0898d0b57021c
7
+ data.tar.gz: 1dbe11539c1a3d4e9a765c2283546db04c10185d36172299963656226f3593046ed900f04f4a64c29dec7ec16af6ca0cabb70e24607400b3722c3f7acb9daee6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Runapk (1.0.0)
4
+ Runapk (2.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -20,9 +20,9 @@ Then you can call in your terminal:
20
20
 
21
21
  ## Dependencies
22
22
 
23
+ - Ruby
23
24
  - Jarsigner (Install java sdk, add it to your path and you be fine)
24
- - Zipalign (Install android sdk, add it build tools folder to your path and you be fine)
25
- - Keystore
25
+ - Zipalign (Install android sdk, add a build tools version folder to your path and you be fine)
26
26
 
27
27
  ## Usage
28
28
 
data/bin/console CHANGED
@@ -10,5 +10,5 @@ require "runapk"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
14
- IRB.start(__FILE__)
13
+ # require "irb"
14
+ # IRB.start(__FILE__)
data/lib/runapk.rb CHANGED
@@ -9,125 +9,112 @@ def cmd(cmd)
9
9
  end
10
10
  end
11
11
 
12
- def prod(p)
13
-
12
+ def phrase(phrase)
14
13
  puts
15
- puts 'Working on apk\'s'
14
+ puts phrase
16
15
  puts
16
+ end
17
17
 
18
- config = YAML.load_file("#{p}")
19
-
20
- app_name = config['app']['name']
21
- app_version = config['app']['name']
22
- android_version = config['app']['name']
23
- cert_path = config['sign']['path']
24
- ionic_version = config['ionic']['version']
25
- output_path = config['output']['path']
26
-
27
- puts 'Ensuring that the platform is added ...'.green
28
-
29
- cmd("ionic cordova platform add android")
30
-
31
- puts 'Exporting apk...'.green
32
-
33
- cmd("ionic cordova build android --prod --release")
34
-
35
- puts 'Signing apk, enter the password of your certificate'.green
36
-
37
- cmd("jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore #{cert_path} platforms/android/build/outputs/apk/android-release-unsigned.apk alias_name")
38
-
39
- puts 'Compressing apk'.green
40
-
41
- cmd("zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk platforms/android/build/outputs/apk/#{app_name}#{app_version}.apk")
42
-
43
- puts 'Moving apk'.green
44
-
45
- cmd("mv platforms/android/build/outputs/apk/#{app_name}#{app_version}.apk ~/#{output_path}")
46
-
47
- puts
48
- puts "Thanks for using RunApk!".blue
49
- puts
18
+ def phrase_simple(phrase)
19
+ puts phrase
50
20
  end
51
21
 
52
- def dev(p)
53
-
54
- puts
55
- puts 'Working on apk\'s'
56
- puts
22
+ def compiler(c, mode)
23
+ case mode
24
+ when 'dev'
25
+ params = ''
26
+ prod = false
27
+ when 'prod'
28
+ params = '--prod --release'
29
+ prod = true
30
+ end
57
31
 
58
- config = YAML.load_file("#{p}")
32
+ config = YAML.load_file("#{c}")
59
33
 
60
- app_name = config['app']['name']
61
- app_version = config['app']['name']
62
- android_version = config['app']['name']
34
+ app_name = config['app']['name'].delete(' ')
35
+ app_version = config['app']['version']
36
+ app_location = config['app']['location']
37
+ android_version = config['android']['version']
63
38
  cert_path = config['sign']['path']
64
39
  ionic_version = config['ionic']['version']
65
40
  output_path = config['output']['path']
66
41
 
67
- puts 'Ensuring that the platform is added ...'.green
42
+ case ionic_version
43
+ when 1
44
+ platform_build_folder = 'platforms/android/build/outputs/apk'
45
+ when 2
46
+ case prod
47
+ when true
48
+ platform_build_folder = 'platforms/android/app/build/outputs/apk/release'
49
+ else
50
+ platform_build_folder = 'platforms/android/app/build/outputs/apk/debug'
51
+ end
52
+ when 3
53
+ case prod
54
+ when true
55
+ platform_build_folder = 'platforms/android/app/build/outputs/apk/release'
56
+ else
57
+ platform_build_folder = 'platforms/android/app/build/outputs/apk/debug'
58
+ end
59
+ else
60
+ phrase 'Invalid ionic version'.red
61
+ abort()
62
+ end
63
+
64
+ phrase 'Ensuring that the platform is added ...'.green
68
65
 
69
- cmd("ionic cordova platform add android")
66
+ cmd("(cd #{app_location} && ionic cordova platform add android)")
70
67
 
71
- puts 'Exporting apk ...'.green
68
+ phrase 'Exporting apk'.green + " #{app_name}#{app_version}.apk".blue + " with ".green + "Android #{android_version}".blue
72
69
 
73
- cmd("ionic cordova build android")
70
+ cmd("(cd #{app_location} && ionic cordova build android #{params})")
74
71
 
75
- puts 'Signing apk, enter the password of your certificate'.green
72
+ case prod
73
+ when true
74
+ phrase 'Signing apk, enter the password of your certificate'.green
75
+
76
+ cmd("(cd #{app_location} && jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore #{cert_path} #{platform_build_folder}/android-release-unsigned.apk alias_name)")
77
+ end
76
78
 
77
- cmd("jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore #{cert_path} platforms/android/build/outputs/apk/android-release-unsigned.apk alias_name")
79
+ phrase 'Compressing apk'.green + " #{app_name}#{app_version}.apk".blue
80
+
81
+ cmd("(cd #{app_location} && zipalign -v 4 #{platform_build_folder}/android-release-unsigned.apk #{platform_build_folder}/#{app_name}#{app_version}.apk)")
78
82
 
79
- puts 'Compressing apk'.green
83
+ phrase 'Moving apk to: '.green + "#{output_path}".blue
80
84
 
81
- cmd("zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk platforms/android/build/outputs/apk/#{app_name}#{app_version}.apk")
82
-
83
- puts 'Moving apk'.green
85
+ cmd("(rm ~/#{output_path}/#{app_name}#{app_version}.apk)")
84
86
 
85
- cmd("mv platforms/android/build/outputs/apk/#{app_name}#{app_version}.apk ~/#{output_path}")
87
+ cmd("(cd #{app_location} && mv #{platform_build_folder}/#{app_name}#{app_version}.apk ~/#{output_path})")
86
88
 
87
- puts
88
- puts "Thanks for using RunApk!".green
89
- puts
89
+ phrase_simple "Thanks for using RunApk!".green
90
90
  end
91
91
 
92
92
  def setup()
93
- puts
94
- puts '🤩 Welcome to RunApk! 🤩'
95
- puts
96
- puts '⛱ RunApk is an ionic app exporting tool! 🏖'
97
- puts
98
- puts "👩🏻‍💻 This is a open source project, if you would like to help, follow: " + "https://github.com/gabriellacerda/runapk".red
99
- puts
93
+ phrase_simple '🤩 Welcome to RunApk! 🤩'.blue
94
+ phrase_simple ' RunApk is an ionic app exporting tool! 🏖'.green
95
+ phrase "👩🏻‍💻 If you you'ld like to help, follow: " + "https://github.com/gabriellacerda/runapk".blue
96
+
100
97
  prompt = TTY::Prompt.new
101
98
 
102
- type = prompt.select("👰🏻 Choose a pipeline:", %w(Development Production))
99
+ type = prompt.select("👰 Choose a pipeline:", %w(Development Production))
103
100
 
104
101
  config_file = './runapk.yml'
105
102
 
106
103
  case File.file?(config_file)
107
104
  when true
108
- dev(config_file)
105
+ case type
106
+ when 'Development'
107
+ compiler config_file, 'dev'
108
+ else
109
+ compiler config_file, 'prod'
110
+ end
109
111
  else
110
112
  puts 'Sorry a configuration file is needed 😥'
111
113
  puts 'Please follow the instructions located at: ' + "💃🏻 " + 'https://github.com/gabriellacerda/runapk'.red + " 🎉"
112
114
  abort()
113
115
  end
114
-
115
- case type
116
- when 'Development'
117
- dev(config_file)
118
- else
119
- prod(config_file)
120
- end
121
116
  end
122
117
 
123
118
  module Runapk
124
- trap("SIGINT") { throw :ctrl_c }
125
- catch :ctrl_c do
126
- begin
127
- setup()
128
- rescue Exception
129
- puts
130
- exit 130
131
- end
132
- end
119
+ setup()
133
120
  end
@@ -1,3 +1,3 @@
1
1
  module Runapk
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Runapk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GabrielLacerda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-31 00:00:00.000000000 Z
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RunApk comes to help when the problem is to export ionic apks
14
14
  email: