marty 0.5.28 → 0.5.29

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: b6599f34a4823efc8be3d05feef0d3fc937219e6
4
- data.tar.gz: 41c960a54860d1c94d2138148725fdc5575c33f0
3
+ metadata.gz: 0eb409a0b5479f611d8ee7f84c28ee00198af598
4
+ data.tar.gz: 938c7c8e7d944f883d212800c6944d80c7382755
5
5
  SHA512:
6
- metadata.gz: a7b66c7ca4c79c298aae4a82f38a20d856c83c94800575328062aba071aeb4f21f2f63b81a1af77a6ae2106eac838e694c1a9fcf0041b27922d03b3715afb88b
7
- data.tar.gz: 6394925740fc4739765409d35205a57b6fc20fafa6089686b5438b35a49839c0c2c013eb8ccf843c7b45cff6639f55b5288b68dc6b94044f88e789f08bed1586
6
+ metadata.gz: 4d81bb14296b79c16a5ce0d1b78f85a81d4128210d17b166e87d449aa4dab61a66d1c624584c855a72e6c3fa068dc930d81f86fcfb342224eb44edf4dd891a0b
7
+ data.tar.gz: 3f58c2706f595e2e0c491c0fedf633f3abf5aa2925623d5d5f3ba30c52f4fa83a3578ef9555f193355dbb1414e6c3f5f38b4d09e775beed0728d2ac0230ed492
data/.gitignore CHANGED
@@ -25,3 +25,4 @@ spec/dummy/.sass-cache
25
25
  *.swp
26
26
 
27
27
  /spec/dummy/public/extjs
28
+ .rspec-results
@@ -1,5 +1,3 @@
1
- require 'marty/permissions'
2
-
3
1
  # Netzke Form with Marty permissions
4
2
  class Marty::Form < Netzke::Basepack::Form
5
3
  extend ::Marty::Permissions
@@ -1,4 +1,3 @@
1
- require 'marty/permissions'
2
1
  require 'marty/scripting'
3
2
  require 'marty/reporting'
4
3
  require 'marty/posting_window'
@@ -1,5 +1,3 @@
1
- require 'delorean_lang'
2
-
3
1
  class Marty::ReportForm < Marty::Form
4
2
 
5
3
  # override apply for background generation
@@ -1,6 +1,3 @@
1
- require 'delorean_lang'
2
- require 'coderay'
3
-
4
1
  class Marty::ScriptForm < Marty::Form
5
2
  DASH = 0x2012.chr('utf-8')
6
3
 
@@ -1,5 +1,3 @@
1
- require 'mcfly'
2
-
3
1
  class Marty::ApiAuth < Marty::Base
4
2
  has_mcfly
5
3
 
@@ -1,5 +1,3 @@
1
- require 'mcfly'
2
-
3
1
  class Marty::Script < Marty::Base
4
2
  has_mcfly
5
3
 
@@ -1,6 +1,3 @@
1
- require 'mcfly'
2
- require 'net/ldap'
3
-
4
1
  class Marty::User < Marty::Base
5
2
  validates_presence_of :login, :firstname, :lastname
6
3
  validates_uniqueness_of :login
@@ -1,5 +1,3 @@
1
- require 'netzke-core'
2
-
3
1
  Marty::Engine.routes.draw do
4
2
  match via: [:get, :post], "rpc/:action(.:format)" => "rpc", as: :rpc
5
3
  get "job/:action" => "job", as: :job
@@ -1,5 +1,3 @@
1
- require 'mcfly'
2
-
3
1
  class CreateMartyScripts < McflyMigration
4
2
  include Marty::Migrations
5
3
 
@@ -1,5 +1,3 @@
1
- require 'marty/migrations'
2
-
3
1
  class CreateMartyPostings < McflyAppendOnlyMigration
4
2
  include Marty::Migrations
5
3
 
@@ -1,5 +1,3 @@
1
- require 'marty/migrations'
2
-
3
1
  class CreateMartyPromises < ActiveRecord::Migration
4
2
  include Marty::Migrations
5
3
 
@@ -1,5 +1,3 @@
1
- require 'marty/migrations'
2
-
3
1
  class CreateMartyTags < McflyAppendOnlyMigration
4
2
  include Marty::Migrations
5
3
 
@@ -1,5 +1,3 @@
1
- require 'mcfly'
2
-
3
1
  class CreateMartyApiAuths < McflyMigration
4
2
  include Marty::Migrations
5
3
 
@@ -1,19 +1,15 @@
1
1
  # Do not change order of require, since there are some dependencies
