smalruby-editor 0.0.8-x86-mingw32

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.

Potentially problematic release.


This version of smalruby-editor might be problematic. Click here for more details.

Files changed (110) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/.rspec +4 -0
  4. data/.rubocop.yml +19 -0
  5. data/.ruby-version +1 -0
  6. data/.simplecov +7 -0
  7. data/.travis.yml +23 -0
  8. data/LEGAL +13 -0
  9. data/LICENSE +22 -0
  10. data/Procfile +1 -0
  11. data/README.rdoc +46 -0
  12. data/Rakefile +9 -0
  13. data/app/assets/images/.keep +0 -0
  14. data/app/assets/images/favicon.ico +0 -0
  15. data/app/assets/javascripts/application.js +21 -0
  16. data/app/assets/javascripts/editor.js.coffee.erb +139 -0
  17. data/app/assets/stylesheets/application.css +19 -0
  18. data/app/assets/stylesheets/editor.css.scss +19 -0
  19. data/app/assets/stylesheets/flatstrap-custom.css.scss +2 -0
  20. data/app/controllers/application_controller.rb +5 -0
  21. data/app/controllers/concerns/.keep +0 -0
  22. data/app/controllers/editor_controller.rb +5 -0
  23. data/app/controllers/source_codes_controller.rb +106 -0
  24. data/app/helpers/application_helper.rb +2 -0
  25. data/app/helpers/editor_helper.rb +2 -0
  26. data/app/mailers/.keep +0 -0
  27. data/app/models/.keep +0 -0
  28. data/app/models/concerns/.keep +0 -0
  29. data/app/models/source_code.rb +49 -0
  30. data/app/views/editor/index.html.erb +23 -0
  31. data/app/views/layouts/application.html.erb +15 -0
  32. data/bin/bundle +3 -0
  33. data/bin/rails +4 -0
  34. data/bin/rake +4 -0
  35. data/bin/smalruby-editor +80 -0
  36. data/config/application.rb +16 -0
  37. data/config/boot.rb +17 -0
  38. data/config/database.yml.mysql2 +48 -0
  39. data/config/database.yml.sqlite3 +31 -0
  40. data/config/database.yml.travis +5 -0
  41. data/config/environment.rb +5 -0
  42. data/config/environments/development.rb +30 -0
  43. data/config/environments/production.rb +86 -0
  44. data/config/environments/standalone.rb +16 -0
  45. data/config/environments/test.rb +46 -0
  46. data/config/initializers/backtrace_silencers.rb +9 -0
  47. data/config/initializers/filter_parameter_logging.rb +4 -0
  48. data/config/initializers/inflections.rb +16 -0
  49. data/config/initializers/mime_types.rb +5 -0
  50. data/config/initializers/secret_token.rb +17 -0
  51. data/config/initializers/session_store.rb +4 -0
  52. data/config/initializers/wrap_parameters.rb +15 -0
  53. data/config/locales/en.yml +23 -0
  54. data/config/routes.rb +68 -0
  55. data/config/unicorn.rb +23 -0
  56. data/config.ru +4 -0
  57. data/db/migrate/20131216121603_create_source_codes.rb +9 -0
  58. data/db/migrate/20131219045113_add_filename_to_source_code.rb +5 -0
  59. data/db/schema.rb +23 -0
  60. data/db/seeds.rb +7 -0
  61. data/lib/assets/.keep +0 -0
  62. data/lib/smalruby_editor/version.rb +3 -0
  63. data/lib/smalruby_editor.rb +46 -0
  64. data/lib/tasks/.keep +0 -0
  65. data/lib/tasks/gem.rake +10 -0
  66. data/lib/tasks/rspec.rake +16 -0
  67. data/lib/tasks/rubocop.rake +3 -0
  68. data/log/.keep +0 -0
  69. data/public/404.html +58 -0
  70. data/public/422.html +58 -0
  71. data/public/500.html +57 -0
  72. data/public/assets/application-759ce4d1ac1e0e3991e6d350c8f98fc5.js +5267 -0
  73. data/public/assets/application-759ce4d1ac1e0e3991e6d350c8f98fc5.js.gz +0 -0
  74. data/public/assets/application-f51ea0e777d97f12a8ce84308f31eb57.css +4791 -0
  75. data/public/assets/application-f51ea0e777d97f12a8ce84308f31eb57.css.gz +0 -0
  76. data/public/assets/favicon-c7ae857bb9d06de8742ae2d337157e83.ico +0 -0
  77. data/public/assets/loading-e8e6dd7833131c92a6c3b9c8ccc6a6ac.gif +0 -0
  78. data/public/assets/manifest-f86249f9779f8f4d7c8fc148e4361b4f.json +1 -0
  79. data/public/assets/progressbar-82023a146fba2a0f6d925629ed2b09c5.gif +0 -0
  80. data/public/favicon.ico +0 -0
  81. data/public/fonts/FontAwesome.otf +0 -0
  82. data/public/fonts/fontawesome-webfont.eot +0 -0
  83. data/public/fonts/fontawesome-webfont.ttf +0 -0
  84. data/public/fonts/fontawesome-webfont.woff +0 -0
  85. data/public/robots.txt +5 -0
  86. data/smalruby-editor.gemspec +81 -0
  87. data/spec/acceptance/readme.md +3 -0
  88. data/spec/acceptance/standalone/save.feature +32 -0
  89. data/spec/acceptance/text_editor/base.feature +24 -0
  90. data/spec/acceptance/text_editor/check.feature +25 -0
  91. data/spec/acceptance/text_editor/load.feature +81 -0
  92. data/spec/acceptance/text_editor/save.feature +34 -0
  93. data/spec/controllers/editor_controller_spec.rb +12 -0
  94. data/spec/controllers/source_codes_controller_spec.rb +469 -0
  95. data/spec/fixtures/files/01.rb +57 -0
  96. data/spec/fixtures/files/favicon.ico +0 -0
  97. data/spec/helpers/editor_helper_spec.rb +14 -0
  98. data/spec/lib/smalruby_editor_spec.rb +66 -0
  99. data/spec/models/source_code_spec.rb +55 -0
  100. data/spec/spec_helper.rb +156 -0
  101. data/spec/steps/ace_steps.rb +59 -0
  102. data/spec/steps/global_variable.rb +39 -0
  103. data/spec/steps/text_editor_steps.rb +183 -0
  104. data/spec/support/assets.rb +18 -0
  105. data/spec/support/capybara.rb +17 -0
  106. data/spec/support/env.rb +15 -0
  107. data/spec/turnip_helper.rb +2 -0
  108. data/vendor/assets/javascripts/.keep +0 -0
  109. data/vendor/assets/stylesheets/.keep +0 -0
  110. metadata +407 -0
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require 'pathname'
5
+
6
+ ENV['RAILS_ENV'] = 'standalone'
7
+ ENV['SMALRUBY_EDITOR_HOME'] ||= Pathname('~/.smalruby-editor').expand_path.to_s
8
+
9
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
10
+ require_relative '../config/boot'
11
+
12
+ lib = File.expand_path('../../lib', __FILE__)
13
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
14
+ require 'smalruby_editor'
15
+
16
+ Dir.chdir(File.expand_path('../../', APP_PATH))
17
+ require 'rails/commands/server'
18
+
19
+ # rubocop:disable all
20
+ module Rails
21
+ class Server < ::Rack::Server
22
+ def start
23
+ url = "#{options[:SSLEnable] ? 'https' : 'http'}://#{options[:Host]}:#{options[:Port]}"
24
+ puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}"
25
+ puts "=> smalruby-editor #{SmalrubyEditor::VERSION} starting in #{Rails.env} on #{url}"
26
+ puts "=> Run `smalruby-editor -h` for more startup options"
27
+ trap(:INT) { exit }
28
+ puts "=> Ctrl-C to shutdown server" unless options[:daemonize]
29
+
30
+ unless options[:daemonize]
31
+ wrapped_app # touch the app so the logger is set up
32
+
33
+ console = ActiveSupport::Logger.new($stdout)
34
+ console.formatter = Rails.logger.formatter
35
+ console.level = Rails.logger.level
36
+
37
+ Rails.logger.extend(ActiveSupport::Logger.broadcast(console))
38
+
39
+ if ActiveRecord::Migrator.needs_migration?
40
+ ActiveRecord::Migration.verbose = true
41
+ begin
42
+ ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths)
43
+ ensure
44
+ ActiveRecord::Migration.verbose = false
45
+ end
46
+ end
47
+ end
48
+
49
+ uri = "http://localhost:#{options[:Port]}"
50
+ launchy = Launchy.open(uri) do |exception|
51
+ puts "Attempted to open #{uri} and failed because #{exception}"
52
+ end
53
+
54
+ super
55
+ ensure
56
+ # The '-h' option calls exit before @options is set.
57
+ # If we call 'options' with it unset, we get double help banners.
58
+ puts 'Exiting' unless @options && options[:daemonize]
59
+ end
60
+
61
+ def default_options
62
+ super.merge({
63
+ Port: 8087,
64
+ DoNotReverseLookup: true,
65
+ environment: (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || "development").dup,
66
+ daemonize: false,
67
+ debugger: false,
68
+ pid: Pathname(ENV['SMALRUBY_EDITOR_HOME']).join("tmp/pids/server.pid").to_s,
69
+ config: File.expand_path("config.ru")
70
+ })
71
+ end
72
+ end
73
+ end
74
+
75
+ Rails::Server.new.tap do |server|
76
+ require APP_PATH
77
+ Dir.chdir(Rails.application.root)
78
+ server.start
79
+ end
80
+ # rubocop:enable all
@@ -0,0 +1,16 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'active_record/railtie'
4
+ require 'action_controller/railtie'
5
+ require 'action_mailer/railtie'
6
+ require 'sprockets/railtie'
7
+
8
+ Bundler.require(:default, Rails.env) unless Rails.env == 'standalone'
9
+
10
+ module SmalrubyEditor
11
+ class Application < Rails::Application
12
+ config.time_zone = 'Tokyo'
13
+ # config.i18n.default_locale = :ja
14
+ config.colorize_logging = false
15
+ end
16
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,17 @@
1
+ # Set up gems listed in the Gemfile.
2
+ if ENV['RAILS_ENV'] == 'standalone'
3
+ require 'pathname'
4
+ path = Pathname('../../smalruby-editor.gemspec').expand_path(__FILE__)
5
+ spec = Dir.chdir(path.dirname.to_s) {
6
+ # rubocop:disable Eval
7
+ eval(path.read, TOPLEVEL_BINDING, path.to_s)
8
+ # rubocop:enable Eval
9
+ }
10
+ spec.runtime_dependencies.each do |spec_dep|
11
+ require spec_dep.name
12
+ end
13
+ else
14
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
15
+
16
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
17
+ end
@@ -0,0 +1,48 @@
1
+ # MySQL. Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Install the MYSQL driver
4
+ # gem install mysql2
5
+ #
6
+ # Ensure the MySQL gem is defined in your Gemfile
7
+ # gem 'mysql2'
8
+ #
9
+ # And be sure to use new-style password hashing:
10
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
11
+ development:
12
+ adapter: mysql2
13
+ encoding: utf8
14
+ database: smalruby-editor_development
15
+ pool: 5
16
+ username: root
17
+ password:
18
+ host: localhost
19
+
20
+ # Warning: The database defined as "test" will be erased and
21
+ # re-generated from your development database when you run "rake".
22
+ # Do not set this db to the same as development or production.
23
+ test:
24
+ adapter: mysql2
25
+ encoding: utf8
26
+ database: smalruby-editor_test
27
+ pool: 5
28
+ username: root
29
+ password:
30
+ host: localhost
31
+
32
+ production:
33
+ adapter: mysql2
34
+ encoding: utf8
35
+ database: smalruby-editor_production
36
+ pool: 5
37
+ username: root
38
+ password:
39
+ host: localhost
40
+
41
+ standalone:
42
+ adapter: mysql2
43
+ encoding: utf8
44
+ database: smalruby-editor_standalone
45
+ pool: 5
46
+ username: root
47
+ password:
48
+ host: localhost
@@ -0,0 +1,31 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
26
+
27
+ standalone:
28
+ adapter: sqlite3
29
+ database: db/standalone.sqlite3
30
+ pool: 5
31
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ test:
2
+ adapter: mysql2
3
+ database: myapp_test
4
+ username: travis
5
+ encoding: utf8
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ SmalrubyEditor::Application.initialize!
@@ -0,0 +1,30 @@
1
+ SmalrubyEditor::Application.configure do
2
+ # Settings specified here will take precedence over those in
3
+ # config/application.rb.
4
+
5
+ # In the development environment your application's code is reloaded on
6
+ # every request. This slows down response time but is perfect for development
7
+ # since you don't have to restart the web server when you make code changes.
8
+ config.cache_classes = false
9
+
10
+ # Do not eager load code on boot.
11
+ config.eager_load = false
12
+
13
+ # Show full error reports and disable caching.
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send.
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger.
21
+ config.active_support.deprecation = :log
22
+
23
+ # Raise an error on page load if there are pending migrations
24
+ config.active_record.migration_error = :page_load
25
+
26
+ # Debug mode disables concatenation and preprocessing of assets.
27
+ # This option may cause significant delays in view rendering with a large
28
+ # number of complex assets.
29
+ config.assets.debug = true
30
+ end
@@ -0,0 +1,86 @@
1
+ SmalrubyEditor::Application.configure do
2
+ # Settings specified here will take precedence over those in
3
+ # config/application.rb.
4
+
5
+ # Code is not reloaded between requests.
6
+ config.cache_classes = true
7
+
8
+ # Eager load code on boot. This eager loads most of Rails and
9
+ # your application in memory, allowing both thread web servers
10
+ # and those relying on copy on write to perform better.
11
+ # Rake tasks automatically ignore this option for performance.
12
+ config.eager_load = true
13
+
14
+ # Full error reports are disabled and caching is turned on.
15
+ config.consider_all_requests_local = false
16
+ config.action_controller.perform_caching = true
17
+
18
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
19
+ # Add `rack-cache` to your Gemfile before enabling this.
20
+ # For large-scale production use, consider using a caching reverse
21
+ # proxy like nginx, varnish or squid.
22
+ # config.action_dispatch.rack_cache = true
23
+
24
+ # Disable Rails's static asset server (Apache or nginx will already do this).
25
+ config.serve_static_assets = false
26
+
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
30
+
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
32
+ config.assets.compile = false
33
+
34
+ # Generate digests for assets URLs.
35
+ config.assets.digest = true
36
+
37
+ # Version of your assets, change this if you want to expire all your assets.
38
+ config.assets.version = '1.0'
39
+
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
43
+
44
+ # Force all access to the app over SSL, use
45
+ # Strict-Transport-Security, and use secure cookies.
46
+ # config.force_ssl = true
47
+
48
+ # Set to :debug to see everything in the log.
49
+ config.log_level = :info
50
+
51
+ # Prepend all log lines with the following tags.
52
+ # config.log_tags = [ :subdomain, :uuid ]
53
+
54
+ # Use a different logger for distributed setups.
55
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56
+
57
+ # Use a different cache store in production.
58
+ # config.cache_store = :mem_cache_store
59
+
60
+ # Enable serving of images, stylesheets, and JavaScripts from an
61
+ # asset server.
62
+ # config.action_controller.asset_host = "http://assets.example.com"
63
+
64
+ # Precompile additional assets.
65
+ # application.js, application.css, and all non-JS/CSS in app/assets
66
+ # folder are already added.
67
+ # config.assets.precompile += %w( search.js )
68
+
69
+ # Ignore bad email addresses and do not raise email delivery errors.
70
+ # Set this to true and configure the email server for immediate
71
+ # delivery to raise delivery errors.
72
+ # config.action_mailer.raise_delivery_errors = false
73
+
74
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75
+ # the I18n.default_locale when a translation can not be found).
76
+ config.i18n.fallbacks = true
77
+
78
+ # Send deprecation notices to registered listeners.
79
+ config.active_support.deprecation = :notify
80
+
81
+ # Disable automatic flushing of the log to improve performance.
82
+ # config.autoflush_log = false
83
+
84
+ # Use default logging formatter so that PID and timestamp are not suppressed.
85
+ config.log_formatter = ::Logger::Formatter.new
86
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'production'
2
+
3
+ SmalrubyEditor::Application.configure do
4
+ if ENV['SMALRUBY_EDITOR_HOME'].present?
5
+ home_dir = SmalrubyEditor.create_home_directory
6
+
7
+ config.paths.add('config/database',
8
+ with: home_dir.join('config/database.yml'))
9
+ config.paths.add('log', with: home_dir.join("log/#{Rails.env}.log"))
10
+ config.paths.add('tmp', with: home_dir.join('tmp'))
11
+ config.paths.add('tmp/cache', with: home_dir.join('tmp/cache'))
12
+ end
13
+
14
+ config.serve_static_assets = true
15
+ config.log_level = :warn
16
+ end
@@ -0,0 +1,46 @@
1
+ # -*- coding: utf-8 -*-
2
+ SmalrubyEditor::Application.configure do
3
+ # Settings specified here will take precedence over those in
4
+ # config/application.rb.
5
+
6
+ # The test environment is used exclusively to run your application's
7
+ # test suite. You never need to work with it otherwise. Remember that
8
+ # your test database is "scratch space" for the test suite and is wiped
9
+ # and recreated between test runs. Don't rely on the data there!
10
+
11
+ # http://penguinlab.jp/blog/post/2256# より
12
+ # Spork 使用時はクラスをキャッシュしない
13
+ if defined?(Spork) && Spork.using_spork?
14
+ config.cache_classes = false
15
+ else
16
+ config.cache_classes = true
17
+ end
18
+
19
+ # Do not eager load code on boot. This avoids loading your whole application
20
+ # just for the purpose of running a single test. If you are using a tool that
21
+ # preloads Rails for running tests, you may have to set it to true.
22
+ config.eager_load = false
23
+
24
+ # Configure static asset server for tests with Cache-Control for
25
+ # performance.
26
+ config.serve_static_assets = true
27
+ config.static_cache_control = 'public, max-age=3600'
28
+
29
+ # Show full error reports and disable caching.
30
+ config.consider_all_requests_local = true
31
+ config.action_controller.perform_caching = false
32
+
33
+ # Raise exceptions instead of rendering exception templates.
34
+ config.action_dispatch.show_exceptions = false
35
+
36
+ # Disable request forgery protection in test environment.
37
+ config.action_controller.allow_forgery_protection = false
38
+
39
+ # Tell Action Mailer not to deliver emails to the real world.
40
+ # The :test delivery method accumulates sent emails in the
41
+ # ActionMailer::Base.deliveries array.
42
+ config.action_mailer.delivery_method = :test
43
+
44
+ # Print deprecation notices to the stderr.
45
+ config.active_support.deprecation = :stderr
46
+ end
@@ -0,0 +1,9 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but
4
+ # don't wish to see in your backtraces.
5
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
6
+
7
+ # You can also remove all the silencers if you're trying to debug a
8
+ # problem that might stem from framework code.
9
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,17 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ if Rails.env == 'production'
13
+ secret_key_base = ENV['SECRET_KEY_BASE']
14
+ else
15
+ secret_key_base = '123456789012345678901234567890'
16
+ end
17
+ SmalrubyEditor::Application.config.secret_key_base = secret_key_base
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ SmalrubyEditor::Application
4
+ .config.session_store :cookie_store, key: '_smalruby-editor_session'
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting
7
+ # :format to an empty array.
8
+ ActiveSupport.on_load(:action_controller) do
9
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
10
+ end
11
+
12
+ # To enable root element in JSON for ActiveRecord objects.
13
+ # ActiveSupport.on_load(:active_record) do
14
+ # self.include_root_in_json = true
15
+ # end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
data/config/routes.rb ADDED
@@ -0,0 +1,68 @@
1
+ # -*- coding: utf-8 -*-
2
+ SmalrubyEditor::Application.routes.draw do
3
+ root 'editor#index'
4
+
5
+ resources :source_codes, only: [:create]
6
+ post 'source_codes/check'
7
+ delete 'source_codes/download'
8
+ post 'source_codes/load'
9
+ delete 'source_codes/write'
10
+
11
+ # The priority is based upon order of creation: first created ->
12
+ # highest priority.
13
+ # See how all your routes lay out with "rake routes".
14
+
15
+ # You can have the root of your site routed with "root"
16
+ # root 'welcome#index'
17
+
18
+ # Example of regular route:
19
+ # get 'products/:id' => 'catalog#view'
20
+
21
+ # Example of named route that can be invoked with purchase_url(id:
22
+ # product.id)
23
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
24
+
25
+ # Example resource route (maps HTTP verbs to controller actions
26
+ # automatically):
27
+ # resources :products
28
+
29
+ # Example resource route with options:
30
+ # resources :products do
31
+ # member do
32
+ # get 'short'
33
+ # post 'toggle'
34
+ # end
35
+ #
36
+ # collection do
37
+ # get 'sold'
38
+ # end
39
+ # end
40
+
41
+ # Example resource route with sub-resources:
42
+ # resources :products do
43
+ # resources :comments, :sales
44
+ # resource :seller
45
+ # end
46
+
47
+ # Example resource route with more complex sub-resources:
48
+ # resources :products do
49
+ # resources :comments
50
+ # resources :sales do
51
+ # get 'recent', on: :collection
52
+ # end
53
+ # end
54
+
55
+ # Example resource route with concerns:
56
+ # concern :toggleable do
57
+ # post 'toggle'
58
+ # end
59
+ # resources :posts, concerns: :toggleable
60
+ # resources :photos, concerns: :toggleable
61
+
62
+ # Example resource route within a namespace:
63
+ # namespace :admin do
64
+ # # Directs /admin/products/* to Admin::ProductsController
65
+ # # (app/controllers/admin/products_controller.rb)
66
+ # resources :products
67
+ # end
68
+ end
data/config/unicorn.rb ADDED
@@ -0,0 +1,23 @@
1
+ worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3)
2
+ timeout 15
3
+ preload_app true
4
+
5
+ # rubocop:disable Output
6
+ before_fork do |server, worker|
7
+ Signal.trap 'TERM' do
8
+ puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
9
+ Process.kill 'QUIT', Process.pid
10
+ end
11
+
12
+ defined?(ActiveRecord::Base) && ActiveRecord::Base.connection.disconnect!
13
+ end
14
+
15
+ after_fork do |server, worker|
16
+ Signal.trap 'TERM' do
17
+ puts 'Unicorn worker intercepting TERM and doing nothing.' \
18
+ ' Wait for master to send QUIT'
19
+ end
20
+
21
+ defined?(ActiveRecord::Base) && ActiveRecord::Base.establish_connection
22
+ end
23
+ # rubocop:enable Output
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,9 @@
1
+ class CreateSourceCodes < ActiveRecord::Migration
2
+ def change
3
+ create_table :source_codes do |t|
4
+ t.text :data
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddFilenameToSourceCode < ActiveRecord::Migration
2
+ def change
3
+ add_column :source_codes, :filename, :string
4
+ end
5
+ end
data/db/schema.rb ADDED
@@ -0,0 +1,23 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20131219045113) do
15
+
16
+ create_table "source_codes", force: true do |t|
17
+ t.text "data"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ t.string "filename"
21
+ end
22
+
23
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
data/lib/assets/.keep ADDED
File without changes
@@ -0,0 +1,3 @@
1
+ module SmalrubyEditor
2
+ VERSION = '0.0.8'
3
+ end