appril-cli 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/app/base/assets/styles.css +2 -0
  3. data/{boilerplate/app/base/api → app/base/components}/base_controller.rb +3 -1
  4. data/app/base/components/deploy.js +25 -0
  5. data/app/base/components/index/index.js +3 -0
  6. data/app/base/components/index/server.rb +13 -0
  7. data/{boilerplate/app/base/api → app/base/components}/rtcp_controller.rb +5 -7
  8. data/app/base/core.js +77 -0
  9. data/app/base/templates/layout.liquid +13 -0
  10. data/app/config/config.rb +11 -0
  11. data/{sandbox → app}/config/config.yml +8 -4
  12. data/{boilerplate/app → app}/core/Gemfile +2 -2
  13. data/{sandbox → app}/core/boot.rb +2 -4
  14. data/app/core/generate_configs.rb +7 -0
  15. data/{boilerplate/app → app}/core/load.rb +2 -2
  16. data/{boilerplate/app/core/load_api.rb → app/core/load_components.rb} +2 -1
  17. data/app/generators/_component/index.js +3 -0
  18. data/app/generators/_component/template.html +3 -0
  19. data/app/generators/component +29 -0
  20. data/app/package.json +30 -0
  21. data/{boilerplate/app → app}/webpack/alias.js +3 -3
  22. data/app/webpack/entry.js +3 -0
  23. data/{boilerplate/app → app}/webpack/extensions.js +1 -2
  24. data/app/webpack/loaders.js +47 -0
  25. data/app/webpack/output.js +9 -0
  26. data/app/webpack/plugins.js +38 -0
  27. data/app/webpack.config.js +29 -0
  28. data/lib/appril-cli/assertions.rb +5 -21
  29. data/lib/appril-cli/docker/build.rb +35 -31
  30. data/lib/appril-cli/docker/install.rb +18 -11
  31. data/lib/appril-cli/docker/update.rb +20 -11
  32. data/lib/appril-cli/docker.rb +14 -43
  33. data/lib/appril-cli/helpers.rb +7 -9
  34. data/lib/appril-cli/install.rb +30 -0
  35. data/lib/appril-cli/update.rb +34 -0
  36. data/lib/appril-cli/version.rb +1 -1
  37. data/lib/appril-cli.rb +62 -47
  38. metadata +52 -109
  39. data/boilerplate/app/base/api/deploy.coffee +0 -45
  40. data/boilerplate/app/base/api/index/client.coffee +0 -4
  41. data/boilerplate/app/base/api/index/server.rb +0 -3
  42. data/boilerplate/app/base/core.coffee +0 -113
  43. data/boilerplate/app/base/helpers/application_helpers.coffee +0 -1
  44. data/boilerplate/app/base/templates/access_denied.html +0 -3
  45. data/boilerplate/app/base/templates/layout.liquid +0 -11
  46. data/boilerplate/app/base/templates/layouts/main.html +0 -1
  47. data/boilerplate/app/base/templates/layouts/none.html +0 -1
  48. data/boilerplate/app/config/config.rb +0 -14
  49. data/boilerplate/app/config/config.yml +0 -18
  50. data/boilerplate/app/core/boot.rb +0 -72
  51. data/boilerplate/app/core/generate_configs.rb +0 -79
  52. data/boilerplate/app/generators/api/client.coffee +0 -4
  53. data/boilerplate/app/generators/api/server.rb +0 -3
  54. data/boilerplate/app/package.json +0 -10
  55. data/boilerplate/app/webpack/config.js +0 -6
  56. data/boilerplate/app/webpack/entry.js +0 -3
  57. data/boilerplate/app/webpack/loaders.js +0 -15
  58. data/boilerplate/app/webpack/output.js +0 -11
  59. data/boilerplate/app/webpack/plugins.js +0 -19
  60. data/boilerplate/app/webpack.config.js +0 -19
  61. data/boilerplate/crudle/Gemfile +0 -7
  62. data/boilerplate/crudle/base/api/deploy.coffee +0 -51
  63. data/boilerplate/crudle/base/api/index/client.coffee +0 -5
  64. data/boilerplate/crudle/base/api/index/layout.html +0 -5
  65. data/boilerplate/crudle/base/api/index/server.rb +0 -7
  66. data/boilerplate/crudle/base/templates/menu.html +0 -3
  67. data/boilerplate/crudle/generators/api/client.coffee +0 -17
  68. data/boilerplate/crudle/generators/api/editor/layout.html +0 -3
  69. data/boilerplate/crudle/generators/api/list/item.html +0 -3
  70. data/boilerplate/crudle/generators/api/server.rb +0 -26
  71. data/boilerplate/crudle/package.json +0 -13
  72. data/boilerplate/crudle/webpack/loaders.js +0 -16
  73. data/lib/appril-cli/app/install.rb +0 -47
  74. data/lib/appril-cli/app/update.rb +0 -28
  75. data/lib/appril-cli/app.rb +0 -46
  76. data/lib/appril-cli/generator/api.rb +0 -16
  77. data/lib/appril-cli/generator.rb +0 -32
  78. data/sandbox/.gitignore +0 -6
  79. data/sandbox/.pryrc +0 -1
  80. data/sandbox/Gemfile +0 -7
  81. data/sandbox/Rakefile +0 -1
  82. data/sandbox/base/api/base_controller.rb +0 -21
  83. data/sandbox/base/api/index/client.coffee +0 -4
  84. data/sandbox/base/api/index/layout.html +0 -3
  85. data/sandbox/base/api/index/server.rb +0 -3
  86. data/sandbox/base/api/rtcp_controller.rb +0 -22
  87. data/sandbox/base/assets/styles.css +0 -0
  88. data/sandbox/base/boot.rb +0 -2
  89. data/sandbox/base/core.coffee +0 -128
  90. data/sandbox/base/helpers/application_helpers.coffee +0 -1
  91. data/sandbox/base/helpers/application_helpers.rb +0 -4
  92. data/sandbox/base/load.rb +0 -0
  93. data/sandbox/base/models/base_model.rb +0 -0
  94. data/sandbox/base/templates/access_denied.html +0 -3
  95. data/sandbox/base/templates/layout.liquid +0 -11
  96. data/sandbox/base/templates/layouts/main.html +0 -1
  97. data/sandbox/base/templates/layouts/none.html +0 -1
  98. data/sandbox/base/templates/menu.html +0 -3
  99. data/sandbox/config/config.rb +0 -9
  100. data/sandbox/config/env/development.yml +0 -0
  101. data/sandbox/config/env/production.yml +0 -0
  102. data/sandbox/config/env/stage.yml +0 -0
  103. data/sandbox/config/env/test.yml +0 -0
  104. data/sandbox/config.ru +0 -3
  105. data/sandbox/core/Gemfile +0 -4
  106. data/sandbox/core/generate_configs.rb +0 -125
  107. data/sandbox/core/load.rb +0 -14
  108. data/sandbox/core/load_controllers.rb +0 -14
  109. data/sandbox/generators/api/client.coffee +0 -11
  110. data/sandbox/generators/api/editor.html +0 -0
  111. data/sandbox/generators/api/layout.html +0 -0
  112. data/sandbox/generators/api/server.rb +0 -26
  113. data/sandbox/package.json +0 -15
  114. data/sandbox/webpack.config.js +0 -54
  115. /data/{boilerplate/app → app}/.gitignore +0 -0
  116. /data/{boilerplate/app → app}/.pryrc +0 -0
  117. /data/{boilerplate/app → app}/Gemfile +0 -0
  118. /data/{boilerplate/app → app}/Rakefile +0 -0
  119. /data/{boilerplate/app → app}/base/boot.rb +0 -0
  120. /data/{boilerplate/app/base/api/index/layout.html → app/base/components/index/template.html} +0 -0
  121. /data/{boilerplate/app → app}/base/helpers/application_helpers.rb +0 -0
  122. /data/{boilerplate/app/base/assets/styles.css → app/base/helpers/index.js} +0 -0
  123. /data/{boilerplate/app → app}/base/load.rb +0 -0
  124. /data/{boilerplate/app → app}/base/models/base_model.rb +0 -0
  125. /data/{boilerplate/app/public → app/compiled}/.ignore +0 -0
  126. /data/{boilerplate/app → app}/config/env/development.yml +0 -0
  127. /data/{boilerplate/app → app}/config/env/production.yml +0 -0
  128. /data/{boilerplate/app → app}/config/env/stage.yml +0 -0
  129. /data/{boilerplate/app → app}/config/env/test.yml +0 -0
  130. /data/{boilerplate/app → app}/config.ru +0 -0
  131. /data/{boilerplate/app → app}/core/load_helpers.rb +0 -0
  132. /data/{boilerplate/app → app}/core/load_models.rb +0 -0
  133. /data/{boilerplate/app/tmp → app/public}/.ignore +0 -0
  134. /data/{boilerplate/app/var → app/tmp}/.ignore +0 -0
  135. /data/{boilerplate/app/generators/api/layout.html → app/var/.ignore} +0 -0
@@ -1,22 +1,27 @@
1
1
  module Appril
2
2
  class CLI
3
- module Docker
3
+ class Docker
4
4
 
5
- class Build
5
+ class Build < self
6
6
 
7
- def initialize dir, update_runner_only: false, push_opted: false
8
- Dir.chdir dir do
7
+ def initialize path, update_runner_only: false, push_opted: false
8
+ src, dst = paths(path)
9
9
 
10
- config = load_config
10
+ assert_directory_exists(dst)
11
+ assert_config_file_exists(dst)
12
+
13
+ Dir.chdir dst do
14
+
15
+ config = load_config()
11
16
  validate_config(config)
12
17
 
13
- build_dir = Pathname.new(File.expand_path('__tmpbuildir__'))
18
+ build_dir = dst / '__tmpbuildir__'
14
19
 
15
20
  prepare_build_dir(build_dir)
16
21
 
17
22
  install_files(build_dir)
18
23
 
19
- app_dir = Pathname.new(File.expand_path(config['APP_DIR']))
24
+ app_dir = dst / config['APP_DIR']
20
25
 
21
26
  if update_runner_only
22
27
  puts "Skipping image building"
@@ -49,8 +54,7 @@ module Appril
49
54
  'RUN_SCRIPT' => :validate_config__run_script,