2
- # Do not require 'marty/permissions' - it relies on Rails being loaded first
3
- require 'marty/railtie'
2
+ #
3
+ # Do not include anything here that will be properly autoloaded by Rails - This
4
+ # would be any file that define a properly namespaced module/class as Marty::<filename>
5
+ # and that don't run code outside of that module/class
6
+ #
7
+ # Also note that anything required here will need to require in any classes that
8
+ # they might be overriding methods in
9
+
4
10
  require 'marty/engine'
5
- require 'marty/monkey'
11
+ require 'marty/railtie'
6
12
  require 'marty/mcfly_query'
7
- require 'marty/util'
8
- require 'marty/migrations'
9
- require 'marty/data_exporter'
10
- require 'marty/xl.rb'
11
- require 'marty/data_conversion'
12
- require 'marty/data_importer'
13
- require 'marty/data_change'
14
- require 'marty/relation'
13
+ require 'marty/monkey'
15
14
  require 'marty/promise_job'
16
- require 'marty/promise_proxy'
17
- require 'marty/content_handler'
18
15
  require 'marty/lazy_column_loader'
19
- require 'marty/version'
@@ -1,5 +1,3 @@
1
- require 'csv'
2
-
3
1
  module Marty::ContentHandler
4
2
  GEN_FORMATS = {
5
3
  "csv" => ['text/csv', 'download'],
@@ -1,5 +1,3 @@
1
- require 'delorean_lang'
2
-
3
1
  class Marty::DataChange
4
2
  include Delorean::Model
5
3
 
@@ -1,5 +1,3 @@
1
- require 'mcfly'
2
-
3
1
  class Marty::DataConversion
4
2
  EXCEL_START_DATE = Date.parse('1/1/1900')-2
5
3
 
@@ -1,8 +1,3 @@
1
- require 'base64'
2
- require 'zlib'
3
- require 'csv'
4
- require 'marty/data_conversion'
5
-
6
1
  class Marty::DataExporter
7
2
  # given an array of hashes, return set of all keys
8
3
  def self.hash_array_keys(hl)
@@ -1,6 +1,3 @@
1
- require 'csv'
2
- require 'marty/data_conversion'
3
-
4
1
  module Marty
5
2
  class DataImporterError < StandardError
6
3
  attr_reader :lines
@@ -2,6 +2,8 @@ module Marty
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Marty
4
4
 
5
+ config.autoload_paths << File.expand_path("../../../lib", __FILE__)
6
+
5
7
  # generators add rspec tests
6
8
  config.generators do |g|
7
9
  g.test_framework :rspec, :view_specs => false
@@ -1,5 +1,3 @@
1
- require 'digest/md5'
2
-
3
1
  module Marty::Migrations
4
2
  def tb_prefix
5
3
  "marty_"
@@ -73,7 +71,7 @@ module Marty::Migrations
73
71
  unique: true)
74
72
  end
75
73
 
76
- def self.write_view(target_dir, klass, jsons, excludes)
74
+ def self.write_view(target_dir, target_view, klass, jsons, excludes, extras)
77
75
  colnames = klass.columns_hash.keys
78
76
  user_id_cols = ["user_id", "o_user_id"]
79
77
  excludes += user_id_cols
@@ -104,14 +102,16 @@ module Marty::Migrations
104
102
  "= #{tn_alias}.id"
105
103
  target_name = c.gsub(/_id$/,'_name')
106
104
  columns.push "#{tn_alias}.name as #{target_name}"
105
+ extras.select { |(table, column)| table_name == table }.each do
106
+ |(table, column)|
107
+ columns.push "#{tn_alias}.#{column} as #{table_name}_#{column}"
108
+ end
107
109
  else
108
110
  columns.push "main.#{c}"
109
111
  end
110
112
  end
111
113
  end
112
- table_name = klass.table_name
113
- file_name = "vw_#{table_name}.sql"
114
- File.open(File.join(target_dir,file_name), "w") do |f|
114
+ File.open(File.join(target_dir, "#{target_view}.sql"), "w") do |f|
115
115
  f.puts <<EOSQL
116
116
  create or replace function f_fixfalse(s text) returns text as $$
117
117
  begin
@@ -119,14 +119,14 @@ begin
119
119
  end
120
120
  $$ language plpgsql;
121
121
 
122
- drop view if exists vw_#{klass.table_name};
123
- create or replace view vw_#{klass.table_name} as
122
+ drop view if exists #{target_view};
123
+ create or replace view #{target_view} as
124
124
  select
125
125
  #{columns.join(",\n ")}
126
126
  from #{klass.table_name} main
127
127
  #{joins.join("\n ")};
