pageflow-support 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3246fffe4faa9caa8e2ff6557d8579ee01b3cb2d
4
+ data.tar.gz: d66d49044b8bfb4e457933d33b34e0e0dd535faa
5
+ SHA512:
6
+ metadata.gz: 57b7940599d595193aefe1161f972bd420f5915a66ad133c413c1f77dea4a2338ac8345502cc505e41172ea4d324c0f517dd092f7bba61cc0ccce59c99444fd6
7
+ data.tar.gz: 3a27fa3d6677921d02c459494d020a6a325222749c7f73c3f185bfdbb8fb5d211e77984242abacc61f3a3bbb7775da4849800d4189afb1d3e3825818d4f6d4fa
@@ -0,0 +1,30 @@
1
+ module Pageflow
2
+ module Dummy
3
+ class App
4
+ def generate
5
+ ENV['RAILS_ROOT'] = File.expand_path(directory)
6
+
7
+ if File.exists?(directory)
8
+ puts("Dummy directory #{directory} exists.")
9
+ else
10
+ system("bundle exec rails new #{directory} --template #{template_path} #{rails_new_options}")
11
+ end
12
+
13
+ require(File.join(ENV['RAILS_ROOT'], 'config', 'environment'))
14
+ end
15
+
16
+ def directory
17
+ require 'rails/version'
18
+ File.join('spec', 'dummy', "rails-#{Rails::VERSION::STRING}")
19
+ end
20
+
21
+ def template_path
22
+ File.expand_path(File.join('..', 'rails_template.rb'), __FILE__)
23
+ end
24
+
25
+ def rails_new_options
26
+ '--skip-test-unit --skip-bundle --database=mysql'
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,63 @@
1
+ def source_paths
2
+ [File.join(File.expand_path(File.dirname(__FILE__)), 'templates')]
3
+ end
4
+
5
+ # The Gemfile is not required. We'll use the one from the project root instead.
6
+
7
+ run 'rm Gemfile'
8
+
9
+ # Setup database.yml to use credentials from env variable.
10
+
11
+ copy_file('database.yml', 'config/database.yml', force: true)
12
+
13
+ rails_version_string = Rails::VERSION::STRING.tr!('.', '_')
14
+
15
+ engine_name = ENV.fetch('PAGEFLOW_PLUGIN_ENGINE', 'pageflow')
16
+ database_prefix = "#{engine_name}-rails-#{rails_version_string}"
17
+
18
+ gsub_file('config/database.yml',
19
+ /^ database: /,
20
+ " database: #{database_prefix}-")
21
+
22
+ append_to_file('config/application.rb', <<-END)
23
+ if ENV['PAGEFLOW_DB_HOST'].present?
24
+ ActiveRecord::Tasks::DatabaseTasks::LOCAL_HOSTS << ENV['PAGEFLOW_DB_HOST']
25
+ end
26
+ END
27
+
28
+ # Remove requires to missing gems (i.e. turbolinks)
29
+ gsub_file('app/assets/javascripts/application.js', %r'//=.*', '')
30
+
31
+ # Recreate db. Ignore if it does not exist.
32
+
33
+ log :rake, 'db:drop:all'
34
+ in_root { run('rake db:drop:all 2> /dev/null', verbose: false) }
35
+
36
+ rake 'db:create:all'
37
+
38
+ # Install pageflow and the tested engine via their generators.
39
+
40
+ generate 'pageflow:install', '--force'
41
+ generate "#{ENV['PAGEFLOW_PLUGIN_ENGINE']}:install", '--force' if ENV['PAGEFLOW_PLUGIN_ENGINE']
42
+
43
+ run 'rm -r spec'
44
+
45
+ # Devise needs default_url_options for generating mails.
46
+
47
+ inject_into_file('config/environments/test.rb',
48
+ " config.action_mailer.default_url_options = {host: 'test.host'}\n",
49
+ after: "config.action_mailer.delivery_method = :test\n")
50
+
51
+ # ActiveAdmin does not look for admin definitions inside dummy apps by default.
52
+
53
+ prepend_to_file('config/initializers/pageflow.rb', <<-END)
54
+ ActiveAdmin.application.load_paths.unshift(Dir[Rails.root.join('app/admin')].first)\n
55
+ END
56
+
57
+ # Create database tables for fake hosted files and revision components.
58
+
59
+ copy_file('create_test_hosted_file.rb', 'db/migrate/00000000000000_create_test_hosted_file.rb')
60
+ copy_file('create_test_revision_component.rb', 'db/migrate/00000000000001_create_test_revision_component.rb')
61
+ copy_file('add_custom_fields.rb', 'db/migrate/99990000000000_add_custom_fields.rb')
62
+
63
+ rake 'db:migrate db:test:load', env: 'development'
@@ -0,0 +1,7 @@
1
+ class AddCustomFields < ActiveRecord::Migration
2
+ def change
3
+ add_column :pageflow_entries, :custom_field, :string
4
+ add_column :pageflow_accounts, :custom_field, :string
5
+ add_column :pageflow_themings, :custom_field, :string
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class CreateTestHostedFile < ActiveRecord::Migration
2
+ def change
3
+ create_table :test_hosted_files do |t|
4
+ Pageflow::HostedFile.columns(t)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ class CreateTestRevisionComponent < ActiveRecord::Migration
2
+ def change
3
+ create_table :test_revision_components do |t|
4
+ t.belongs_to :revision
5
+ t.integer :perma_id
6
+
7
+ t.string :text
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ development:
2
+ adapter: mysql2
3
+ encoding: utf8
4
+ database: development
5
+ pool: 5
6
+ username: <%= ENV.fetch('PAGEFLOW_DB_USER', 'root') %>
7
+ password: <%= ENV.fetch('PAGEFLOW_DB_PASSWORD', '') %>
8
+ <% if ENV['PAGEFLOW_DB_HOST'].present? %>
9
+ host: <%= ENV['PAGEFLOW_DB_HOST'] %>
10
+ port: <%= ENV.fetch('PAGEFLOW_DB_PORT', '3306') %>
11
+ <% else %>
12
+ socket: /var/run/mysqld/mysqld.sock
13
+ <% end %>
14
+
15
+ test:
16
+ adapter: mysql2
17
+ encoding: utf8
18
+ database: test
19
+ pool: 5
20
+ username: <%= ENV.fetch('PAGEFLOW_DB_USER', 'root') %>
21
+ password: <%= ENV.fetch('PAGEFLOW_DB_PASSWORD', '') %>
22
+ <% if ENV['PAGEFLOW_DB_HOST'].present? %>
23
+ host: <%= ENV['PAGEFLOW_DB_HOST'] %>
24
+ port: <%= ENV.fetch('PAGEFLOW_DB_PORT', '3306') %>
25
+ <% else %>
26
+ socket: /var/run/mysqld/mysqld.sock
27
+ <% end %>
data/pageflow/dummy.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'pageflow/dummy/app'
2
+
3
+ module Pageflow
4
+ module Dummy
5
+ def self.setup
6
+ App.new.generate
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ module Pageflow
2
+ module RailsVersion
3
+ extend self
4
+
5
+ RAILS_VERSION_FILE = File.expand_path('../../../../.rails_version')
6
+
7
+ def detect
8
+ from_env || from_file || '4.2.6'
9
+ end
10
+
11
+ private
12
+
13
+ def from_env
14
+ ENV['PAGEFLOW_RAILS_VERSION']
15
+ end
16
+
17
+ def from_file
18
+ if File.exists?(RAILS_VERSION_FILE)
19
+ File.read(RAILS_VERSION_FILE).chomp.strip.presence
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1 @@
1
+ require 'pageflow/dummy'
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pageflow-support
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.11.3
5
+ platform: ruby
6
+ authors:
7
+ - Codevise Solutions Ltd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mysql2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
28
+ email:
29
+ - info@codevise.de
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - pageflow/dummy.rb
35
+ - pageflow/dummy/app.rb
36
+ - pageflow/dummy/rails_template.rb
37
+ - pageflow/dummy/templates/add_custom_fields.rb
38
+ - pageflow/dummy/templates/create_test_hosted_file.rb
39
+ - pageflow/dummy/templates/create_test_revision_component.rb
40
+ - pageflow/dummy/templates/database.yml
41
+ - pageflow/rails_version.rb
42
+ - pageflow/support.rb
43
+ homepage: http://www.pageflow.io
44
+ licenses: []
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - "."
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.6.8
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Spec support for Pageflow extensions.
66
+ test_files: []