rocket_api 0.0.1.8 → 0.0.1.9

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: 4d51b15ec9a3bed003e926954ae9c1ef2e4807cc4ab1dba0df4ddc4741d8bb29
4
- data.tar.gz: a9fb174b4e4a9a51940637439c8ee8daa1130c23eaaa60cf96b1d385155f620c
3
+ metadata.gz: 0300050a0bdc48251533068b06db4638fff1ae13f85fa315e6832444fb7763d5
4
+ data.tar.gz: 2e217624a32f29abe47e3a97bc56d1af870c058bf2784c7cefe8eeca19675c66
5
5
  SHA512:
6
- metadata.gz: b2d17e6fccd5fc033b3892c5b9a8d0f27510004494afe00b96535dc7d59249e026dd636eba092e9b5f27ed0766b7c6f678a6eb19fa87aa6955d40d29c3731f3b
7
- data.tar.gz: dfbcd498094e25efbce55bcf34ebc21b0c7163a883ae9cc7e99779bd2e5c55f78f98d4467c6de5c95c2bc65cd0b5e8313a69ef18a7d08fe2017bd68608ec971e
6
+ metadata.gz: bbf4749e0e87c43f033d6adb7bd06ba5a59ba83a332dd23cf96a0de58b1a790f585cc372e722a91d224c13a6ce1fc573024e6864de7904a0b168a656e6084635
7
+ data.tar.gz: 198073b10660fa5b715949cd2ce815bef63daf938c78c1ca9b991fdacbdd1e99e441eb0ffa54049ee6166c26d25f5c741cb56de22006f2e9129600a94a1c0a44
data/.rubocop.yml CHANGED
@@ -5,6 +5,7 @@ AllCops:
5
5
  - Rakefile
6
6
  - rocket_api.gemspec
7
7
  - bin/*
8
+ - spec/**/**
8
9
 
9
10
  Style/FrozenStringLiteralComment:
10
11
  Enabled: false
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # rocket_api
2
- Start creating gems with rocket_api
3
- - Add structure of gem repo by one commands
4
- - Init gems repo by files
1
+ # rocket api
2
+ Start creating new app with rocket_api:
3
+ - Add structure of gem repo
4
+ - Add structure of rack app
5
5
  ## Dependencies:
6
6
  ```sh
7
7
  ruby '2.7.2'
@@ -16,8 +16,12 @@ gem install rocket_api
16
16
  ```sh
17
17
  Availble commands:
18
18
  - init
19
- - gem [ project_name ]
19
+ -- gem [ project_name ]
20
+ -- rack [ project name ]
20
21
  In working directory:
21
-
22
22
  user@bulkas ~/gem/new_dir rocket_api [ init ] [ gem ] [ project_name ]
23
+ ```
24
+ ## Example
25
+ ```sh
26
+ user@bulkas ~/gem/new_dir rocket_api init new_gem
23
27
  ```
data/Rakefile CHANGED
@@ -2,12 +2,11 @@ require 'rubygems'
2
2
  require 'rake'
3
3
 
4
4
  desc "Run spec"
5
- task default: %i[test rubocop]
5
+ task default: %i[spec rubocop]
6
6
 
7
- require 'rake/testtask'
8
- Rake::TestTask.new do |test|
9
- test.libs << 'test'
10
- end
7
+ require "bundler/gem_tasks"
8
+ require "rspec/core/rake_task"
9
+ RSpec::Core::RakeTask.new(:spec)
11
10
 
12
11
  require 'rubocop/rake_task'
13
12
  RuboCop::RakeTask.new do |task|
data/bin/rocket_api CHANGED
@@ -11,11 +11,16 @@ if [base_command, sub_command, project_name].map(&:nil?).any?
11
11
  return
12
12
  end
13
13
 
14
+ unless RocketApi::CHECK_APPS.map { |p| Dir.glob(p) }.flatten.empty?
15
+ puts RocketApi::APP_DETECTED
16
+ return
17
+ end
18
+
14
19
  case
15
- when RocketApi::AVAILABLE_COMMANDS.keys.include?(base_command&.to_sym)
16
- if RocketApi::AVAILABLE_COMMANDS[base_command&.to_sym].keys.include?(sub_command&.to_sym)
17
- RocketApi::AVAILABLE_COMMANDS[base_command&.to_sym][sub_command&.to_sym].each do |command|
18
- RocketApi::RocketCommands.send(command, project_name: project_name)
20
+ when RocketApi::AVAILABLE_COMMANDS.keys.include?(base_command)
21
+ if RocketApi::AVAILABLE_COMMANDS[base_command].keys.include?(sub_command)
22
+ RocketApi::AVAILABLE_COMMANDS[base_command][sub_command].each do |key, collection|
23
+ RocketApi::RocketCommands.send(key, collection: collection, project_name: project_name )
19
24
  rescue RocketApi::Error => e
20
25
  puts "#{RocketApi::INIT_DIR_ERROR} #{e.message}"
21
26
  return
@@ -0,0 +1,60 @@
1
+ module RocketApi
2
+ module Commands
3
+ module RackDir
4
+ def rack_routes!(_name)
5
+ dir_name = "app/constants"
6
+ create_dir(dir_name)
7
+ file_name = "#{dir_name}/routes.rb"
8
+ create_single_file(file_name, rack_routes_text)
9
+ end
10
+
11
+ def rack_base_controller!(_name)
12
+ dir_name = "app/controllers"
13
+ create_dir(dir_name)
14
+ file_name = "#{dir_name}/base_controller.rb"
15
+ create_single_file(file_name, rack_base_controller_text)
16
+ end
17
+
18
+ def rack_config_ru!(_name)
19
+ file_name = "config.ru"
20
+ create_single_file(file_name, rack_config_ru)
21
+ end
22
+
23
+ def rack_app!(_name)
24
+ dir_name = "config/app"
25
+
26
+ create_dir(dir_name) unless is_exist?(dir_name)
27
+
28
+ file_name = "#{dir_name}/app.rb"
29
+ create_single_file(file_name, rack_app_text)
30
+ end
31
+
32
+ def rack_router!(_name)
33
+ dir_name = "config/app"
34
+
35
+ create_dir(dir_name) unless is_exist?(dir_name)
36
+
37
+ file_name = "#{dir_name}/router.rb"
38
+ create_single_file(file_name, rack_router_text)
39
+ end
40
+
41
+ def rack_initializers!(_name)
42
+ dir_name = "config/initializers"
43
+
44
+ create_dir(dir_name) unless is_exist?(dir_name)
45
+
46
+ file_name = "#{dir_name}/001_settings.rb"
47
+ create_single_file(file_name, rack_initializers_text)
48
+ end
49
+
50
+ def rack_application!(_name)
51
+ file_name = "config/application.rb"
52
+ create_single_file(file_name, rack_application_text)
53
+ end
54
+
55
+ def rack_gemfile!(_name)
56
+ create_single_file("Gemfile", rack_gemfile_text)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,13 +1,26 @@
1
1
  module RocketApi
2
2
  # Valid input
3
3
  REGEXP_VALID = /[^0-9A-Za-z_-]/.freeze
4
+ CHECK_APPS = %w[*.gemspec *.ru].freeze
5
+
6
+ # Valid commands
7
+ COMMANDS = { init: "init", gem: "gem", rack: "rack" }.freeze
8
+
9
+ # Gem
10
+ GEM_DIRS = %w[bin lib test].freeze
11
+ GEM_FILES = %w[bin! gemspec! gems_main_file! gems_version! gem_test! rake_file! gitignore! gem_file! rubocop_yml!].freeze
12
+ GEM_MAP = { init_dirs: GEM_DIRS, init_files: GEM_FILES }.freeze
13
+
14
+ # Rack
15
+ RACK_DIRS = %w[app config test].freeze
16
+ RACK_FILES = %w[rack_routes! rack_base_controller! rack_config_ru! gitignore! rack_app! rack_router! rack_initializers! rack_application! rack_gemfile!].freeze
17
+ RACK_MAP = { init_dirs: RACK_DIRS, init_files: RACK_FILES }.freeze
4
18
 
5
19
  # Dirs map
6
- GEM_PROJECTS_DIR = %w[bin lib test].freeze
7
- GEM_COMMANDS = %w[bin! gemspec! gems_main_file! gems_version! gem_test! rake_file! gitignore! gem_file! rubocop_yml!].freeze
8
20
  AVAILABLE_COMMANDS = {
9
- init: {
10
- gem: %w[init_gem_dir init_gem_files]
21
+ COMMANDS[:init] => {
22
+ COMMANDS[:gem] => GEM_MAP,
23
+ COMMANDS[:rack] => RACK_MAP
11
24
  }
12
25
  }.freeze
13
26
 
@@ -16,7 +29,7 @@ module RocketApi
16
29
 
17
30
  # Answers
18
31
  INIT_DIR_ERROR = "Init directory error".freeze
19
- GEM_DETECTED = "another one gem exist".freeze
32
+ APP_DETECTED = "Another one app exist".freeze
20
33
  FOLDER_EXIST = "folder exist:".freeze
21
34
  FILE_EXIST = "file already exist:".freeze
22
35
  WRONG_RESPONSE = "Wrong command".freeze
@@ -24,4 +37,8 @@ module RocketApi
24
37
  INIT_FAIL = "Init action fail:".freeze
25
38
  CREATE_FAILED = "Create failed:".freeze
26
39
  CREATE_SUCCESS = "Successfully created:".freeze
40
+
41
+ # Text
42
+ TAB = "\s\s".freeze
43
+ DOUBLE_TAB = "\s\s\s\s".freeze
27
44
  end
@@ -1,8 +1,10 @@
1
1
  module RocketApi
2
2
  # Base error
3
3
  class Error < StandardError; end
4
+
4
5
  # Raise in case of dir creation error
5
6
  class CreateDirError < Error; end
7
+
6
8
  # Raise in case of file creation error
7
9
  class InitFilesError < Error; end
8
10
  end
@@ -6,7 +6,6 @@ module RocketApi
6
6
  end
7
7
 
8
8
  # @param [String] module_name
9
- #
10
9
  # @return [String] text
11
10
  def plain_version_text(module_name)
12
11
  "module #{module_name}\n\tVERSION = \"0.0.1\".freeze\nend"
@@ -14,7 +13,6 @@ module RocketApi
14
13
 
15
14
  # @param [String] name
16
15
  # @param [String] module_name
17
- #
18
16
  # @return [String] text
19
17
  def plain_gemspec_text(name, module_name)
20
18
  ["lib = File.expand_path(\"lib\", __dir__)",
@@ -22,38 +20,37 @@ module RocketApi
22
20
  "require 'English'",
23
21
  "require '#{name}/version'\n",
24
22
  "Gem::Specification.new do |s|",
25
- "\ts.specification_version = 2 if s.respond_to? :specification_version=",
26
- "\tif s.respond_to? :required_rubygems_version=",
27
- "\t\ts.required_rubygems_version = Gem::Requirement.new('>= 0')",
28
- "\tend",
29
- "\ts.rubygems_version = 'RUBY_VERSION'",
30
- "\ts.required_ruby_version = 'RUBY_VERSION'",
31
- "\ts.name = '#{name}'",
32
- "\ts.version = #{module_name}::VERSION",
33
- "\ts.executables << '#{name}'",
34
- "\ts.summary = 'PUT_SUMMARY'",
35
- "\ts.description = 'PUT_DESCRIPTION'",
36
- "\ts.authors = ['AUTHOR']",
37
- "\ts.email = 'AUTHOR_MAIL'",
38
- "\ts.homepage = 'https://github.com/...'",
39
- "\ts.files = `git ls-files`.split($RS)",
40
- "\ts.add_dependency \"rubocop\"",
41
- "\ts.add_dependency \"rubocop-rake\"",
23
+ "\s\ss.specification_version = 2 if s.respond_to? :specification_version=",
24
+ "\s\sif s.respond_to? :required_rubygems_version=",
25
+ "\s\s\s\ss.required_rubygems_version = Gem::Requirement.new('>= 0')",
26
+ "\s\send",
27
+ "\s\ss.rubygems_version = 'RUBY_VERSION'",
28
+ "\s\ss.required_ruby_version = 'RUBY_VERSION'",
29
+ "\s\ss.name = '#{name}'",
30
+ "\s\ss.version = #{module_name}::VERSION",
31
+ "\s\ss.executables << '#{name}'",
32
+ "\s\ss.summary = 'PUT_SUMMARY'",
33
+ "\s\ss.description = 'PUT_DESCRIPTION'",
34
+ "\s\ss.authors = ['AUTHOR']",
35
+ "\s\ss.email = 'AUTHOR_MAIL'",
36
+ "\s\ss.homepage = 'https://github.com/...'",
37
+ "\s\ss.files = `git ls-files`.split($RS)",
38
+ "\s\ss.add_dependency \"rubocop\"",
39
+ "\s\ss.add_dependency \"rubocop-rake\"",
42
40
  "end"].join("\n")
43
41
  end
44
42
 
45
43
  # @param [String] name
46
44
  # @param [String] module_name
47
- #
48
45
  # @return [String] text
49
46
  def plain_gem_test_version_text(name, module_name)
50
47
  ["require 'minitest/autorun'",
51
48
  "require '#{name}/version'\n",
52
49
  "class TestVersion < Minitest::Test",
53
- "\tinclude #{module_name}\n",
54
- "\tdef test_ping",
55
- "\t\tassert_equal(\"0.0.1\", #{module_name}::VERSION)",
56
- "\tend",
50
+ "\s\sinclude #{module_name}\n",
51
+ "\s\sdef test_ping",
52
+ "\s\s\s\sassert_equal(\"0.0.1\", #{module_name}::VERSION)",
53
+ "\s\send",
57
54
  "end"].join("\n")
58
55
  end
59
56
 
@@ -65,16 +62,15 @@ module RocketApi
65
62
  end
66
63
 
67
64
  # @param [String] name
68
- #
69
65
  # @return [String] text
70
66
  def plain_rubocop_yml_text(name)
71
67
  ["AllCops:",
72
- "\tExclude:",
73
- "\t\t- Gemfile",
74
- "\t\t- test/*",
75
- "\t\t- Rakefile",
76
- "\t\t- #{name}.gemspec",
77
- "\t\t- bin/*"].join("\n")
68
+ "\s\sExclude:",
69
+ "\s\s\s\s- Gemfile",
70
+ "\s\s\s\s- test/*",
71
+ "\s\s\s\s- Rakefile",
72
+ "\s\s\s\s- #{name}.gemspec",
73
+ "\s\s\s\s- bin/*"].join("\n")
78
74
  end
79
75
  end
80
76
  end
@@ -8,12 +8,12 @@ module RocketApi
8
8
  "task default: %i[test rubocop]\n",
9
9
  "require 'rake/testtask'",
10
10
  "Rake::TestTask.new do |test|",
11
- "\ttest.libs << 'test'",
11
+ "\s\stest.libs << 'test'",
12
12
  "end\n",
13
13
  "require 'rubocop/rake_task'",
14
14
  "RuboCop::RakeTask.new do |task|",
15
- "\ttask.fail_on_error = true",
16
- "\ttask.requires << 'rubocop-rake'",
15
+ "\s\stask.fail_on_error = true",
16
+ "\s\stask.requires << 'rubocop-rake'",
17
17
  "end"].join("\n")
18
18
  end
19
19
  end
@@ -0,0 +1,113 @@
1
+ require "rocket_api/constants"
2
+
3
+ module RocketApi
4
+ module Library
5
+ module RackRepoPlainText
6
+ def rack_routes_text
7
+ ["module Constants",
8
+ "\s\smodule Routes",
9
+ "\s\s\s\sPING = \"/ping.json\".freeze",
10
+ "\s\s\s\sMESSAGE_COUNT = \"/greeting.json\".freeze",
11
+ "\s\send",
12
+ "end"].join("\n")
13
+ end
14
+
15
+ def rack_base_controller_text
16
+ ["class BaseController",
17
+ "\s\sdef initialize(request)",
18
+ "\s\s\s\s@request = request",
19
+ "\s\send\n",
20
+ "\s\sdef ping",
21
+ "\s\s\s\sbuild_response(\"pong\")",
22
+ "\s\send\n",
23
+ "\s\sprivate\n",
24
+ "\s\sdef build_response(body, status: 200)",
25
+ "\s\s\s\s[status, { \"Content-Type\" => \"text/json\" }, [body]]",
26
+ "\s\send",
27
+ "end"].join("\n")
28
+ end
29
+
30
+ def rack_config_ru
31
+ ["require_relative \"config/application\"",
32
+ "require_all \"./config/app\"\n",
33
+ "secret_key = SecureRandom.hex(32)",
34
+ "use Rack::Session::Cookie, secret: secret_key, same_site: true, max_age: 86400\n",
35
+ "run Rack::URLMap.new('/' => Rack::Builder.new { run App.new })"].join("\n")
36
+ end
37
+
38
+ def rack_app_text
39
+ ["class App",
40
+ "#{TAB}def call(env)",
41
+ "#{DOUBLE_TAB}request = Rack::Request.new(env)",
42
+ "#{DOUBLE_TAB}serve_request(request)",
43
+ "#{TAB}end\n",
44
+ "#{TAB}def serve_request(request)",
45
+ "#{DOUBLE_TAB}Router.new(request).route!",
46
+ "#{TAB}end",
47
+ "end"].join("\n")
48
+ end
49
+
50
+ def rack_router_text
51
+ ["class Router",
52
+ "#{TAB}def initialize(request)",
53
+ "#{DOUBLE_TAB}@request = request",
54
+ "#{TAB}end\n",
55
+ "#{TAB}def route!",
56
+ "#{DOUBLE_TAB}return controller.not_found unless @request.post?\n",
57
+ "#{DOUBLE_TAB}case @request.path",
58
+ "#{DOUBLE_TAB}when Constants::Routes::PING",
59
+ "#{DOUBLE_TAB}#{TAB}controller.ping",
60
+ "#{DOUBLE_TAB}else",
61
+ "#{DOUBLE_TAB}#{TAB}controller.not_found",
62
+ "#{DOUBLE_TAB}end",
63
+ "#{TAB}end\n",
64
+ "#{TAB}private\n",
65
+ "#{TAB}def controller",
66
+ "#{DOUBLE_TAB}@controller ||= BaseController.new(@request)",
67
+ "#{TAB}end\n",
68
+ "#{TAB}def params",
69
+ "#{DOUBLE_TAB}JSON.parse(@request.body.read)",
70
+ "#{TAB}end",
71
+ "end"].join("\n")
72
+ end
73
+
74
+ def rack_initializers_text
75
+ ["# frozen_string_literal: true\n",
76
+ "require \"config\"\n",
77
+ "Config.setup do |config|",
78
+ "#{TAB}config.const_name = \"Settings\"",
79
+ "#{TAB}config.use_env = false",
80
+ "end\n",
81
+ "env = ::ActiveSupport::StringInquirer.new(ENV[\"RACK_ENV\"] || \"development\")",
82
+ "path = Dir.pwd << (\"/config\")",
83
+ "Config.load_and_set_settings(Config.setting_files(path, env))\n",
84
+ "Settings.env = env"].join("\n")
85
+ end
86
+
87
+ def rack_application_text
88
+ ["# frozen_string_literal: true\n",
89
+ "# require gems",
90
+ "require \"bundler\"",
91
+ "Bundler.require(:default, ENV[\"RACK_ENV\"] || \"development\")\n",
92
+ "require \"simplecov\" if ENV[\"COVERAGE\"]\n",
93
+ "# require additional gem files",
94
+ "require \"active_support/all\"\n",
95
+ "# initialize application, logger, gems, etc.",
96
+ "require_all \"config/initializers\"\n",
97
+ "# require application\n",
98
+ "require_all \"app\""].join("\n")
99
+ end
100
+
101
+ def rack_gemfile_text
102
+ ["source 'https://rubygems.org/'",
103
+ "ruby 'RUBY_VERSION'\n",
104
+ "gem 'rack', 'VERSION'",
105
+ "gem 'rack-parser'",
106
+ "gem 'rake', 'VERSION'",
107
+ "gem 'require_all', '~> VERSION'",
108
+ "gem 'activesupport', '~> VERSION'",
109
+ "gem 'config', '~> VERSION'"].join("\n")
110
+ end
111
+ end
112
+ end
113
+ end
@@ -2,38 +2,36 @@ require "rocket_api/commands/files"
2
2
  require "rocket_api/commands/dirs"
3
3
  require "rocket_api/commands/gems_dir"
4
4
  require "rocket_api/commands/helper"
5
+ require "rocket_api/commands/rack_dir"
5
6
  require "rocket_api/library/gem_repo_plain_text"
7
+ require "rocket_api/library/rack_repo_plain_text"
6
8
  require "rocket_api/library/helper_plain_text"
7
9
 
8
10
  module RocketApi
9
11
  class RocketCommands
10
12
  extend RocketApi::Commands::Files
11
13
  extend RocketApi::Commands::Dirs
12
- extend RocketApi::Commands::GemsDir
13
14
  extend RocketApi::Commands::Helper
14
- extend RocketApi::Library::GemRepoPlainText
15
+ extend RocketApi::Commands::GemsDir
16
+ extend RocketApi::Commands::RackDir
15
17
  extend RocketApi::Library::HelperPlainText
18
+ extend RocketApi::Library::GemRepoPlainText
19
+ extend RocketApi::Library::RackRepoPlainText
16
20
 
17
21
  # @param [Hah] options
18
- # ...
19
22
  # @raise [RocketApi::CreateDirError]
20
- def self.init_gem_dir(**_options)
21
- raise GEM_DETECTED unless Dir.glob("*.gemspec").empty?
22
-
23
- create_repo(RocketApi::GEM_PROJECTS_DIR)
23
+ def self.init_dirs(**options)
24
+ create_repo(options[:collection])
24
25
  rescue StandardError => e
25
26
  raise RocketApi::CreateDirError,
26
27
  "#{RocketApi::CREATE_FAILED} #{e.message}"
27
28
  end
28
29
 
29
30
  # @param [Hash] options
30
- # ...
31
31
  # @raise [RocketApi::InitFilesError] error
32
- def self.init_gem_files(**options)
33
- raise RocketApi::EMPTY_NAME if options[:project_name].nil?
34
-
32
+ def self.init_files(**options)
35
33
  project_name = options[:project_name]
36
- RocketApi::GEM_COMMANDS.each { |command| send(command, project_name) }
34
+ options[:collection].each { |command| send(command, project_name) }
37
35
  rescue StandardError => e
38
36
  raise RocketApi::InitFilesError,
39
37
  "#{RocketApi::INIT_FAIL} #{e.message}"
@@ -1,3 +1,3 @@
1
1
  module RocketApi
2
- VERSION = "0.0.1.8".freeze
2
+ VERSION = "0.0.1.9".freeze
3
3
  end
data/lib/rocket_api.rb CHANGED
@@ -3,6 +3,8 @@ require "rocket_api/constants"
3
3
  require "rocket_api/errors"
4
4
  require "rocket_api/commands/files"
5
5
  require "rocket_api/commands/dirs"
6
+ require "rocket_api/commands/rack_dir"
6
7
  require "rocket_api/commands/gems_dir"
7
8
  require "rocket_api/commands/helper"
8
9
  require "rocket_api/library/gem_repo_plain_text"
10
+ require "rocket_api/library/rack_repo_plain_text"
data/rocket_api.gemspec CHANGED
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
21
21
  s.email = "ilyafulleveline@gmail.com"
22
22
  s.homepage = "https://github.com/ikondratev/rocket_api"
23
23
  s.files = `git ls-files`.split($RS)
24
+ s.add_dependency "bundler", "~> 2"
24
25
  s.add_dependency "rubocop", "~> 1.26"
25
26
  s.add_dependency "rubocop-rake"
27
+ s.add_dependency "rspec", "~> 3.0"
26
28
  end
@@ -0,0 +1,21 @@
1
+ require "rocket_api/rocket_commands"
2
+ require "rocket_api/errors"
3
+ require "rocket_api/constants"
4
+
5
+ RSpec.describe RocketApi::RocketCommands do
6
+ context "#init_gem_files" do
7
+ context "in case of empty file name" do
8
+ it "should raise RocketApi::InitFilesError" do
9
+ expect{ RocketApi::RocketCommands.init_files({}) }.to raise_error(RocketApi::InitFilesError)
10
+ end
11
+ end
12
+ end
13
+
14
+ context "#init_gem_dir" do
15
+ context "in case of not empty dir" do
16
+ it "should raise RocketApi::CreateDirError" do
17
+ expect{ RocketApi::RocketCommands.init_dirs({}) }.to raise_error(RocketApi::CreateDirError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ require "rocket_api/version"
2
+
3
+ RSpec.describe RocketApi do
4
+ it "has a valid version number" do
5
+ expect(Gem::Version.new(RocketApi::VERSION).class).to eq(Gem::Version)
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require "bundler/setup"
2
+ require "rocket_api"
3
+
4
+ RSpec.configure do |config|
5
+ config.example_status_persistance_file_path = ".rspec_status"
6
+ config.disable_monkey_patching!
7
+ config.expect_with :rspec do |c|
8
+ c.syntax = :expect
9
+ end
10
+ end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.8
4
+ version: 0.0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Kondratev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rubocop
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,20 @@ dependencies:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
41
69
  description: |-
42
70
  Initialize directory with gem's structure.
43
71
  Include:
@@ -64,14 +92,18 @@ files:
64
92
  - lib/rocket_api/commands/files.rb
65
93
  - lib/rocket_api/commands/gems_dir.rb
66
94
  - lib/rocket_api/commands/helper.rb
95
+ - lib/rocket_api/commands/rack_dir.rb
67
96
  - lib/rocket_api/constants.rb
68
97
  - lib/rocket_api/errors.rb
69
98
  - lib/rocket_api/library/gem_repo_plain_text.rb
70
99
  - lib/rocket_api/library/helper_plain_text.rb
100
+ - lib/rocket_api/library/rack_repo_plain_text.rb
71
101
  - lib/rocket_api/rocket_commands.rb
72
102
  - lib/rocket_api/version.rb
73
103
  - rocket_api.gemspec
74
- - test/test_version.rb
104
+ - spec/rocket_api/rocket_commands_spec.rb
105
+ - spec/rocket_api_spec.rb
106
+ - spec/spec_helper.rb
75
107
  homepage: https://github.com/ikondratev/rocket_api
76
108
  licenses:
77
109
  - MIT
data/test/test_version.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'rocket_api/version'
3
-
4
- class TestVersion < Minitest::Test
5
- include RocketApi
6
- def test_ping
7
- assert_equal("0.0.1.8", RocketApi::VERSION)
8
- end
9
- end