50
55
  }.each_pair do |key,validator|
51
56
  next if send(validator, config[key])
52
- puts "", "\t::: Please set #{key} in config.yml :::", ""
53
- exit 1
57
+ fatal_error!("Please set #{key} in config.yml")
54
58
  end
55
59
  end
56
60
 
@@ -70,46 +74,46 @@ module Appril
70
74
  !value.nil? && !value.empty?
71
75
  end
72
76
 
73
- def prepare_build_dir dir
74
- FileUtils.rm_rf(dir)
75
- FileUtils.mkdir_p(dir / 'build')
77
+ def prepare_build_dir path
78
+ FileUtils.rm_rf(path)
79
+ FileUtils.mkdir_p(path / 'build')
76
80
  end
77
81
 
78
- def install_files dir
79
- install_dockerfile(dir)
80
- install_start_file(dir)
81
- install_build_files(dir)
82
- install_cleanup_file(dir)
82
+ def install_files path
83
+ install_dockerfile(path)
84
+ install_start_file(path)
85
+ install_build_files(path)
86
+ install_cleanup_file(path)
83
87
  end
84
88
 
85
- def install_dockerfile dir
86
- FileUtils.cp(DOCKER_DIR / 'Dockerfile', dir)
89
+ def install_dockerfile path
90
+ FileUtils.cp(DOCKER_DIR / 'Dockerfile', path)
87
91
  end