128
128
 
129
- grant select on vw_#{klass.table_name} to public;
129
+ grant select on #{target_view} to public;
130
130
  EOSQL
131
131
  end
132
132
  end
@@ -4,15 +4,6 @@
4
4
 
5
5
  require 'delorean_lang'
6
6
 
7
- # Very hacky to overwrite delorean's whitelist. But, there's no
8
- # better way now.
9
-
10
- Delorean::RUBY_WHITELIST.
11
- merge!({
12
- })
13
-
14
- ######################################################################
15
-
16
7
  # Be able to access Enums from Delorean
17
8
  class Delorean::BaseModule::BaseClass
18
9
  class << self
@@ -1,5 +1,3 @@
1
- require 'mcfly'
2
-
3
1
  class Marty::Relation
4
2
  # Given a Mcfly class (klass) and a list of classes which can
5
3
  # reference klass, returns instaces of klass which have no references.
@@ -1,3 +1,3 @@
1
1
  module Marty
2
- VERSION = "0.5.28"
2
+ VERSION = "0.5.29"
3
3
  end
@@ -1,10 +1,12 @@
1
- require 'axlsx'
2
- require 'delorean_lang'
3
-
4
1
  class Marty::Xl
5
2
  include Delorean::Model
6
3
 
7
4
  def self.spreadsheet(worksheets)
5
+ # hack: axlsx tries to modify its input when sent an empty
6
+ # array! This fails when we sent it a frozen one => make sure
7
+ # we sent it an unfozen array.
8
+ worksheets = [] if worksheets == []
9
+
8
10
  xl = Marty::Xl.new(worksheets)
9
11
  xl.package
10
12
  end
@@ -1,6 +1,10 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  require "marty/version"
4
+ require "digest/md5"
5
+ require "base64"
6
+ require "zlib"
7
+ require "csv"
4
8
 
5
9
  Gem::Specification.new do |s|
6
10
  s.name = "marty"
@@ -16,7 +16,7 @@ describe 'Jobs Dashboard', type: :feature, js: true, capybara: true do
16
16
  start_dt: Time.now
17
17
 
18
18
  visit "/"
19
- all 'span', text: 'Sign in'
19
+ all 'span', text: 'Sign in', minimum: 1
20
20
  find(ext_button_id('Sign in')).click
21
21
  fill_in 'Login', with: 'marty'
22
22
  fill_in 'Password', with: 'marty'
@@ -14,7 +14,8 @@ select
14
14
  main.created_dt,
15
15
  main.obsoleted_dt,
16
16
  main.name,
17
- marty_posting_types1.name as posting_type_name
17
+ marty_posting_types1.name as posting_type_name,
18
+ marty_posting_types1.id as marty_posting_types_id
18
19
  from marty_postings main
19
20
  join marty_users u on main.user_id = u.id
20
21
  left join marty_users ou on main.o_user_id = ou.id
@@ -4,7 +4,10 @@ module Marty
4
4
  describe "Migrations" do
5
5
  it "writes db views correctly" do
6
6
  tdir = File.dirname(__FILE__) + "/migrations/"
7
- Marty::Migrations.write_view(tdir, Marty::Posting, {}, ["comment"])
7
+ Marty::Migrations.write_view(tdir,
8
+ 'vw_marty_postings',
9
+ Marty::Posting, {}, ["comment"],
10
+ [["marty_posting_types", "id"]])
8
11
  filename = "vw_marty_postings.sql"
9
12
  genfile = File.join(tdir,filename)
10
13
  generated = File.read(genfile)
@@ -195,4 +195,8 @@ describe Marty::Xl do
195
195
  ["", "", "", "", "", "text", 72, 4, 75, 6, 78]
196
196
  end
197
197
 
198
+ it "should not raise an exception when given an empty, frozen arg" do
199
+ data = [].freeze
200
+ expect { Marty::Xl.spreadsheet(data).to_stream.read }.to_not raise_error
201
+ end
198
202
  end
@@ -43,6 +43,8 @@ RSpec.configure do |config|
43
43
 
44
44
  config.order = 'random'
45
45
 
46
+ config.example_status_persistence_file_path = '.rspec-results'
47
+
46
48
  config.before(:suite) do
47
49
  DatabaseCleaner.clean_with(:truncation)
48
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.28
4
+ version: 0.5.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2016-02-09 00:00:00.000000000 Z
17
+ date: 2016-02-18 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: pg
@@ -576,3 +576,4 @@ signing_key:
576
576
  specification_version: 4
577
577
  summary: A framework for working with versioned data
578
578
  test_files: []
579
+ has_rdoc: