adjective-rpg 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -38
- data/Thorfile +2 -2
- data/lib/tasks/migrate.thor +18 -4
- data/lib/tasks/setup.thor +44 -0
- data/lib/version.rb +1 -1
- metadata +2 -2
- data/lib/tasks/migrate_adjective.rake +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9852ba0f7c69f228cab554b4e205dc690aad38b0607d8db388e05d66788162c9
|
4
|
+
data.tar.gz: 0e027b23a3af26fafaccd1741177a5a4aa0aae925087da745924da59858cf219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a2d302a689ac9702726bed6b9397fb968d6178d41c170e1ac48c792a80bb74a9fbdc3e4db8251c99111685cc82504d08b2b1f309951a3983a3df84dd1a668f
|
7
|
+
data.tar.gz: bffa9393b756cd7571d44fef8f89c6ee6f013b2e84b04197bef069b594dcce57131a56f1bdcfb1098db92868e3e6a0b3846f9a23aaca6361e39accb956eeeb27
|
data/Rakefile
CHANGED
@@ -26,41 +26,3 @@ namespace :build do
|
|
26
26
|
# system("gem install adjective-0.1.0.gem")
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
30
|
-
namespace :adjective do
|
31
|
-
task :install do
|
32
|
-
# plain_dummy install command:
|
33
|
-
# rake adjective:install -- config_path=spec/plain_dummy/ thorfile_path=spec/plain_dummy/
|
34
|
-
|
35
|
-
# dummy install command:
|
36
|
-
# rake adjective:install -- config_path=spec/dummy/config/initializers thorfile_path=spec/dummy/
|
37
|
-
|
38
|
-
config_install_path = ARGV.find { |arg| arg.include?("config_path=") }&.split("=")&.last || "config/initializers"
|
39
|
-
thorfile_install_path = ARGV.find { |arg| arg.include?("thorfile_path=") }&.split("=")&.last || Dir.pwd
|
40
|
-
|
41
|
-
loaded_feature = $LOADED_FEATURES.find { |feature| feature.include?('adjective') }
|
42
|
-
adj_thorfile_location = File.join(File.dirname(loaded_feature), 'templates/static/Thorfile')
|
43
|
-
adj_config_location = File.join(File.dirname(loaded_feature), 'templates/static/adjective.rb')
|
44
|
-
|
45
|
-
begin
|
46
|
-
if !File.directory?(thorfile_install_path)
|
47
|
-
raise Errno::ENOENT, "Thorfile install dir not found: #{thorfile_install_path}. Please ensure that this directory exists."
|
48
|
-
end
|
49
|
-
FileUtils.cp(adj_thorfile_location, thorfile_install_path)
|
50
|
-
puts "\e[32mInstalled the Adjective Thorfile to: #{File.join(thorfile_install_path, "Thorfile")}\e[0m"
|
51
|
-
rescue => e
|
52
|
-
puts "\e[31mError occured while copying the Adjective Thorfile: #{e.message}\e[0m"
|
53
|
-
end
|
54
|
-
|
55
|
-
begin
|
56
|
-
if !File.directory?(config_install_path)
|
57
|
-
raise Errno::ENOENT, "Adjective config install dir not found: #{config_install_path}. Please ensure that this directory exists."
|
58
|
-
end
|
59
|
-
FileUtils.cp(adj_config_location, config_install_path)
|
60
|
-
puts "\e[32mInstalled the Adjective configs to: #{File.join(config_install_path, "adjective.rb")}\e[0m"
|
61
|
-
rescue => e
|
62
|
-
puts "\e[31mError occured while copying the Adjective Thorfile: #{e.message}\e[0m"
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
data/Thorfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
loaded_feature = $LOADED_FEATURES.find { |feature| feature.include?('
|
1
|
+
require "adjective"
|
2
|
+
loaded_feature = $LOADED_FEATURES.find { |feature| feature.include?('adjective') }
|
3
3
|
lib_dir = File.dirname(loaded_feature)
|
4
4
|
|
5
5
|
Dir[File.join(lib_dir, 'tasks', '**', '*.thor')].each do |thor_file|
|
data/lib/tasks/migrate.thor
CHANGED
@@ -1,4 +1,14 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'awesome_print'
|
3
|
+
# gem_lib_path = File.expand_path('../../lib', __dir__)
|
4
|
+
# require "#{gem_lib_path}/adjective"
|
5
|
+
# require "adjective"
|
6
|
+
|
7
|
+
# require_relative "../adjective"
|
8
|
+
# Adjective.configure do |config|
|
9
|
+
# ap config
|
10
|
+
# end
|
11
|
+
|
2
12
|
|
3
13
|
# These are assumed to be run from the project root dir.
|
4
14
|
|
@@ -11,15 +21,18 @@ require 'thor'
|
|
11
21
|
# thor adjective:generate:columns_for Enemy --includes Vulnerable --config spec/dummy/config/initializers/adjective --rails_load_path ../../spec/dummy/config/environment
|
12
22
|
|
13
23
|
# TODO:
|
24
|
+
|
14
25
|
# Need to set a deault path for adjective loading from a Rails project.
|
26
|
+
|
15
27
|
# Clean shit up. Lots of duplication here.
|
16
|
-
|
28
|
+
|
29
|
+
# Might need to change the app conventions around to consider Rails
|
17
30
|
|
18
31
|
module Adjective
|
19
32
|
class AdjectiveTasks < Thor
|
20
33
|
include Thor::Actions
|
21
34
|
|
22
|
-
default_rails_load_path = '
|
35
|
+
default_rails_load_path = 'config/environment'
|
23
36
|
|
24
37
|
package_name "adjective"
|
25
38
|
namespace 'adjective:generate'
|
@@ -40,7 +53,7 @@ module Adjective
|
|
40
53
|
|
41
54
|
config_file_path = ENV['ADJECTIVE_CONFIG_PATH'] ||= options[:config]
|
42
55
|
adj_configs = File.join( Dir.pwd, config_file_path)
|
43
|
-
rails_load_path = options[:rails_load_path]
|
56
|
+
rails_load_path = options[:rails_load_path] || default_rails_load_path
|
44
57
|
|
45
58
|
require adj_configs
|
46
59
|
if Adjective.configuration.use_rails
|
@@ -67,9 +80,10 @@ module Adjective
|
|
67
80
|
method_options :config => :string
|
68
81
|
method_options :rails_load_path => :string
|
69
82
|
def scaffold_for(model)
|
83
|
+
default_rails_load_path = './config/environment'
|
70
84
|
config_file_path = ENV['ADJECTIVE_CONFIG_PATH'] ||= options[:config]
|
71
85
|
adj_configs = File.join( Dir.pwd, config_file_path)
|
72
|
-
rails_load_path = options[:rails_load_path]
|
86
|
+
rails_load_path = options[:rails_load_path] || default_rails_load_path
|
73
87
|
|
74
88
|
require adj_configs
|
75
89
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Adjective
|
2
|
+
class AdjectiveSetup < Thor
|
3
|
+
# thor adjective:setup --config_path spec/file_dummy/config/initializers
|
4
|
+
|
5
|
+
include Thor::Actions
|
6
|
+
require "fileutils"
|
7
|
+
|
8
|
+
package_name "adjective"
|
9
|
+
namespace 'adjective'
|
10
|
+
|
11
|
+
desc "setup", "Creates the needed files for Adjective"
|
12
|
+
method_options :config_path => :string
|
13
|
+
method_options :thorfile_path => :string
|
14
|
+
def setup
|
15
|
+
config_install_path = options[:config_path] || "config/initializers"
|
16
|
+
thorfile_install_path = options[:thorfile_path] || Dir.pwd
|
17
|
+
template_path = File.expand_path('../templates/static/adjective.rb', __dir__)
|
18
|
+
|
19
|
+
loaded_feature = $LOADED_FEATURES.find { |feature| feature.include?('adjective') }
|
20
|
+
adj_thorfile_location = File.join(File.dirname(loaded_feature), 'templates/static/Thorfile')
|
21
|
+
adj_config_location = File.join(File.dirname(loaded_feature), 'templates/static/adjective.rb')
|
22
|
+
|
23
|
+
begin
|
24
|
+
if !File.directory?(config_install_path)
|
25
|
+
raise Errno::ENOENT, "Adjective config install dir not found: #{config_install_path}. Please ensure that this directory exists."
|
26
|
+
end
|
27
|
+
FileUtils.cp(template_path, config_install_path)
|
28
|
+
puts "\e[32mInstalled the Adjective configs to: #{File.join(config_install_path, "adjective.rb")}\e[0m"
|
29
|
+
rescue => e
|
30
|
+
puts "\e[31mError occured while copying the Adjective config: #{e.message}\e[0m"
|
31
|
+
end
|
32
|
+
|
33
|
+
begin
|
34
|
+
if !File.directory?(thorfile_install_path)
|
35
|
+
raise Errno::ENOENT, "Thorfile install dir not found: #{thorfile_install_path}. Please ensure that this directory exists."
|
36
|
+
end
|
37
|
+
FileUtils.cp(adj_thorfile_location, thorfile_install_path)
|
38
|
+
puts "\e[32mInstalled the Adjective Thorfile to: #{File.join(thorfile_install_path, "Thorfile")}\e[0m"
|
39
|
+
rescue => e
|
40
|
+
puts "\e[31mError occured while copying the Adjective Thorfile: #{e.message}\e[0m"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adjective-rpg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Maze
|
@@ -186,7 +186,7 @@ files:
|
|
186
186
|
- lib/modules/vulnerable.rb
|
187
187
|
- lib/railties.rb
|
188
188
|
- lib/tasks/migrate.thor
|
189
|
-
- lib/tasks/
|
189
|
+
- lib/tasks/setup.thor
|
190
190
|
- lib/templates/add_columns_migration.rb
|
191
191
|
- lib/templates/all_tables.rb
|
192
192
|
- lib/templates/create_adjective_class.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'adjective'
|
2
|
-
|
3
|
-
namespace :adjective do
|
4
|
-
|
5
|
-
desc 'setup the initial config for Adjective'
|
6
|
-
task :setup do
|
7
|
-
Adjective::Generators::SetupGenerator.new.copy_config
|
8
|
-
end
|
9
|
-
|
10
|
-
task :test do
|
11
|
-
ap Adjective
|
12
|
-
path = ENV['ADJECTIVE_CONFIG_PATH']
|
13
|
-
ap path
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
namespace :db do
|
18
|
-
desc 'generate all migrations from Adjective based on default settings'
|
19
|
-
task :generate_all_tables do
|
20
|
-
path = ENV['ADJECTIVE_CONFIG_PATH'] ||= "config/adjective.yml"
|
21
|
-
|
22
|
-
# Load a copy of Adjective with the correct configs.
|
23
|
-
Adjective.configure do |config|
|
24
|
-
config.set_config_file_path(path)
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
# template_migration_content = File.read('lib/templates/all_tables.rb')
|
30
|
-
# timestamp = Time.now.strftime('%Y%m%d%H%M%S')
|
31
|
-
|
32
|
-
# migration_name = "create_all_adjective_tables"
|
33
|
-
# new_migration_file_name = "#{timestamp}_#{migration_name}.rb"
|
34
|
-
# new_migration_path = File.join('db', 'migrate', new_migration_file_name)
|
35
|
-
|
36
|
-
# File.open(new_migration_path, 'w') do |file|
|
37
|
-
# file.write(template_migration_content)
|
38
|
-
# end
|
39
|
-
|
40
|
-
# puts "Created Adjective Migration at: #{new_migration_path}"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|