88
92
 
89
- def install_start_file dir
90
- File.open dir / 'start', 'w' do |f|
93
+ def install_start_file path
94
+ File.open path / 'start', 'w' do |f|
91
95
  f << File.read(DOCKER_DIR / 'start').sub('{start}', File.read(START_FILE))
92
96
  end
93
97
  end
94
98
 
95
- def install_build_files dir
96
- FileUtils.cp(PREPARE_BUILD_FILE, dir / 'build')
97
- FileUtils.cp(BUILD_FILE, dir / 'build/build')
99
+ def install_build_files path
100
+ FileUtils.cp(PREPARE_BUILD_FILE, path / 'build')
101
+ FileUtils.cp(BUILD_FILE, path / 'build/build')
98
102
  end
99
103
 
100
- def install_cleanup_file dir
101
- FileUtils.cp(CLEANUP_FILE, dir / 'build/cleanup')
104
+ def install_cleanup_file path
105
+ FileUtils.cp(CLEANUP_FILE, path / 'build/cleanup')
102
106
  end
103
107
 
104
- def prepare_build dir, app_dir
105
- Dir.chdir dir / 'build' do
108
+ def prepare_build path, app_dir
109
+ Dir.chdir path / 'build' do
106
110
  CLI.run "APP_DIR=#{app_dir} #{PREPARE_BUILD_FILE}"
107
111
  exit 1 unless $? && $?.success?
108
112
  end
109
113
  end
110
114
 
111
- def build_image dir, image_name, build_opts
112
- CLI.run "docker build -t #{image_name} #{build_opts} '#{dir}'"
115
+ def build_image path, image_name, build_opts
116
+ CLI.run "docker build -t #{image_name} #{build_opts} '#{path}'"
113
117
  $? && $?.success?
114
118
  end
115
119
 
@@ -146,7 +150,7 @@ module Appril
146
150
  end
147
151
 
148
152
  end
149
-
153
+
150
154
  end
151
155
  end
152
156
  end
@@ -1,23 +1,30 @@
1
1
  module Appril
2
2
  class CLI
3
- module Docker
3
+ class Docker
4
4
 
5
- class Install
6
- include Helpers
5
+ class Install < self
7
6
 
8
- def initialize dir, working_dir_opted: false
9
- install(dir, working_dir_opted)
10
- make_executable(dir / PREPARE_BUILD_FILE)
11
- puts "Done. All files installed into #{dir}"
7
+ def initialize path
8
+ src, dst = paths(path)
9
+
10
+ install(src, dst)
11
+ post_install(dst)
12
+
13
+ puts "Done. All files installed into #{dst}"
12
14
  end
13
15
 
14
- def install dir, working_dir_opted
15
- src = working_dir_opted ? DOCKER_DIR.to_path + '/skel/.' : DOCKER_DIR / 'skel'
16
- FileUtils.cp_r(src, dir)
16
+ def install src, dst
17
+ create_dirname_for(dst)
18
+ assert_directory_does_not_exists(dst)
19
+ FileUtils.cp_r(src, dst)
20
+ end
21
+
22
+ def post_install dst
23
+ make_executable(dst / PREPARE_BUILD_FILE)
17
24
  end
18
25
 
19
26
  end
20
-
27
+
21
28
  end
22
29
  end
23
30
  end
@@ -1,26 +1,35 @@
1
1
  module Appril
2
2
  class CLI
3
- module Docker
3
+ class Docker
4
4
 
5
- class Update
6
- include Helpers
5
+ class Update < self
7
6
 
8
- def initialize dir
9
- Dir.chdir DOCKER_DIR / 'skel' do
7
+ def initialize path
8
+ src, dst = paths(path)
10
9
 
10
+ Dir.chdir src do
11
11
  Dir['**/*'].select {|e| File.file?(e)}.each do |file|
12
- next if File.file?(dir / file)
13
- create_dirname_for(dir / file)
14
- puts "Installing #{File.basename(dir)}/#{file}"
15
- FileUtils.cp(file, dir / file)
12
+ update_file(file, dst)
16
13
  end
17
-
18
14
  end
15
+
16
+ post_update(dst)
19
17
  puts "Done"
20
18
  end
21
19
 
20
+ private
21
+ def update_file file, dst
22
+ return if File.file?(dst / file)
23
+ create_dirname_for(dst / file)
24
+ puts "Updating #{File.basename(dst)}/#{file}"
25
+ FileUtils.cp(file, dst / file)
26
+ end
27
+
28
+ def post_update dst
29
+ make_executable(dst / PREPARE_BUILD_FILE)
30
+ end
22
31
  end
23
-
32
+
24
33
  end
25
34
  end
26
35
  end
@@ -1,61 +1,32 @@
1
1
  module Appril
2
2
  class CLI
3
- module Docker
3
+ class Docker
4
+ include Helpers
5
+ include Assertions
4
6
 
5
- DOCKER_DIR = BASE_DIR / 'docker'
6
-
7
7
  CONFIG_FILE = './config.yml'.freeze
8
8
  START_FILE = './start.sh'.freeze
9
9
  PREPARE_BUILD_FILE = './prepare_build.sh'.freeze
10
10
  BUILD_FILE = './build.sh'.freeze
11
11
  CLEANUP_FILE = './cleanup.sh'.freeze
12
12
 
13
- def docker args
14
- opted_dir = args[2]
15
- assert_directory_provided(opted_dir)
16
- dir = expanded_path(opted_dir)
17
-
18
- case instruction = args[1]
19
- when 'i', 'install'
20
-
21
- docker_install(dir, working_dir_opted: working_dir_opted?(opted_dir))
22
-
23
- when 'b', 'build'
24
-
25
- docker_build(dir, {
26
- update_runner_only: args.find {|a| a == '-u'},
27
- push_opted: args.find {|a| a == '-p'}
28
- })
29
-
30
- when 'u', 'update'
31
-
32
- docker_update(dir)
33
-
13
+ def paths path
14
+ if path == WORKING_DIR
15
+ [
16
+ DOCKER_DIR.to_path + '/skel/.',
17
+ path / 'docker'
18
+ ]
34
19
  else
35
- unknown_instruction_error!(instruction, 'install (or i)', 'build (or b)', 'update (or u)')
20
+ [
21
+ DOCKER_DIR / 'skel',
22
+ path
23
+ ]
36
24
  end
37
25
  end
38
-
39
- def docker_install dir, opts
40
- create_dirname_for(dir)
41
- assert_installable_dir(dir, opts[:working_dir_opted])
42
- Docker::Install.new(dir, opts)
43
- end
44
-
45
- def docker_build dir, opts
46
- assert_directory_exists(dir)
47
- assert_config_file_exists(dir)
48
- Docker::Build.new(dir, opts)
49
- end
50
-
51
- def docker_update dir
52
- assert_is_docker_dir(dir)
53
- Docker::Update.new(dir)
54
- end
55
26
  end
56
27
  end
57
28
  end
58
29
 
59
30
  require 'appril-cli/docker/install'
60
- require 'appril-cli/docker/build'
61
31
  require 'appril-cli/docker/update'
32
+ require 'appril-cli/docker/build'
@@ -2,13 +2,15 @@ module Appril
2
2
  class CLI
3
3
  module Helpers
4
4
 
5
- def display_error error
6
- puts "", "\t::: #{error} :::", ""
5
+ def format_error *lines
6
+ lines.flatten!
7
+ header = lines.shift()
8
+ "\t::: %s :::%s" % [header, lines.any? ? ([''] + lines).join("\n\t") : ""]
7
9
  end
8
10
 
9
- def fatal_error! error, exit_code = 1
10
- display_error(error)
11
- exit exit_code
11
+ def fatal_error! *lines
12
+ puts '', format_error(lines), ''
13
+ exit 1
12
14
  end
13
15
 
14
16
  def expanded_path *path
@@ -23,10 +25,6 @@ module Appril
23
25
  entries.flatten.each {|e| FileUtils.chmod('+x', e)}
24
26
  end
25
27
 
26
- def working_dir_opted? opted_dir
27
- opted_dir == '.'
28
- end
29
-
30
28
  def extract_namespace args
31
29
  return unless index = args.index('-n')
32
30
  return unless namespace = args[index + 1]
@@ -0,0 +1,30 @@
1
+ module Appril
2
+ class CLI
3
+
4
+ class Install
5
+ include Helpers
6
+
7
+ def initialize path
8
+ install(path)
9
+ post_install(path)
10
+ puts "Done. All files installed into #{path}"
11
+ end
12
+
13
+ private
14
+ def install path
15
+ src = path == WORKING_DIR ? APP_DIR.to_path + '/.' : APP_DIR
16
+ FileUtils.cp_r(src, path)
17
+ end
18
+
19
+ def post_install path
20
+ make_executable(path / 'core/generate_configs.rb')
21
+ cleanup(path)
22
+ end
23
+
24
+ def cleanup path
25
+ Dir["#{path}/**/.ignore"].each {|f| FileUtils.rm_f(f)}
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ module Appril
2
+ class CLI
3
+
4
+ class Update
5
+ include Helpers
6
+
7
+ def initialize path
8
+ FileUtils.rm_rf(path / 'core')
9
+
10
+ Dir.chdir APP_DIR do
11
+ Dir['**/*'].select {|e| File.file?(e)}.each do |file|
12
+ update_file(path, file)
13
+ end
14
+ end
15
+
16
+ post_update(path)
17
+ puts "Done"
18
+ end
19
+
20
+ private
21
+ def update_file path, file
22
+ return if File.file?(path / file)
23
+ create_dirname_for(path / file)
24
+ puts "Updating #{File.basename(path)}/#{file}"
25
+ FileUtils.cp(file, path / file)
26
+ end
27
+
28
+ def post_update path
29
+ make_executable(path / 'core/generate_configs.rb')
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  module Appril
2
2
  class CLI
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
data/lib/appril-cli.rb CHANGED
@@ -5,98 +5,113 @@ require 'pty'
5
5
 
6
6
  module Appril
7
7
  class CLI
8
+
8
9
  BASE_DIR = Pathname.new(File.expand_path('../..', __FILE__))
9
- BOILERPLATE_DIR = BASE_DIR / 'boilerplate'
10
+ APP_DIR = BASE_DIR / 'app'
11
+ DOCKER_DIR = BASE_DIR / 'docker'
12
+ WORKING_DIR = Pathname.new(Dir.pwd)
13
+
14
+ def self.run cmd
15
+ puts "", "$ #{cmd}"
16
+ PTY.spawn cmd do |r, w, pid|
17
+ begin
18
+ r.sync
19
+ r.each_char do |char|
20
+ print(char)
21
+ end
22
+ rescue Errno::EIO => e
23
+ # simply ignoring this
24
+ ensure
25
+ Process.wait(pid)
26
+ end
27
+ end
28
+ end
10
29
  end
11
30
  end
12
31
 
13
32
  require 'appril-cli/version'
14
33
  require 'appril-cli/helpers'
15
34
  require 'appril-cli/assertions'
16
- require 'appril-cli/app'
17
- require 'appril-cli/generator'
35
+ require 'appril-cli/install'
36
+ require 'appril-cli/update'
18
37
  require 'appril-cli/docker'
19
38
 
20
39
  module Appril
21
40
  class CLI
22
-
23
41
  include Helpers
24
- include Assertions
25
- include Docker
26
- include App
27
- include Generator
28
42
 
29
43
  def initialize args
