webappsword_sdk 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +24 -0
  4. data/README.md +67 -0
  5. data/Rakefile +20 -0
  6. data/VERSION +1 -0
  7. data/bin/webappsword_sdk +85 -0
  8. data/easy_installer-0.0.1.gem +0 -0
  9. data/example/Rakefile +72 -0
  10. data/example/additional/after_install.rb +1 -0
  11. data/example/additional/return_callback.rb +2 -0
  12. data/example/arch.zip +0 -0
  13. data/example/config.yml +6 -0
  14. data/example/files/joomla/index.php +54 -0
  15. data/example/installers/global.rb +2 -0
  16. data/example/installers/local.rb +2 -0
  17. data/example/validators/ftp.rb +6 -0
  18. data/example/validators/local.rb +0 -0
  19. data/lib/easy_installer.rb +4 -0
  20. data/lib/easy_installer/autoload.rb +28 -0
  21. data/lib/easy_installer/coffeescript_sandbox.rb +95 -0
  22. data/lib/easy_installer/config.rb +138 -0
  23. data/lib/easy_installer/config_validator.rb +73 -0
  24. data/lib/easy_installer/fake/ftp/install_helper.rb +34 -0
  25. data/lib/easy_installer/fake/ftp/validate_helper.rb +12 -0
  26. data/lib/easy_installer/fake/local/install_helper.rb +30 -0
  27. data/lib/easy_installer/fake/local/standart_input.yml +2 -0
  28. data/lib/easy_installer/fake/local/validate_helper.rb +6 -0
  29. data/lib/easy_installer/fake/php/validate_helper.rb +12 -0
  30. data/lib/easy_installer/fake/validator.rb +0 -0
  31. data/lib/easy_installer/fake/zip.rb +9 -0
  32. data/lib/easy_installer/generators/base.rb +25 -0
  33. data/lib/easy_installer/generators/config.rb +58 -0
  34. data/lib/easy_installer/install.rb +56 -0
  35. data/lib/easy_installer/install_helpers/result.rb +14 -0
  36. data/lib/easy_installer/install_helpers/template.rb +19 -0
  37. data/lib/easy_installer/install_helpers/zip.rb +9 -0
  38. data/lib/easy_installer/methods/ftp/install_helper.rb +105 -0
  39. data/lib/easy_installer/methods/ftp/standart_input.yml +5 -0
  40. data/lib/easy_installer/methods/ftp/standart_input.yml~ +5 -0
  41. data/lib/easy_installer/methods/ftp/validate_helper.rb +24 -0
  42. data/lib/easy_installer/methods/local/install_helper.rb +37 -0
  43. data/lib/easy_installer/methods/local/standart_input.yml +2 -0
  44. data/lib/easy_installer/methods/local/validate_helper.rb +4 -0
  45. data/lib/easy_installer/methods/sample/install_helper.rb +67 -0
  46. data/lib/easy_installer/methods/sample/standart_input.yml +5 -0
  47. data/lib/easy_installer/methods/sample/standart_input.yml~ +5 -0
  48. data/lib/easy_installer/methods/sample/validate_helper.rb +17 -0
  49. data/lib/easy_installer/modules/php/standart_input.yml +6 -0
  50. data/lib/easy_installer/modules/php/validate_helper.rb +47 -0
  51. data/lib/easy_installer/sandbox.rb +100 -0
  52. data/lib/easy_installer/sandbox_modules/message.rb +62 -0
  53. data/lib/easy_installer/steps.rb +36 -0
  54. data/lib/easy_installer/temp.rb +23 -0
  55. data/lib/easy_installer/translate.rb +70 -0
  56. data/lib/easy_installer/validator.rb +99 -0
  57. data/lib/easy_installer/validator_support_methods.rb +37 -0
  58. data/tests/files/additional/after_install.rb +1 -0
  59. data/tests/files/config.yml +10 -0
  60. data/tests/files/installers/global.rb +1 -0
  61. data/tests/files/installers/local.rb +1 -0
  62. data/tests/files/sample.zip +0 -0
  63. data/tests/files/template.erb +1 -0
  64. data/tests/files/translations/pl.yml +11 -0
  65. data/tests/files/validators/ftp.rb +3 -0
  66. data/tests/files/validators/local.rb +0 -0
  67. data/tests/files/validators/sample.rb +2 -0
  68. data/tests/test_config.rb +30 -0
  69. data/tests/test_config_validator.rb +22 -0
  70. data/tests/test_ftp.rb +51 -0
  71. data/tests/test_install.rb +19 -0
  72. data/tests/test_sandbox.rb +48 -0
  73. data/tests/test_sandbox_messages.rb +18 -0
  74. data/tests/test_steps.rb +19 -0
  75. data/tests/test_temp.rb +14 -0
  76. data/tests/test_template.rb +17 -0
  77. data/tests/test_validator.rb +31 -0
  78. data/tests/test_zip.rb +26 -0
  79. data/tests/wrong_config/config.yml +6 -0
  80. data/tests/wrong_config/install/global.rb +2 -0
  81. data/tests/wrong_config/install/local.rb +1 -0
  82. data/tests/wrong_config/translations/pl.yml +11 -0
  83. data/tests/wrong_config/validators/ftp.rb +4 -0
  84. data/tests/wrong_config/validators/local.rb +0 -0
  85. data/tests/wrong_config/validators/sample.rb +3 -0
  86. data/tests/~test_translator.rb +17 -0
  87. data/webappsword_sdk.gemspec +24 -0
  88. metadata +149 -0
