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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a30c6facce7f08fa3fa1c15c953608cf2898a252
4
- data.tar.gz: 30e89c5be621ab385ca7c4a89dafd37c03b44380
3
+ metadata.gz: d6e54341bbb5cf3fa51aea16ffd82dcf84e4bbac
4
+ data.tar.gz: 32e916ae45c2eb96aa418c23e77a3871ee2638ca
5
5
  SHA512:
6
- metadata.gz: 145aa88c61cc219856daa806b8ea993c70953b707c9802e5ca30e882cdb897d578514ee0dccc96c0d521a81c3074b761651f792c8c91ccfc2073859870cbf2a3
7
- data.tar.gz: 6d2dfa844d032d2d494d42babfa7c935cc933dc9c99f9f7c2c02ab103679e3a45ac2d2aabe0809aca75e1c531f36a54d13d162ee916b94e3dec1c9fd1b9cb782
6
+ metadata.gz: 6ee778d5a0b8d0e182c5a66030ad2cf34a5603915a5c2515a4e5571534d6c43df9625a38b13e6f0fddb51e41e4103b4c23c9815b6db7d7c543f9f9319ba27b03
7
+ data.tar.gz: 7896718b8b203b732e38ddedf1d11edf523235fa891fd8f662ea90a864f7d1818beef3ab2808a5724921d8bcc4e73442502c85b4b6f8d86a4f0250dd9829b8f5
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
- gem 'pry'
3
- gem 'jazz_hands'
4
2
  gem 'awesome_print'
5
3
  gem 'activerecord'
6
4
  gem 'sqlite3'
7
5
  gem 'thread_safe'
6
+ gem 'pry', "~> 0.10.0"
7
+ gem 'pry-byebug'
data/Gemfile.lock CHANGED
@@ -1,109 +1,42 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- actionpack (4.1.7)
5
- actionview (= 4.1.7)
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
- erubis (~> 2.7.0)
13
- activemodel (4.1.7)
14
- activesupport (= 4.1.7)
15
- builder (~> 3.1)
16
- activerecord (4.1.7)
17
- activemodel (= 4.1.7)
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.1)
15
+ thread_safe (~> 0.3, >= 0.3.4)
25
16
  tzinfo (~> 1.1)
26
- arel (5.0.1.20140414130214)
27
- awesome_print (1.2.0)
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.8.9)
33
- coolline (0.5.0)
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
- mime-types (1.25.1)
66
- minitest (5.4.2)
67
- posix-spawn (0.3.9)
68
- pry (0.9.12.6)
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-debugger (0.2.3)
73
- debugger (~> 1.3)
74
- pry (>= 0.9.10, < 0.11.0)
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
- thor (0.19.1)
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
- jazz_hands
115
- pry
47
+ pry (~> 0.10.0)
48
+ pry-byebug
116
49
  sqlite3
117
50
  thread_safe
@@ -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'] || 'development'
7
- VERSION = ENV['VERSION'] || nil
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
- APP_NAME = ENV['APP_NAME'] || Inflector::classify(File.basename(FileUtils.pwd))
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
- puts "#{klass} #{args.length > 1 ? args[1..-1] : ''}"
14
- Dir["./*/*.rb"].each{|file| require file } if klass.name != "Storm::Init"
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
@@ -1,4 +1,4 @@
1
- require "#{Storm::STORM_DIR}/generators/db/db_command"
1
+ require_relative "db_command"
2
2
 
3
3
  module Storm::Db
4
4
  class Create < Storm::DBCommand
@@ -1,4 +1,4 @@
1
- require "#{Storm::STORM_DIR}/generators/db/db_command"
1
+ require_relative "db_command"
2
2
 
3
3
  module Storm::Db
4
4
  class Drop < Storm::DBCommand
@@ -16,7 +16,7 @@ module Storm::Db
16
16
  col_type ||= "string"
17
17
  " t.#{col_type} :#{::Inflector::singularize(::Inflector::tableize(col_name))}"
18
18
  end,
19
- " t.timestamps",
19
+ " t.timestamps(null: false)",
20
20
  " end",
21
21
  " end",
22
22
  "end"].flatten
@@ -1,11 +1,11 @@
1
- require "#{Storm::STORM_DIR}/generators/db/db_command"
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::VERSION && Storm::VERSION.to_i
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
@@ -1,5 +1,6 @@
1
1
  module Storm::Db
2
2
  class Storm::MigrationGenerator
3
+ require 'active_record'
3
4
  def self.next_migration_file_name(args)
4
5
  ::Inflector::tableize("#{Time.now.strftime("%Y%m%d%H%M%S")}_#{self.name.split("::").last}_#{args[0]}")+".rb"
5
6
  end
@@ -1,4 +1,4 @@
1
- require "#{Storm::STORM_DIR}/generators/db/db_command"
1
+ require_relative "db_command"
2
2
 
3
3
  module Storm::Db
4
4
  class Rollback < Storm::DBCommand
@@ -1,4 +1,4 @@
1
- require "#{Storm::STORM_DIR}/generators/db/db_command"
1
+ require_relative "db_command"
2
2
 
3
3
  module Storm::Db
4
4
  class Version < Storm::DBCommand
data/generators/init.rb CHANGED
@@ -33,7 +33,7 @@ gem 'ruby_storm'
33
33
  File.open("./#{dir_name}/#{file_name}", "w+") do |f|
34
34
  f.puts "\
35
35
  class #{class_name}
36
- def self.main(env)
36
+ def self.main(env, args)
37
37
  end
38
38
  end
39
39
  "
@@ -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
+
@@ -1,8 +1,11 @@
1
1
  module Storm
2
2
  class Version
3
3
  def self.to_s(*args)
4
- "0.0.4"
4
+ "0.0.7"
5
+ end
6
+
7
+ def self.start(*args)
8
+ puts self
5
9
  end
6
- alias_method :start, :to_s
7
10
  end
8
11
  end
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 = ['stormc', 'storm']
14
+ s.executables = ['storm']
15
15
 
16
16
  s.add_runtime_dependency 'pry', '~> 0.10'
17
- s.add_runtime_dependency 'jazz_hands', '~> 0.5'
18
- s.add_runtime_dependency 'awesome_print', '~> 1.0'
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
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: jazz_hands
28
+ name: pry-byebug
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
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: '0.5'
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.0'
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.0'
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
- - bin/storm_console
128
- - bin/stormc
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:
@@ -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
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- Kernel::exec "bundle exec #{File.expand_path("./../storm_console", __FILE__)}"
3
-
4
-