44
+ opts, args = args.partition {|a| a =~ /\A\-/}
45
+
30
46
  case command = args[0]
31
- when 'a', 'app'
32
- app(args)
33
- when 'g', 'gen', 'generate'
34
- generator(args)
47
+ when 'i', 'install'
48
+ Install.new(Pathname.new(args[1] || WORKING_DIR))
49
+
50
+ when 'u', 'update'
51
+ Update.new(Pathname.new(args[1] || WORKING_DIR))
52
+
53
+
35
54
  when 'd', 'docker'
36
- docker(args)
37
- when 'v', '-v', '--version'
55
+ path = Pathname.new(args[2] || WORKING_DIR)
56
+
57
+ case subcommand = args[1]
58
+ when 'i', 'install'
59
+ Docker::Install.new(path)
60
+
61
+ when 'u', 'update'
62
+ Docker::Update.new(path)
63
+
64
+ when 'b', 'build'
65
+ Docker::Build.new(path, {
66
+ update_runner_only: opts.include?('-u'),
67
+ push_opted: opts.include?('-p')
68
+ })
69
+ else
70
+ puts format_error("Unknown subcommand #{subcommand}")
71
+ usage
72
+ end
73
+ when '-v', '--version'
38
74
  puts VERSION
39
75
  when nil, '-h', '--help'
40
76
  usage
41
77
  else
42
- display_error "Unknown command #{command}"
78
+ puts format_error("Unknown command #{command}")
43
79
  usage
44
80
  end
45
81
  end
46
82
 
47
-
48
83
  def usage
49
84
  puts "
50
85
  Arguments in round brackets are required.
51
86
  Arguments in square brackets are optional.
52
87
 
88
+ All operations accepts a path as last argument.
89
+ If no path given current folder will be used.
90
+
53
91
 
54
92
  === Install a new app ===
55
- $ appril (app || a) (install || i) (dir || .) [-crudle]
56
- * If -crudle option provided it will install a Crudle app
93
+ $ appril (install || i) [path]
57
94
 
58
95
  === Update existing app ===
59
- $ appril (app || a) (update || u) (dir || .)
60
-
61
- === Generate a new API ===
62
- $ appril (generate || g) (api) (api name) (dir || .)
96
+ $ appril (update || u) [path]
63
97
 
64
98
  === Install Docker builder ===
65
- $ appril (docker || d) (install || i) (dir || .)
99
+ $ appril (docker || d) (install || i) [path]
66
100
 
67
101
  === Update Docker builder ===
68
- $ appril (docker || d) (update || u) (dir || .)
102
+ $ appril (docker || d) (update || u) [path]
69
103
 
70
104
  === Build Docker image and install run script ===
71
- $ appril (docker || d) (build || b) (dir || .) [-u] [-p]
105
+ $ appril (docker || d) (build || b) [path] [-u] [-p]
72
106
  * If -u option provided it will only update the run script without building the image.
73
107
  * If -p option provided it will try to push the image to Docker registry after successful build.
74
108
 
75
109
  === Usage ===
76
110
  $ appril [-h || --help]
77
- ".split("\n").map {|l| "\t" + l.strip}.join("\n")
78
- end
79
-
80
-
81
- def unknown_instruction_error! instruction, *available_instructions
82
- fatal_error! "Unknown instruction #{instruction}. Use one of #{available_instructions*', '}"
83
- end
84
-
85
111
 
86
- def self.run cmd
87
- puts "", "$ #{cmd}"
88
- PTY.spawn cmd do |r, w, pid|
89
- begin
90
- r.sync
91
- r.each_char do |char|
92
- print(char)
93
- end
94
- rescue Errno::EIO => e
95
- # simply ignoring this
96
- ensure
97
- Process.wait(pid)
98
- end
99
- end
112
+ === Version ===
113
+ $ appril [-v || --version]
114
+ ".split("\n").map {|l| "\t" + l.strip}.join("\n")
100
115
  end
101
116
  end
102
117
  end