@@ -0,0 +1,19 @@
1
+ require 'test/unit'
2
+ require 'easy_installer/temp'
3
+ require 'easy_installer/install'
4
+ require 'yaml'
5
+
6
+ class TestTemp< Test::Unit::TestCase
7
+ def test_installation
8
+ #go to example dir
9
+ Dir.chdir("example")
10
+ #testing code
11
+ config = EasyInstaller::Config.new("config.yml")
12
+ config.method = "local"
13
+ install = EasyInstaller::Installer.new(config)
14
+ assert_kind_of(EasyInstaller::Sandbox, install.install("true"))
15
+ assert_equal(true, install.success?)
16
+ #back to root dir
17
+ Dir.chdir("../")
18
+ end
19
+ end
@@ -0,0 +1,48 @@
1
+ require 'test/unit'
2
+ require 'easy_installer/sandbox'
3
+ require 'easy_installer/install_helpers/result'
4
+ require 'yaml'
5
+ class TestSandbox< Test::Unit::TestCase
6
+
7
+ def test_evaling_sample_code
8
+ code = "true"
9
+ evaluator = EasyInstaller::Sandbox.new(code)
10
+ assert_equal(true, evaluator.eval)
11
+ end
12
+
13
+ def test_helper
14
+ code = "message('display', 'ok')"
15
+ evaluator = EasyInstaller::Sandbox.new(code)
16
+ evaluator.helpers << EasyInstaller::ResultHelper
17
+ evaluator.eval
18
+ end
19
+
20
+ def test_returned
21
+ code = "
22
+ add_message('info', 'sample')
23
+ true"
24
+ evaluator = EasyInstaller::Sandbox.new(code)
25
+ evaluator.add_module(EasyInstaller::Sandbox::Message)
26
+ assert_raise(RuntimeError) { evaluator.returned }
27
+ evaluator.eval
28
+ assert_nothing_raised(RuntimeError) { evaluator.returned_raw }
29
+ assert_nothing_raised(Exception) { evaluator.returned }
30
+ assert_not_nil(evaluator.returned.messages)
31
+ end
32
+
33
+ def test_inputs
34
+ code = "
35
+ add_message('info', @inputs)
36
+ true"
37
+ evaluator = EasyInstaller::Sandbox.new(code)
38
+
39
+ evaluator.inputs = {
40
+ :test => "qwe"
41
+ }
42
+ evaluator.add_module(EasyInstaller::Sandbox::Message)
43
+ evaluator.eval
44
+ assert_equal("qwe", evaluator.returned.messages[0].raw["test"])
45
+
46
+ end
47
+
48
+ end
@@ -0,0 +1,18 @@
1
+ require 'test/unit'
2
+ require 'easy_installer/sandbox'
3
+ require 'easy_installer/sandbox_modules/message'
4
+
5
+ class TestSandboxMessages< Test::Unit::TestCase
6
+ def test_sample_message
7
+ code = "
8
+ add_message('info', 'sample')
9
+ redirect_to('http:/google/pl')
10
+ "
11
+ evaluator = EasyInstaller::Sandbox.new(code)
12
+ evaluator.add_module(EasyInstaller::Sandbox::Message)
13
+ assert_equal(true, evaluator.eval)
14
+ assert_kind_of(V8::Array, evaluator.returned_raw)
15
+ assert_kind_of(EasyInstaller::Sandbox::Result, evaluator.returned)
16
+ assert_kind_of(String, evaluator.returned.messages[0].to_s)
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ require 'test/unit'
2
+ require 'easy_installer'
3
+
4
+
5
+ class TestSteps< Test::Unit::TestCase
6
+ def test_after_install
7
+ config = EasyInstaller::Config.new("tests/files/config.yml")
8
+ steps = EasyInstaller::Steps.new(config, "ftp")
9
+ evaluator = steps.after_install
10
+ assert_kind_of(Array,evaluator.returned.messages)
11
+ end
12
+ #
13
+ # def test_callback_dunction
14
+ # config = EasyInstaller::Config.new("tests/files/config.yml")
15
+ # steps = EasyInstaller::Steps.new(config, "ftp")
16
+ # steps.return_callback({})
17
+ # end
18
+
19
+ end
@@ -0,0 +1,14 @@
1
+ require 'test/unit'
2
+ require 'easy_installer/temp'
3
+
4
+ class TestTemp< Test::Unit::TestCase
5
+
6
+ def test_coping_sample_file
7
+ temp = EasyInstaller::Temp.new
8
+ temp.copy_to_tempdir("tests/files/sample.zip")
9
+ path_to_temp_file =File.join(temp.tempdir, "sample.zip")
10
+ assert_equal(true, File.exists?(path_to_temp_file))
11
+ temp.clear
12
+ assert_equal(false, File.exists?(path_to_temp_file))
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ require 'test/unit'
2
+ require 'easy_installer/install_helpers/template'
3
+ require 'fileutils'
4
+
5
+ class TestConfig< Test::Unit::TestCase
6
+ include EasyInstaller::InstallHelper::Template
7
+ def setup
8
+ File.open("tests/files/template.erb","w"){|f| f.write("<%= @sample %>one") }
9
+ end
10
+
11
+ def test_reading_template
12
+ define_template "tests/files/template.erb"
13
+ @sample = "test"
14
+ save_templates
15
+ assert_equal("testone", File.read("tests/files/template.erb"))
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ require 'test/unit'
2
+ require 'easy_installer/validator'
3
+ require 'yaml'
4
+
5
+
6
+ class TestValidator < Test::Unit::TestCase
7
+
8
+ def setup
9
+ $user_input = {
10
+ "http_address" => "sample",
11
+ "path" => "qwert"
12
+ }
13
+ Dir.chdir("tests") if File.exist?("tests")
14
+ @config = EasyInstaller::Config.new("files/config.yml")
15
+ @validator = EasyInstaller::Validator.new(@config)
16
+ end
17
+
18
+ def test_autoload_from_config
19
+ @validator.import_from_config_by_method "sample"
20
+ assert(@validator.check($user_input), "Error then importing from config")
21
+ @validator.import_from_config_by_method "ftp"
22
+ assert(!@validator.check($user_input), "Error then importing from config")
23
+ assert(@validator.inputs_errors["path"], "Can't connect")
24
+ end
25
+
26
+ def teardown
27
+ @validator.clear_checking_functions
28
+ Dir.chdir("../../") if Dir.pwd.split('/').last == "easy_installer"
29
+ end
30
+
31
+ end
@@ -0,0 +1,26 @@
1
+ require 'test/unit'
2
+ require 'easy_installer/install_helpers/zip'
3
+ class TestZip< Test::Unit::TestCase
4
+ include EasyInstaller::InstallHelper::ZipFile
5
+
6
+ def setup
7
+ Dir.chdir("tests") if File.exist?("tests")
8
+ end
9
+
10
+ def test_costam
11
+ unzip "files/sample.zip", "files/unziped"
12
+ assert File.exist?("files/unziped/Rakefile"), "Unizp fails"
13
+ end
14
+
15
+ def test_unzip_with_thread
16
+ a = Thread.new { unzip "files/sample.zip", "files/unziped" }
17
+ a.join
18
+ assert File.exist?("files/unziped/Rakefile"), "Unizp fails"
19
+
20
+ end
21
+
22
+ def teardown
23
+ FileUtils.rm_rf "files/unziped"
24
+ end
25
+
26
+ end
@@ -0,0 +1,6 @@
1
+ methods:
2
+ - ftp
3
+ - local
4
+ lang: "php"
5
+ submodules:
6
+ - mysql
@@ -0,0 +1,2 @@
1
+ smaplefictionfunctionwhichfuckingdontexist
2
+ false
@@ -0,0 +1,11 @@
1
+ input:
2
+ path:
3
+ name: "sciezka"
4
+ description: "ścieżka do"
5
+ method:
6
+ ftp:
7
+ title: "FTP"
8
+ description: "Zainstaluj za pomocą FTP"
9
+ app:
10
+ info: "Info about jooma which is cool"
11
+ info2: "This could be info about what you need to install joomla on your machine"
@@ -0,0 +1,4 @@
1
+ check :for=>["http_address", "path"] do
2
+ raise "Can't connect"
3
+ false
4
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ check :for=>["http_address", "path"] do
2
+ true
3
+ end
@@ -0,0 +1,17 @@
1
+ # $LOAD_PATH << '../lib/'
2
+ # require 'test/unit'
3
+ # require 'easy_installer/autoload'
4
+ #
5
+ # class TestTranslator < Test::Unit::TestCase
6
+ # def setup
7
+ # EasyInstaller::Translate.translation_file_path = "tests/files/translations"
8
+ # EasyInstaller::Translate.set_location(:pl)
9
+ # end
10
+ # def test_valid
11
+ # assert_equal("sciezka", EasyInstaller::Translate.input("path", :name), "can't read translations data")
12
+ # end
13
+ #
14
+ # def test_invalid
15
+ # assert_equal("qwerasdzxc", EasyInstaller::Translate.input("qwerasdzxc", :name), "error handling invalid data")
16
+ # end
17
+ # end
@@ -0,0 +1,24 @@
1
+ version = File.read(File.expand_path("../VERSION",__FILE__)).strip
2
+
3
+ Gem::Specification.new do |s|
4
+ s.platform = Gem::Platform::RUBY
5
+ s.name = 'webappsword_sdk'
6
+ s.version = version
7
+ s.summary = 'SDK for webappsword'
8
+ s.description = 'SDK for webappsword'
9
+
10
+ s.required_ruby_version = '>= 1.9.3'
11
+ s.required_rubygems_version = ">= 1.7.1"
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+
15
+ s.author = 'EasyApps'
16
+ s.email = 'contact@easyapps.pl'
17
+ s.homepage = 'http://webappswrodd.com'
18
+
19
+ s.bindir = 'bin'
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_dependency('rdoc', '~> 3.11')
24
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webappsword_sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - EasyApps
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.11'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.11'
30
+ description: SDK for webappsword
31
+ email: contact@easyapps.pl
32
+ executables:
33
+ - webappsword_sdk
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - Gemfile.lock
40
+ - README.md
41
+ - Rakefile
42
+ - VERSION
43
+ - bin/webappsword_sdk
44
+ - easy_installer-0.0.1.gem
45
+ - example/Rakefile
46
+ - example/additional/after_install.rb
47
+ - example/additional/return_callback.rb
48
+ - example/arch.zip
49
+ - example/config.yml
50
+ - example/files/joomla/index.php
51
+ - example/installers/global.rb
52
+ - example/installers/local.rb
53
+ - example/validators/ftp.rb
54
+ - example/validators/local.rb
55
+ - lib/easy_installer.rb
56
+ - lib/easy_installer/autoload.rb
57
+ - lib/easy_installer/coffeescript_sandbox.rb
58
+ - lib/easy_installer/config.rb
59
+ - lib/easy_installer/config_validator.rb
60
+ - lib/easy_installer/fake/ftp/install_helper.rb
61
+ - lib/easy_installer/fake/ftp/validate_helper.rb
62
+ - lib/easy_installer/fake/local/install_helper.rb
63
+ - lib/easy_installer/fake/local/standart_input.yml
64
+ - lib/easy_installer/fake/local/validate_helper.rb
65
+ - lib/easy_installer/fake/php/validate_helper.rb
66
+ - lib/easy_installer/fake/validator.rb
67
+ - lib/easy_installer/fake/zip.rb
68
+ - lib/easy_installer/generators/base.rb
69
+ - lib/easy_installer/generators/config.rb
70
+ - lib/easy_installer/install.rb
71
+ - lib/easy_installer/install_helpers/result.rb
72
+ - lib/easy_installer/install_helpers/template.rb
73
+ - lib/easy_installer/install_helpers/zip.rb
74
+ - lib/easy_installer/methods/ftp/install_helper.rb
75
+ - lib/easy_installer/methods/ftp/standart_input.yml
76
+ - lib/easy_installer/methods/ftp/standart_input.yml~
77
+ - lib/easy_installer/methods/ftp/validate_helper.rb
78
+ - lib/easy_installer/methods/local/install_helper.rb
79
+ - lib/easy_installer/methods/local/standart_input.yml
80
+ - lib/easy_installer/methods/local/validate_helper.rb
81
+ - lib/easy_installer/methods/sample/install_helper.rb
82
+ - lib/easy_installer/methods/sample/standart_input.yml
83
+ - lib/easy_installer/methods/sample/standart_input.yml~
84
+ - lib/easy_installer/methods/sample/validate_helper.rb
85
+ - lib/easy_installer/modules/php/standart_input.yml
86
+ - lib/easy_installer/modules/php/validate_helper.rb
87
+ - lib/easy_installer/sandbox.rb
88
+ - lib/easy_installer/sandbox_modules/message.rb
89
+ - lib/easy_installer/steps.rb
90
+ - lib/easy_installer/temp.rb
91
+ - lib/easy_installer/translate.rb
92
+ - lib/easy_installer/validator.rb
93
+ - lib/easy_installer/validator_support_methods.rb
94
+ - tests/files/additional/after_install.rb
95
+ - tests/files/config.yml
96
+ - tests/files/installers/global.rb
97
+ - tests/files/installers/local.rb
98
+ - tests/files/sample.zip
99
+ - tests/files/template.erb
100
+ - tests/files/translations/pl.yml
101
+ - tests/files/validators/ftp.rb
102
+ - tests/files/validators/local.rb
103
+ - tests/files/validators/sample.rb
104
+ - tests/test_config.rb
105
+ - tests/test_config_validator.rb
106
+ - tests/test_ftp.rb
107
+ - tests/test_install.rb
108
+ - tests/test_sandbox.rb
109
+ - tests/test_sandbox_messages.rb
110
+ - tests/test_steps.rb
111
+ - tests/test_temp.rb
112
+ - tests/test_template.rb
113
+ - tests/test_validator.rb
114
+ - tests/test_zip.rb
115
+ - tests/wrong_config/config.yml
116
+ - tests/wrong_config/install/global.rb
117
+ - tests/wrong_config/install/local.rb
118
+ - tests/wrong_config/translations/pl.yml
119
+ - tests/wrong_config/validators/ftp.rb
120
+ - tests/wrong_config/validators/local.rb
121
+ - tests/wrong_config/validators/sample.rb
122
+ - tests/~test_translator.rb
123
+ - webappsword_sdk.gemspec
124
+ homepage: http://webappswrodd.com
125
+ licenses: []
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: 1.9.3
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 1.7.1
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 1.8.23
145
+ signing_key:
146
+ specification_version: 3
147
+ summary: SDK for webappsword
148
+ test_files: []
149
+ has_rdoc: