short_message 0.1.0 → 1.0.0
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/MIT-LICENSE +1 -1
- data/README.md +18 -10
- data/Rakefile +18 -8
- data/app/controllers/short_message/application_controller.rb +1 -0
- data/app/controllers/short_message/messages_controller.rb +20 -0
- data/app/mailers/application_mailer.rb +3 -0
- data/app/mailers/short_message/mailer.rb +5 -15
- data/app/models/short_message/message.rb +27 -61
- data/config/routes.rb +5 -1
- data/db/migrate/20130308133457_create_short_message_messages.rb +1 -1
- data/lib/generators/short_message/templates/config/initializers/short_message.rb +10 -10
- data/lib/generators/short_message/templates/config/locales/short_message.de.yml +5 -11
- data/lib/generators/short_message/templates/config/locales/short_message.en.yml +5 -11
- data/lib/short_message/config.rb +3 -4
- data/lib/short_message/engine.rb +3 -4
- data/lib/short_message/version.rb +1 -1
- data/test/dummy/README.rdoc +28 -0
- data/{spec → test}/dummy/Rakefile +1 -2
- data/{spec → test}/dummy/app/assets/javascripts/application.js +4 -6
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/{spec → test}/dummy/app/helpers/application_helper.rb +0 -0
- data/{spec → test}/dummy/app/views/layouts/application.html.erb +1 -2
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +54 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/{spec → test}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/{spec → test}/dummy/config/initializers/inflections.rb +6 -5
- data/{spec → test}/dummy/config/initializers/mime_types.rb +0 -1
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/{spec → test}/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/test/dummy/config/locales/en.yml +23 -0
- data/{spec → test}/dummy/config/routes.rb +0 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/{spec/dummy/public/favicon.ico → test/dummy/log/development.log} +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/short_message_test.rb +7 -0
- data/test/test_helper.rb +21 -0
- metadata +87 -164
- data/spec/config_helper.rb +0 -15
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/config/application.rb +0 -65
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.example.yml +0 -42
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/environments/test.rb +0 -37
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/locales/short_message.de.yml +0 -14
- data/spec/dummy/config/locales/short_message.en.yml +0 -14
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/script/rails +0 -6
- data/spec/factories/short_message_messages.rb +0 -17
- data/spec/mailers/short_message/mailer_spec.rb +0 -64
- data/spec/models/short_message/config_spec.rb +0 -17
- data/spec/models/short_message/message_spec.rb +0 -52
- data/spec/spec_helper.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d987538fe6cd5c550bbf3612cae44a45fb4a08e7
|
4
|
+
data.tar.gz: 1335ad39e09979ccaae3097cb02f7f48620d6489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f5d5d95c78f15da9a21db1cc6f07e26d872d426421829840fe289704c6500f8a3fa8df7be917f92b35d3b090711b4edebf26486d106e3a8ae2f3ca4e857aad4
|
7
|
+
data.tar.gz: de7b38d19b85bf706d3010233aa5efccd63ba392e81406996382f909d824b0e079092f5fdd812173bd47e14aaa4a0f0dc04a0fce16f6cc6125c18cbfe26eab1c
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# ShortMessage
|
1
|
+
# ShortMessage
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/short_message)
|
4
4
|
|
5
|
-
## Installation
|
5
|
+
## Installation
|
6
6
|
|
7
7
|
Add it to your Gemfile:
|
8
8
|
|
@@ -22,30 +22,38 @@ Run the generator:
|
|
22
22
|
rails generate short_message:install
|
23
23
|
```
|
24
24
|
|
25
|
-
And
|
25
|
+
And run the migrations:
|
26
|
+
|
26
27
|
```console
|
27
28
|
rake db:migrate
|
28
29
|
```
|
29
|
-
|
30
|
+
|
31
|
+
## Usage
|
30
32
|
|
31
33
|
Create a message and deliver it:
|
34
|
+
|
32
35
|
```ruby
|
33
|
-
@sms = ShortMessage::Message.new(:
|
36
|
+
@sms = ShortMessage::Message.new(sender: "0041791234567", recipient: "0041799876543", text: "Hello World!")
|
34
37
|
@sms.deliver
|
35
38
|
```
|
36
|
-
|
37
|
-
|
39
|
+
|
40
|
+
## Customization
|
41
|
+
|
42
|
+
### Status Codes
|
43
|
+
|
38
44
|
If you need to customize the status response codes simply edit the internationalization files in config/locales
|
39
45
|
|
40
|
-
### Params
|
41
|
-
|
46
|
+
### Params
|
47
|
+
|
48
|
+
To override the params string add the code below into `config/initializers/short_message.rb`:
|
49
|
+
|
42
50
|
```ruby
|
43
51
|
ShortMessage::Message.module_eval do
|
44
52
|
private
|
45
53
|
def build_deliver_params_string
|
46
54
|
# your code here
|
47
55
|
end
|
48
|
-
|
56
|
+
|
49
57
|
def build_recharge_params_string amount
|
50
58
|
# your code here
|
51
59
|
end
|
data/Rakefile
CHANGED
@@ -1,16 +1,10 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
1
|
begin
|
3
2
|
require 'bundler/setup'
|
4
3
|
rescue LoadError
|
5
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
5
|
end
|
7
|
-
|
8
|
-
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
14
8
|
|
15
9
|
RDoc::Task.new(:rdoc) do |rdoc|
|
16
10
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -20,8 +14,24 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
20
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
15
|
end
|
22
16
|
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
23
22
|
|
24
23
|
|
25
24
|
|
26
25
|
Bundler::GemHelper.install_tasks
|
27
26
|
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_dependency "short_message/application_controller"
|
2
|
+
|
3
|
+
module ShortMessage
|
4
|
+
class MessagesController < ApplicationController
|
5
|
+
def status
|
6
|
+
unless params[:id].blank? or params[:status].blank?
|
7
|
+
if message = ShortMessage::Message.find_by(message_key: params[:id])
|
8
|
+
message.status_code = params[:status]
|
9
|
+
message.save!
|
10
|
+
|
11
|
+
render plain: "Message #{params[:id]} has now status #{params[:status]}"
|
12
|
+
else
|
13
|
+
render plain: "Message #{params[:id]} not found!", status: 404
|
14
|
+
end
|
15
|
+
else
|
16
|
+
render plain: "Message ID or status not provided!", status: 400
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,21 +1,11 @@
|
|
1
1
|
module ShortMessage
|
2
|
-
class Mailer <
|
3
|
-
|
4
|
-
|
5
|
-
def recharge_notification amount
|
6
|
-
mail to: ShortMessage.config.reload_notification_email, :subject => "SMS credit recharged", :body => "Your SMS Account has automatically been recharged with #{amount} sms."
|
7
|
-
end
|
8
|
-
|
9
|
-
def voucher_notification amount
|
10
|
-
mail :to => ShortMessage.config.voucher_notification_email, :subject => "SMS credit recharged, please create a voucher", :body => "Please add a voucher:\r\nCustomer: #{ShortMessage.config.user_id}\r\nAmount: #{amount} sms\r\n\r\nThank you!"
|
11
|
-
end
|
12
|
-
|
13
|
-
def recharge_failed_notification amount, message
|
14
|
-
mail :to => ShortMessage.config.reload_notification_email, :subject => "SMS credit recharge failed", :body =>"SMS account could not be recharged with #{amount} sms. Error: #{body}"
|
2
|
+
class Mailer < ApplicationMailer
|
3
|
+
def error_notification message, response
|
4
|
+
mail to: ShortMessage.config.admin_notification_email, subject: "Error delivering SMS to #{message.recipient}", body: "SMS from #{message.sender} to #{message.recipient} could not be sent!\r\n\r\nResponse: #{response.to_yaml}"
|
15
5
|
end
|
16
6
|
|
17
|
-
def
|
18
|
-
mail :
|
7
|
+
def payment_required_notification
|
8
|
+
mail to: ShortMessage.config.reload_notification_email, subject: "SMS Gateway requires payment", body: "Your SMS Gateway API #{ShortMessage.config.gateway_server} requires payment!"
|
19
9
|
end
|
20
10
|
end
|
21
11
|
end
|
@@ -1,13 +1,5 @@
|
|
1
|
-
require "net/http"
|
2
|
-
|
3
1
|
module ShortMessage
|
4
2
|
class Message < ActiveRecord::Base
|
5
|
-
attr_accessible :message_key, :recipient, :sender, :status_code, :text
|
6
|
-
|
7
|
-
def status_text
|
8
|
-
I18n.t("short_message.status.code_#{self.status_code}")
|
9
|
-
end
|
10
|
-
|
11
3
|
def deliver
|
12
4
|
self.sender = ShortMessage.config.default_sms_sender if self.sender.blank?
|
13
5
|
|
@@ -17,78 +9,52 @@ module ShortMessage
|
|
17
9
|
http.use_ssl = true
|
18
10
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
19
11
|
end
|
20
|
-
response, data = http.post(ShortMessage.config.send_file_path, build_deliver_params_string)
|
21
12
|
|
22
|
-
|
23
|
-
# returns something like 0:200: OK (<mobilenumber>:<msgid>)
|
24
|
-
result_set = response.body.gsub("(","").gsub(")","").split(":")
|
25
|
-
self.status_code = result_set[0].to_i
|
26
|
-
self.message_key = result_set[3] unless result_set[3].blank?
|
13
|
+
response, data = http.post(ShortMessage.config.send_file_path, build_deliver_params_string)
|
27
14
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
else
|
32
|
-
self.status_code = 99
|
33
|
-
return false
|
34
|
-
end
|
15
|
+
if response.code == "200" or response.code == "402"
|
16
|
+
if response.code == "402" and not ShortMessage.config.reload_notification_email.blank?
|
17
|
+
ShortMessage::Mailer.payment_required_notification(self, response).deliver_now
|
35
18
|
end
|
36
19
|
|
37
|
-
|
38
|
-
|
20
|
+
result_set = response.body.gsub("(","").gsub(")","").split(" ")
|
21
|
+
self.message_key = result_set[2] unless result_set[2].blank?
|
22
|
+
|
23
|
+
return self.save
|
39
24
|
else
|
40
|
-
Mailer.error_notification(self, response).
|
41
|
-
false
|
25
|
+
ShortMessage::Mailer.error_notification(self, response).deliver_now unless ShortMessage.config.admin_notification_email.blank?
|
42
26
|
end
|
27
|
+
else
|
28
|
+
return false
|
43
29
|
end
|
44
30
|
end
|
45
31
|
|
46
|
-
def recharge
|
47
|
-
|
48
|
-
|
49
|
-
response, body = http.post(ShortMessage.config.account_functions_path, build_recharge_params_string(amount))
|
50
|
-
|
51
|
-
if response.code == "200"
|
52
|
-
# returns something like 0:Successful
|
53
|
-
result_set = response.body.split(":")
|
32
|
+
def recharge
|
33
|
+
raise "NOT YET IMPLEMENTED"
|
34
|
+
end
|
54
35
|
|
55
|
-
|
56
|
-
|
57
|
-
Mailer.recharge_notification(amount).deliver unless ShortMessage.config.reload_notification_email.blank?
|
58
|
-
Mailer.voucher_notification(amount).deliver unless ShortMessage.config.voucher_notification_email.blank?
|
59
|
-
true
|
60
|
-
else
|
61
|
-
logger.warn "SMS account could not be recharged with #{amount} sms. Error: #{body}"
|
62
|
-
Mailer.recharge_failed_notification(amount, body).deliver unless ShortMessage.config.reload_notification_email.blank?
|
63
|
-
false
|
64
|
-
end
|
65
|
-
else
|
66
|
-
"#{response.code} #{response.message}"
|
67
|
-
end
|
68
|
-
end
|
36
|
+
def status_text
|
37
|
+
I18n.t("short_message.status.code_#{self.status_code}")
|
69
38
|
end
|
70
39
|
|
71
40
|
private
|
72
41
|
def build_deliver_params_string
|
73
42
|
params = []
|
74
|
-
params << "
|
75
|
-
params << "
|
76
|
-
params << "
|
77
|
-
params << "
|
78
|
-
params << "
|
79
|
-
params << "message=#{CGI.escape(self.text)}"
|
80
|
-
params << "utf-8=1"
|
43
|
+
params << "user=#{ShortMessage.config.user}"
|
44
|
+
params << "pass=#{ShortMessage.config.password}"
|
45
|
+
params << "from=#{CGI.escape(self.sender)}"
|
46
|
+
params << "to=#{CGI.escape(self.recipient)}"
|
47
|
+
params << "text=#{CGI.escape(self.text)}"
|
81
48
|
params.join("&")
|
82
49
|
end
|
83
50
|
|
84
51
|
def build_recharge_params_string amount
|
85
|
-
|
86
|
-
params
|
87
|
-
params << "
|
88
|
-
params << "
|
89
|
-
params << "amount=#{amount}"
|
90
|
-
params
|
91
|
-
params.join("&")
|
52
|
+
raise "NOT YET IMPLEMENTED"
|
53
|
+
# params = []
|
54
|
+
# params << "user=#{ShortMessage.config.user}"
|
55
|
+
# params << "password=#{ShortMessage.config.password}"
|
56
|
+
# params << "amount=#{amount}"
|
57
|
+
# params.join("&")
|
92
58
|
end
|
93
59
|
end
|
94
60
|
end
|
data/config/routes.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
ShortMessage.configure do |config|
|
2
|
-
|
2
|
+
# Configuration example www.gtx-messaging.com
|
3
|
+
config.gateway_server = "http.gtx-messaging.net"
|
3
4
|
config.gateway_port = 443
|
4
5
|
|
5
|
-
config.send_file_path = "/
|
6
|
-
config.account_functions_path = "
|
6
|
+
config.send_file_path = "/smsc.php"
|
7
|
+
# config.account_functions_path = ""
|
7
8
|
|
8
9
|
# enter your details received from provider here
|
9
|
-
config.
|
10
|
-
config.
|
11
|
-
config.id_string = ""
|
10
|
+
config.user = ""
|
11
|
+
config.password = ""
|
12
12
|
|
13
|
-
config.default_reload_amount = 1000
|
13
|
+
# config.default_reload_amount = 1000
|
14
14
|
|
15
15
|
config.default_mail_sender = "webmaster@your-domain.com"
|
16
|
-
config.reload_notification_email = "webmaster@your-domain.com"
|
17
|
-
config.admin_notification_email = "webmaster@your-domain.com" # set
|
18
|
-
config.voucher_notification_email = "give-me-money@your-domain.com" # set nil to disable voucher mailing
|
16
|
+
config.reload_notification_email = "webmaster@your-domain.com" # send a message if payment is required
|
17
|
+
config.admin_notification_email = "webmaster@your-domain.com" # set nil to deactivate error mailing
|
18
|
+
# config.voucher_notification_email = "give-me-money@your-domain.com" # set nil to disable voucher mailing
|
19
19
|
|
20
20
|
# set a default sms sender (used if no sender is present)
|
21
21
|
# config.default_sms_sender = ""
|
@@ -1,14 +1,8 @@
|
|
1
1
|
de:
|
2
2
|
short_message:
|
3
3
|
status:
|
4
|
-
code_1: "
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
code_18: "abgewiesen"
|
10
|
-
code_20: "nicht verfügbar während Roaming"
|
11
|
-
code_21: "unerwarteter Wert"
|
12
|
-
code_22: "unbekannter Abonnent"
|
13
|
-
code_99: "Aufladen fehlgeschlagen"
|
14
|
-
code_999: "unkategorisierter Status"
|
4
|
+
code_1: "An Telefon zugestellt"
|
5
|
+
code_2: "Nicht an Telefon zugestellt"
|
6
|
+
code_4: "Bei SMSC in Warteschlange"
|
7
|
+
code_8: "Zugestellt an SMSC"
|
8
|
+
code_16: "Nicht zugestellt an SMSC"
|
@@ -1,14 +1,8 @@
|
|
1
1
|
en:
|
2
2
|
short_message:
|
3
3
|
status:
|
4
|
-
code_1: "
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
code_18: "rejected by gateway"
|
10
|
-
code_20: "unavailable while roaming to"
|
11
|
-
code_21: "unexpected data value"
|
12
|
-
code_22: "unknown subscriber"
|
13
|
-
code_99: "recharge failed"
|
14
|
-
code_999: "uncategorized status"
|
4
|
+
code_1: "Delivered to phone"
|
5
|
+
code_2: "Not delivered to phone"
|
6
|
+
code_4: "Queued on SMSC"
|
7
|
+
code_8: "Delivered to SMSC"
|
8
|
+
code_16: "Not delivered to SMSC"
|
data/lib/short_message/config.rb
CHANGED
@@ -16,9 +16,8 @@ module ShortMessage
|
|
16
16
|
config_accessor :send_file_path
|
17
17
|
config_accessor :account_functions_path
|
18
18
|
|
19
|
-
config_accessor :
|
20
|
-
config_accessor :
|
21
|
-
config_accessor :id_string
|
19
|
+
config_accessor :user
|
20
|
+
config_accessor :password
|
22
21
|
|
23
22
|
config_accessor :default_sms_sender
|
24
23
|
config_accessor :default_reload_amount
|
@@ -31,7 +30,7 @@ module ShortMessage
|
|
31
30
|
config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
|
32
31
|
end
|
33
32
|
|
34
|
-
# define param_name writer
|
33
|
+
# define param_name writer
|
35
34
|
writer, line = 'def param_name=(value); config.param_name = value; end', __LINE__
|
36
35
|
singleton_class.class_eval writer, __FILE__, line
|
37
36
|
class_eval writer, __FILE__, line
|
data/lib/short_message/engine.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
module ShortMessage
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace ShortMessage
|
4
|
-
|
4
|
+
|
5
5
|
initializer "short_message.migrate_database" do |app|
|
6
6
|
Rails.application.config.paths['db/migrate'] << paths["db/migrate"].expanded.join
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
config.generators do |g|
|
10
|
-
g.test_framework
|
11
|
-
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
10
|
+
g.test_framework false
|
12
11
|
g.assets false
|
13
12
|
g.helper false
|
14
13
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
@@ -1,7 +1,6 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
3
|
|
5
4
|
require File.expand_path('../config/application', __FILE__)
|
6
5
|
|
7
|
-
|
6
|
+
Rails.application.load_tasks
|
@@ -2,14 +2,12 @@
|
|
2
2
|
// listed below.
|
3
3
|
//
|
4
4
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
6
|
//
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
//
|
8
|
+
// compiled file.
|
9
9
|
//
|
10
|
-
//
|
11
|
-
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
12
|
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
13
|
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "short_message"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
|
22
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
+
config.active_record.raise_in_transactional_callbacks = true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|