ruby_storm 0.0.4 → 0.0.7
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 +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +25 -92
- data/application/application.rb +17 -4
- data/bin/storm +10 -3
- data/generators/app.rb +18 -0
- data/generators/console.rb +47 -0
- data/generators/db/create.rb +1 -1
- data/generators/db/drop.rb +1 -1
- data/generators/db/generate.rb +1 -1
- data/generators/db/migrate.rb +2 -2
- data/generators/db/migration_generator.rb +1 -0
- data/generators/db/rollback.rb +1 -1
- data/generators/db/version.rb +1 -1
- data/generators/init.rb +1 -1
- data/generators/start.rb +18 -0
- data/generators/version.rb +5 -2
- data/ruby_storm.gemspec +3 -3
- metadata +9 -11
- data/application/jazz_hands.rb +0 -58
- data/bin/storm_console +0 -19
- data/bin/stormc +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6e54341bbb5cf3fa51aea16ffd82dcf84e4bbac
|
|
4
|
+
data.tar.gz: 32e916ae45c2eb96aa418c23e77a3871ee2638ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ee778d5a0b8d0e182c5a66030ad2cf34a5603915a5c2515a4e5571534d6c43df9625a38b13e6f0fddb51e41e4103b4c23c9815b6db7d7c543f9f9319ba27b03
|
|
7
|
+
data.tar.gz: 7896718b8b203b732e38ddedf1d11edf523235fa891fd8f662ea90a864f7d1818beef3ab2808a5724921d8bcc4e73442502c85b4b6f8d86a4f0250dd9829b8f5
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,109 +1,42 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
activesupport (= 4.1.7)
|
|
7
|
-
rack (~> 1.5.2)
|
|
8
|
-
rack-test (~> 0.6.2)
|
|
9
|
-
actionview (4.1.7)
|
|
10
|
-
activesupport (= 4.1.7)
|
|
4
|
+
activemodel (4.2.0)
|
|
5
|
+
activesupport (= 4.2.0)
|
|
11
6
|
builder (~> 3.1)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
activesupport (= 4.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
activesupport (= 4.1.7)
|
|
19
|
-
arel (~> 5.0.0)
|
|
20
|
-
activesupport (4.1.7)
|
|
21
|
-
i18n (~> 0.6, >= 0.6.9)
|
|
7
|
+
activerecord (4.2.0)
|
|
8
|
+
activemodel (= 4.2.0)
|
|
9
|
+
activesupport (= 4.2.0)
|
|
10
|
+
arel (~> 6.0)
|
|
11
|
+
activesupport (4.2.0)
|
|
12
|
+
i18n (~> 0.7)
|
|
22
13
|
json (~> 1.7, >= 1.7.7)
|
|
23
14
|
minitest (~> 5.1)
|
|
24
|
-
thread_safe (~> 0.
|
|
15
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
25
16
|
tzinfo (~> 1.1)
|
|
26
|
-
arel (
|
|
27
|
-
awesome_print (1.
|
|
28
|
-
binding_of_caller (0.7.2)
|
|
29
|
-
debug_inspector (>= 0.0.1)
|
|
17
|
+
arel (6.0.0)
|
|
18
|
+
awesome_print (1.6.1)
|
|
30
19
|
builder (3.2.2)
|
|
20
|
+
byebug (4.0.2)
|
|
21
|
+
columnize (= 0.9.0)
|
|
31
22
|
coderay (1.1.0)
|
|
32
|
-
columnize (0.
|
|
33
|
-
|
|
34
|
-
unicode_utils (~> 1.4)
|
|
35
|
-
debug_inspector (0.0.2)
|
|
36
|
-
debugger (1.6.8)
|
|
37
|
-
columnize (>= 0.3.1)
|
|
38
|
-
debugger-linecache (~> 1.2.0)
|
|
39
|
-
debugger-ruby_core_source (~> 1.3.5)
|
|
40
|
-
debugger-linecache (1.2.0)
|
|
41
|
-
debugger-ruby_core_source (1.3.5)
|
|
42
|
-
diff-lcs (1.2.5)
|
|
43
|
-
diffy (3.0.7)
|
|
44
|
-
erubis (2.7.0)
|
|
45
|
-
grit (2.5.0)
|
|
46
|
-
diff-lcs (~> 1.1)
|
|
47
|
-
mime-types (~> 1.15)
|
|
48
|
-
posix-spawn (~> 0.3.6)
|
|
49
|
-
hirb (0.7.2)
|
|
50
|
-
i18n (0.6.11)
|
|
51
|
-
jazz_hands (0.5.2)
|
|
52
|
-
awesome_print (~> 1.2)
|
|
53
|
-
coolline (>= 0.4.2)
|
|
54
|
-
hirb (~> 0.7.1)
|
|
55
|
-
pry (~> 0.9.12)
|
|
56
|
-
pry-debugger (~> 0.2.2)
|
|
57
|
-
pry-doc (~> 0.4.6)
|
|
58
|
-
pry-git (~> 0.2.3)
|
|
59
|
-
pry-rails (~> 0.3.2)
|
|
60
|
-
pry-remote (>= 0.1.7)
|
|
61
|
-
pry-stack_explorer (~> 0.4.9)
|
|
62
|
-
railties (>= 3.0, < 5.0)
|
|
23
|
+
columnize (0.9.0)
|
|
24
|
+
i18n (0.7.0)
|
|
63
25
|
json (1.8.1)
|
|
64
26
|
method_source (0.8.2)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
coderay (~> 1.0)
|
|
70
|
-
method_source (~> 0.8)
|
|
27
|
+
minitest (5.5.1)
|
|
28
|
+
pry (0.10.1)
|
|
29
|
+
coderay (~> 1.1.0)
|
|
30
|
+
method_source (~> 0.8.1)
|
|
71
31
|
slop (~> 3.4)
|
|
72
|
-
pry-
|
|
73
|
-
|
|
74
|
-
pry (
|
|
75
|
-
pry-doc (0.4.6)
|
|
76
|
-
pry (>= 0.9)
|
|
77
|
-
yard (>= 0.8)
|
|
78
|
-
pry-git (0.2.3)
|
|
79
|
-
diffy
|
|
80
|
-
grit
|
|
81
|
-
pry (>= 0.9.8)
|
|
82
|
-
pry-rails (0.3.2)
|
|
83
|
-
pry (>= 0.9.10)
|
|
84
|
-
pry-remote (0.1.8)
|
|
85
|
-
pry (~> 0.9)
|
|
86
|
-
slop (~> 3.0)
|
|
87
|
-
pry-stack_explorer (0.4.9.1)
|
|
88
|
-
binding_of_caller (>= 0.7)
|
|
89
|
-
pry (>= 0.9.11)
|
|
90
|
-
rack (1.5.2)
|
|
91
|
-
rack-test (0.6.2)
|
|
92
|
-
rack (>= 1.0)
|
|
93
|
-
railties (4.1.7)
|
|
94
|
-
actionpack (= 4.1.7)
|
|
95
|
-
activesupport (= 4.1.7)
|
|
96
|
-
rake (>= 0.8.7)
|
|
97
|
-
thor (>= 0.18.1, < 2.0)
|
|
98
|
-
rake (10.3.2)
|
|
32
|
+
pry-byebug (3.1.0)
|
|
33
|
+
byebug (~> 4.0)
|
|
34
|
+
pry (~> 0.10)
|
|
99
35
|
slop (3.6.0)
|
|
100
36
|
sqlite3 (1.3.10)
|
|
101
|
-
|
|
102
|
-
thread_safe (0.3.4)
|
|
37
|
+
thread_safe (0.3.5)
|
|
103
38
|
tzinfo (1.2.2)
|
|
104
39
|
thread_safe (~> 0.1)
|
|
105
|
-
unicode_utils (1.4.0)
|
|
106
|
-
yard (0.8.7.6)
|
|
107
40
|
|
|
108
41
|
PLATFORMS
|
|
109
42
|
ruby
|
|
@@ -111,7 +44,7 @@ PLATFORMS
|
|
|
111
44
|
DEPENDENCIES
|
|
112
45
|
activerecord
|
|
113
46
|
awesome_print
|
|
114
|
-
|
|
115
|
-
pry
|
|
47
|
+
pry (~> 0.10.0)
|
|
48
|
+
pry-byebug
|
|
116
49
|
sqlite3
|
|
117
50
|
thread_safe
|
data/application/application.rb
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
require 'fileutils'
|
|
3
|
+
require_relative '../generators/version'
|
|
3
4
|
|
|
4
5
|
module Storm
|
|
5
|
-
STORM_DIR = "#{File.dirname(__FILE__)}/../"
|
|
6
|
-
STORM_ENV = ENV['DATABASE_ENV']
|
|
7
|
-
|
|
6
|
+
STORM_DIR = File.expand_path("#{File.dirname(__FILE__)}/../")
|
|
7
|
+
STORM_ENV = ENV['DATABASE_ENV'] || 'development'
|
|
8
|
+
DB_VERSION = ENV['DB_VERSION'] || nil
|
|
8
9
|
DATABASE_DIR = ENV['DATABASE_DIR'] || './db'
|
|
10
|
+
APP_NAME = ENV['APP_NAME'] || Inflector::classify(File.basename(FileUtils.pwd))
|
|
9
11
|
MIGRATIONS_DIR = "#{DATABASE_DIR}/migrate"
|
|
10
12
|
APP_DIR = File.expand_path("./")
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
def self.env
|
|
15
|
+
STORM_ENV
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.version
|
|
19
|
+
Storm::Version.to_s
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.app_name
|
|
23
|
+
APP_NAME
|
|
24
|
+
end
|
|
12
25
|
end
|
data/bin/storm
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
require 'thread_safe'
|
|
3
3
|
|
|
4
4
|
module Storm
|
|
5
|
+
|
|
5
6
|
require File.expand_path("./../../application/inflector", __FILE__)
|
|
6
7
|
require File.expand_path("./../../application/application", __FILE__)
|
|
7
8
|
|
|
@@ -9,9 +10,15 @@ module Storm
|
|
|
9
10
|
begin
|
|
10
11
|
names = namespace.to_s.split(':')
|
|
11
12
|
generator(names)
|
|
13
|
+
|
|
12
14
|
if klass = generator(names)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
Dir["./*/*.rb"].each{|file| require file } unless [
|
|
16
|
+
"Storm::Init",
|
|
17
|
+
"Storm::Console",
|
|
18
|
+
"Storm::Start",
|
|
19
|
+
"Storm::App",
|
|
20
|
+
"Storm::Version"
|
|
21
|
+
].include? klass.name
|
|
15
22
|
klass.start(args[1..-1])
|
|
16
23
|
else
|
|
17
24
|
puts "Could not find generator '#{names}'. "
|
|
@@ -27,9 +34,9 @@ module Storm
|
|
|
27
34
|
generators_and_paths = names.map{|name|
|
|
28
35
|
[name.capitalize,name.downcase]
|
|
29
36
|
}
|
|
37
|
+
|
|
30
38
|
klass = "::Storm::"+generators_and_paths.map(&:first).join("::")
|
|
31
39
|
path = File.expand_path("./../../generators/#{generators_and_paths.map(&:last).join("/")}.rb", __FILE__)
|
|
32
|
-
|
|
33
40
|
if File.exists?(path)
|
|
34
41
|
require path
|
|
35
42
|
return eval(klass)
|
data/generators/app.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
|
|
3
|
+
module Storm
|
|
4
|
+
class App
|
|
5
|
+
def self.start(args)
|
|
6
|
+
require 'thread_safe'
|
|
7
|
+
require 'active_record'
|
|
8
|
+
require "awesome_print"
|
|
9
|
+
require 'bundler'
|
|
10
|
+
::Bundler.require(:default, :development)
|
|
11
|
+
Dir["./**/*.rb"].each{|file| next if /db\/migrate/ =~ file; require file }
|
|
12
|
+
project_name = File.basename(Dir.pwd)
|
|
13
|
+
class_name = Inflector::classify(project_name)
|
|
14
|
+
Inflector::constantize(class_name).send(ARGV[1], ARGV[2..-1])
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Storm
|
|
2
|
+
class Console
|
|
3
|
+
|
|
4
|
+
def self.reload!
|
|
5
|
+
@@reload = true
|
|
6
|
+
exit
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.start(*args)
|
|
10
|
+
reload_proc = proc{ Storm::Console.start(*args) }
|
|
11
|
+
|
|
12
|
+
require 'thread_safe'
|
|
13
|
+
require 'active_record'
|
|
14
|
+
require "awesome_print"
|
|
15
|
+
require 'bundler'
|
|
16
|
+
|
|
17
|
+
::Bundler.require(:default, :development)
|
|
18
|
+
Dir["./**/*.rb"].each{|file| next if /db\/migrate/ =~ file; require file }
|
|
19
|
+
|
|
20
|
+
require File.expand_path("./../../application/inflector", __FILE__)
|
|
21
|
+
require File.expand_path("./../../application/application", __FILE__)
|
|
22
|
+
|
|
23
|
+
ActiveRecord::Base.establish_connection YAML.load_file('./db/databases.yml')[Storm::STORM_ENV] rescue nil
|
|
24
|
+
ARGV.clear
|
|
25
|
+
begin
|
|
26
|
+
require 'pry'
|
|
27
|
+
Pry.color = true
|
|
28
|
+
load Gem.bin_path('pry', 'pry')
|
|
29
|
+
rescue Exception => e
|
|
30
|
+
if @@reload
|
|
31
|
+
@@reload = false
|
|
32
|
+
self.start(*args)
|
|
33
|
+
else
|
|
34
|
+
puts e
|
|
35
|
+
require 'irb'
|
|
36
|
+
::IRB.start
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class Object
|
|
44
|
+
def reload!
|
|
45
|
+
Storm::Console.reload!
|
|
46
|
+
end
|
|
47
|
+
end
|
data/generators/db/create.rb
CHANGED
data/generators/db/drop.rb
CHANGED
data/generators/db/generate.rb
CHANGED
data/generators/db/migrate.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative "db_command"
|
|
2
2
|
|
|
3
3
|
module Storm::Db
|
|
4
4
|
class Migrate < Storm::DBCommand
|
|
5
5
|
def self.start *_
|
|
6
6
|
self.connect
|
|
7
7
|
::ActiveRecord::Migration.verbose = true
|
|
8
|
-
::ActiveRecord::Migrator.migrate File.expand_path(Storm::MIGRATIONS_DIR), Storm::
|
|
8
|
+
::ActiveRecord::Migrator.migrate File.expand_path(Storm::MIGRATIONS_DIR), Storm::DB_VERSION && Storm::DB_VERSION.to_i
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|
data/generators/db/rollback.rb
CHANGED
data/generators/db/version.rb
CHANGED
data/generators/init.rb
CHANGED
data/generators/start.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
|
|
3
|
+
module Storm
|
|
4
|
+
class Start
|
|
5
|
+
def self.start(args)
|
|
6
|
+
require 'thread_safe'
|
|
7
|
+
require 'active_record'
|
|
8
|
+
require "awesome_print"
|
|
9
|
+
require 'bundler'
|
|
10
|
+
::Bundler.require(:default, :development)
|
|
11
|
+
Dir["./**/*.rb"].each{|file| next if /db\/migrate/ =~ file; require file }
|
|
12
|
+
project_name = File.basename(Dir.pwd)
|
|
13
|
+
class_name = Inflector::classify(project_name)
|
|
14
|
+
Inflector::constantize(class_name).main(STORM_ENV, ARGV[1..-1])
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
data/generators/version.rb
CHANGED
data/ruby_storm.gemspec
CHANGED
|
@@ -11,11 +11,11 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
|
13
13
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
14
|
-
s.executables = ['
|
|
14
|
+
s.executables = ['storm']
|
|
15
15
|
|
|
16
16
|
s.add_runtime_dependency 'pry', '~> 0.10'
|
|
17
|
-
s.add_runtime_dependency '
|
|
18
|
-
s.add_runtime_dependency 'awesome_print', '~> 1.
|
|
17
|
+
s.add_runtime_dependency 'pry-byebug', '~> 3.1'
|
|
18
|
+
s.add_runtime_dependency 'awesome_print', '~> 1.6'
|
|
19
19
|
s.add_runtime_dependency 'activerecord', '~> 4.1'
|
|
20
20
|
s.add_runtime_dependency 'sqlite3', '~> 1.3'
|
|
21
21
|
s.add_runtime_dependency 'thread_safe', '~> 0.3'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_storm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wouter Coppieters
|
|
@@ -25,33 +25,33 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0.10'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: pry-byebug
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '3.1'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '3.1'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: awesome_print
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '1.
|
|
47
|
+
version: '1.6'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '1.
|
|
54
|
+
version: '1.6'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: activerecord
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -111,7 +111,6 @@ dependencies:
|
|
|
111
111
|
description: Ruby storm is a stand alone Object Relational Mapper that wraps ActiveRecord.
|
|
112
112
|
email: wouter.coppieters@youdo.co.nz
|
|
113
113
|
executables:
|
|
114
|
-
- stormc
|
|
115
114
|
- storm
|
|
116
115
|
extensions: []
|
|
117
116
|
extra_rdoc_files: []
|
|
@@ -122,10 +121,9 @@ files:
|
|
|
122
121
|
- README.md
|
|
123
122
|
- application/application.rb
|
|
124
123
|
- application/inflector.rb
|
|
125
|
-
- application/jazz_hands.rb
|
|
126
124
|
- bin/storm
|
|
127
|
-
-
|
|
128
|
-
-
|
|
125
|
+
- generators/app.rb
|
|
126
|
+
- generators/console.rb
|
|
129
127
|
- generators/db/create.rb
|
|
130
128
|
- generators/db/db_command.rb
|
|
131
129
|
- generators/db/drop.rb
|
|
@@ -136,6 +134,7 @@ files:
|
|
|
136
134
|
- generators/db/rollback.rb
|
|
137
135
|
- generators/db/version.rb
|
|
138
136
|
- generators/init.rb
|
|
137
|
+
- generators/start.rb
|
|
139
138
|
- generators/version.rb
|
|
140
139
|
- ruby_storm.gemspec
|
|
141
140
|
- rubystorm.todo
|
|
@@ -164,4 +163,3 @@ signing_key:
|
|
|
164
163
|
specification_version: 4
|
|
165
164
|
summary: Ruby storm is a stand alone Object Relational Mapper
|
|
166
165
|
test_files: []
|
|
167
|
-
has_rdoc:
|
data/application/jazz_hands.rb
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Jazz Hands for console and debugging
|
|
3
|
-
##
|
|
4
|
-
require 'jazz_hands'
|
|
5
|
-
require 'awesome_print'
|
|
6
|
-
|
|
7
|
-
JazzHands.colored_prompt = true
|
|
8
|
-
JazzHands.enable_syntax_highlighting_as_you_type!
|
|
9
|
-
|
|
10
|
-
Pry.config.print = ->(output, value) do
|
|
11
|
-
return if JazzHands._hirb_output && Hirb::View.view_or_page_output(value)
|
|
12
|
-
pretty = value.ai(indent: 2)
|
|
13
|
-
Pry::Helpers::BaseHelpers.stagger_output("=> #{pretty}", output)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Friendlier prompt - line number, app name, nesting levels look like
|
|
17
|
-
# directory paths.
|
|
18
|
-
#
|
|
19
|
-
# Heavy use of lazy lambdas so configuration (like Pry.color) can be
|
|
20
|
-
# changed later or even during console usage.
|
|
21
|
-
#
|
|
22
|
-
# Custom color helpers using hints \001 and \002 so that good readline
|
|
23
|
-
# libraries (GNU, rb-readline) correctly ignore color codes when
|
|
24
|
-
# calculating line length.
|
|
25
|
-
|
|
26
|
-
name = Storm::APP_NAME
|
|
27
|
-
|
|
28
|
-
color = -> { Pry.color && JazzHands.colored_prompt }
|
|
29
|
-
red = ->(text) { color[] ? "\001\e[0;31m\002#{text}\001\e[0m\002" : text.to_s }
|
|
30
|
-
blue = ->(text) { color[] ? "\001\e[0;34m\002#{text}\001\e[0m\002" : text.to_s }
|
|
31
|
-
bold = ->(text) { color[] ? "\001\e[1m\002#{text}\001\e[0m\002" : text.to_s }
|
|
32
|
-
|
|
33
|
-
separator = -> { red.(JazzHands.prompt_separator) }
|
|
34
|
-
colored_name = -> { blue.(name) }
|
|
35
|
-
|
|
36
|
-
line = ->(pry) { "[#{bold.(pry.input_array.size)}] " }
|
|
37
|
-
target_string = ->(object, level) do
|
|
38
|
-
level = 0 if level < 0
|
|
39
|
-
unless (string = Pry.view_clip(object)) == 'main'
|
|
40
|
-
"(#{'../' * level}#{string})"
|
|
41
|
-
else
|
|
42
|
-
''
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
Pry.config.prompt = [
|
|
47
|
-
->(object, level, pry) do # Main prompt
|
|
48
|
-
"#{line.(pry)}#{colored_name.()}#{target_string.(object, level)} #{separator.()} "
|
|
49
|
-
end,
|
|
50
|
-
->(object, level, pry) do # Wait prompt in multiline input
|
|
51
|
-
spaces = ' ' * (
|
|
52
|
-
"[#{pry.input_array.size}] ".size + # Uncolored `line.(pry)`
|
|
53
|
-
name.size +
|
|
54
|
-
target_string.(object, level).size
|
|
55
|
-
)
|
|
56
|
-
"#{spaces} #{separator.()} "
|
|
57
|
-
end
|
|
58
|
-
]
|
data/bin/storm_console
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
Dir["./*/*.rb"].each{|file| require file }
|
|
4
|
-
|
|
5
|
-
Bundler.require(:default)
|
|
6
|
-
require 'thread_safe'
|
|
7
|
-
require 'pry'
|
|
8
|
-
require 'active_record'
|
|
9
|
-
|
|
10
|
-
require File.expand_path("./../../application/inflector", __FILE__)
|
|
11
|
-
require File.expand_path("./../../application/application", __FILE__)
|
|
12
|
-
require File.expand_path("./../../application/jazz_hands", __FILE__)
|
|
13
|
-
|
|
14
|
-
ActiveRecord::Base.establish_connection YAML.load_file('./db/databases.yml')[Storm::STORM_ENV] rescue nil
|
|
15
|
-
|
|
16
|
-
load Gem.bin_path('pry', 'pry', ">= 0.9")
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
data/bin/stormc
DELETED