cableguy 0.2.3 → 0.5.0.pre2

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.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +59 -1
  3. data/Gemfile +6 -5
  4. data/Gemfile.lock +38 -0
  5. data/LICENSE.md +20 -0
  6. data/README.md +28 -0
  7. data/Rakefile +23 -1
  8. data/bin/cable +2 -37
  9. data/cableguy.gemspec +15 -17
  10. data/lib/palmade/cableguy/builders/cable_chmod.rb +3 -5
  11. data/lib/palmade/cableguy/builders/cable_copy.rb +2 -5
  12. data/lib/palmade/cableguy/builders/cable_custom.rb +6 -3
  13. data/lib/palmade/cableguy/builders/cable_mkdir.rb +3 -6
  14. data/lib/palmade/cableguy/builders/cable_move.rb +2 -5
  15. data/lib/palmade/cableguy/builders/cable_symlink.rb +4 -7
  16. data/lib/palmade/cableguy/builders/cable_template.rb +25 -9
  17. data/lib/palmade/cableguy/builders.rb +7 -8
  18. data/lib/palmade/cableguy/cable.rb +1 -24
  19. data/lib/palmade/cableguy/cablefile.rb +107 -0
  20. data/lib/palmade/cableguy/cabler.rb +257 -53
  21. data/lib/palmade/cableguy/cabling_values.rb +54 -0
  22. data/lib/palmade/cableguy/cli.rb +232 -0
  23. data/lib/palmade/cableguy/cli_helper.rb +18 -0
  24. data/lib/palmade/cableguy/configurator.rb +19 -20
  25. data/lib/palmade/cableguy/constants.rb +17 -2
  26. data/lib/palmade/cableguy/db.rb +115 -66
  27. data/lib/palmade/cableguy/{cable_configurator.rb → legacy_configurator.rb} +1 -2
  28. data/lib/palmade/cableguy/migration.rb +37 -61
  29. data/lib/palmade/cableguy/migrator.rb +124 -0
  30. data/lib/palmade/cableguy/templatebinding.rb +23 -16
  31. data/lib/palmade/cableguy/utils.rb +6 -7
  32. data/lib/palmade/cableguy/version.rb +1 -1
  33. data/lib/palmade/cableguy.rb +19 -34
  34. data/test/.cabling_values.yml +9 -0
  35. data/test/app/Cablefile +10 -0
  36. data/test/app/cabling/base/blog.rb +21 -0
  37. data/test/app/cabling/init.rb +16 -0
  38. data/test/app/config/templates/blog.yml +10 -0
  39. data/test/app_cabling_test.rb +33 -0
  40. data/test/boboot.rb +53 -0
  41. data/test/boot_test.rb +25 -0
  42. data/test/cablefile_test.rb +44 -0
  43. data/test/cabler_test.rb +45 -0
  44. data/test/cabling/base/blog.rb +17 -0
  45. data/test/cabling/init.rb +16 -0
  46. data/test/cabling_values_test.rb +24 -0
  47. data/test/cli_lock_test.rb +28 -0
  48. data/test/cli_test.rb +88 -0
  49. data/test/configure_test.rb +31 -0
  50. data/test/db_methods_test.rb +19 -0
  51. data/test/migrate_legacy_test.rb +34 -0
  52. data/test/migrate_test.rb +39 -0
  53. data/test/test_apply/config/blog.yml +10 -0
  54. data/test/test_helper.rb +81 -0
  55. metadata +93 -29
  56. data/Manifest +0 -19
  57. data/README +0 -1
  58. data/lib/palmade/cableguy/runner.rb +0 -44
@@ -0,0 +1,10 @@
1
+ auth:
2
+ require_2fa: true
3
+ twitter_auth: true
4
+
5
+ database:
6
+ adapter: mysql
7
+ host: 127.0.0.1
8
+ port: 3306
9
+ username: root
10
+ password: password
@@ -0,0 +1,81 @@
1
+ require File.expand_path('../boboot', __FILE__)
2
+ require 'minitest'
3
+ require 'palmade/cableguy'
4
+
5
+ require 'pp'
6
+
7
+ CABLEGUY_TEST_PATH = File.join(CABLEGUY_ROOT_PATH, 'test')
8
+
9
+ module TestHelper
10
+ include Palmade::Cableguy::Constants
11
+
12
+ TEST_APP_ROOT = File.join(CABLEGUY_TEST_PATH, 'app')
13
+ TEST_APPLY_ROOT = File.join(CABLEGUY_TEST_PATH, 'test_apply')
14
+
15
+ TEST_CABLING_PATH = File.join(CABLEGUY_TEST_PATH, 'cabling')
16
+ TEST_CABLING_VALUES_PATH = File.join(CABLEGUY_TEST_PATH, '.cabling_values.yml')
17
+
18
+ Palmade::Cableguy::Constants::DEFAULT_LOCK_PATH.replace('')
19
+
20
+ def self.configure(app_root = nil, options = { })
21
+ opts = {
22
+ :path => TEST_CABLING_PATH,
23
+ :values_path => TEST_CABLING_VALUES_PATH,
24
+ :target => :test,
25
+ :location => nil,
26
+ :include_global_cabling => true
27
+ }.merge(options)
28
+
29
+ Palmade::Cableguy.boot_cabler(app_root || TEST_APP_ROOT, opts)
30
+ end
31
+
32
+ def self.new_cli_tester(cmd, args = nil)
33
+ if args.nil?
34
+ args = [ '--silent',
35
+ '--app-root=%s' % TestHelper::TEST_APP_ROOT,
36
+ '--include-global-cabling',
37
+ '--nolock',
38
+ '--path=%s' % TestHelper::TEST_CABLING_PATH,
39
+ '--values-path=%s' % TestHelper::TEST_CABLING_VALUES_PATH
40
+ ]
41
+ else
42
+ args += [ '--silent',
43
+ '--app-root=%s' % TestHelper::TEST_APP_ROOT,
44
+ '--include-global-cabling'
45
+ ]
46
+ end
47
+
48
+ cli_k = Palmade::Cableguy::CLI
49
+
50
+ command = cli_k.all_commands[cmd]
51
+ if command.nil?
52
+ command = Thor::DynamicCommand.new(cmd)
53
+ end
54
+
55
+ config = { }
56
+ config[:current_command] = command
57
+ config[:command_options] = command.options
58
+
59
+ cli = Palmade::Cableguy::CLI.new([ ], args, config)
60
+ cli.raise_error = true
61
+ cli
62
+ end
63
+
64
+ def self.unload_cabling
65
+ if defined?(TestCableguyCabling::Base::Blog)
66
+ TestCableguyCabling::Base.send(:remove_const, :Blog)
67
+ end
68
+
69
+ if defined?(TestCableguyAppCabling::Base::Blog)
70
+ TestCableguyAppCabling::Base.send(:remove_const, :Blog)
71
+ end
72
+ end
73
+
74
+ def self.disable_default_cabling_path(&block)
75
+ default_cabling_path = DEFAULT_CABLING_PATH
76
+ DEFAULT_CABLING_PATH.replace('/tmp/path_to_nowhere-%s' % $$)
77
+ ret = yield
78
+ DEFAULT_CABLING_PATH.replace(default_cabling_path)
79
+ ret
80
+ end
81
+ end
metadata CHANGED
@@ -1,50 +1,70 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cableguy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
5
- prerelease:
4
+ version: 0.5.0.pre2
6
5
  platform: ruby
7
6
  authors:
8
- - Jan Mendoza
7
+ - Cebu Code Campers
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-27 00:00:00.000000000Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: sqlite3
16
- requirement: &13051580 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *13051580
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: sequel
27
- requirement: &13050520 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
29
37
  requirements:
30
- - - ! '>='
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
31
46
  - !ruby/object:Gem::Version
32
47
  version: '0'
33
48
  type: :runtime
34
49
  prerelease: false
35
- version_requirements: *13050520
36
- description: cableguy
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Generate configurations based on a template and a cabling database
37
56
  email:
38
- - poymode@gmail.com
57
+ - core@cebucodecamp.org
39
58
  executables:
40
59
  - cable
41
60
  extensions: []
42
61
  extra_rdoc_files: []
43
62
  files:
44
- - .gitignore
63
+ - ".gitignore"
45
64
  - Gemfile
46
- - Manifest
47
- - README
65
+ - Gemfile.lock
66
+ - LICENSE.md
67
+ - README.md
48
68
  - Rakefile
49
69
  - bin/cable
50
70
  - cableguy.gemspec
@@ -58,38 +78,82 @@ files:
58
78
  - lib/palmade/cableguy/builders/cable_symlink.rb
59
79
  - lib/palmade/cableguy/builders/cable_template.rb
60
80
  - lib/palmade/cableguy/cable.rb
61
- - lib/palmade/cableguy/cable_configurator.rb
81
+ - lib/palmade/cableguy/cablefile.rb
62
82
  - lib/palmade/cableguy/cabler.rb
83
+ - lib/palmade/cableguy/cabling_values.rb
84
+ - lib/palmade/cableguy/cli.rb
85
+ - lib/palmade/cableguy/cli_helper.rb
63
86
  - lib/palmade/cableguy/configurator.rb
64
87
  - lib/palmade/cableguy/constants.rb
65
88
  - lib/palmade/cableguy/db.rb
89
+ - lib/palmade/cableguy/legacy_configurator.rb
66
90
  - lib/palmade/cableguy/migration.rb
67
- - lib/palmade/cableguy/runner.rb
91
+ - lib/palmade/cableguy/migrator.rb
68
92
  - lib/palmade/cableguy/templatebinding.rb
69
93
  - lib/palmade/cableguy/utils.rb
70
94
  - lib/palmade/cableguy/version.rb
71
- homepage: https://github.com/poymode/cableguy
95
+ - test/.cabling_values.yml
96
+ - test/app/Cablefile
97
+ - test/app/cabling/base/blog.rb
98
+ - test/app/cabling/init.rb
99
+ - test/app/config/templates/blog.yml
100
+ - test/app_cabling_test.rb
101
+ - test/boboot.rb
102
+ - test/boot_test.rb
103
+ - test/cablefile_test.rb
104
+ - test/cabler_test.rb
105
+ - test/cabling/base/blog.rb
106
+ - test/cabling/init.rb
107
+ - test/cabling_values_test.rb
108
+ - test/cli_lock_test.rb
109
+ - test/cli_test.rb
110
+ - test/configure_test.rb
111
+ - test/db_methods_test.rb
112
+ - test/migrate_legacy_test.rb
113
+ - test/migrate_test.rb
114
+ - test/test_apply/config/blog.yml
115
+ - test/test_helper.rb
116
+ homepage: https://github.com/cebucodecamp/cableguy
72
117
  licenses: []
118
+ metadata: {}
73
119
  post_install_message:
74
120
  rdoc_options: []
75
121
  require_paths:
76
122
  - lib
77
123
  required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
124
  requirements:
80
- - - ! '>='
125
+ - - ">="
81
126
  - !ruby/object:Gem::Version
82
127
  version: '0'
83
128
  required_rubygems_version: !ruby/object:Gem::Requirement
84
- none: false
85
129
  requirements:
86
- - - ! '>='
130
+ - - ">"
87
131
  - !ruby/object:Gem::Version
88
- version: '0'
132
+ version: 1.3.1
89
133
  requirements: []
90
134
  rubyforge_project: cableguy
91
- rubygems_version: 1.8.10
135
+ rubygems_version: 2.6.11
92
136
  signing_key:
93
- specification_version: 3
94
- summary: Generate rails configurations from a sqlite key-value storage
95
- test_files: []
137
+ specification_version: 4
138
+ summary: Generate configurations based on a template and a cabling database
139
+ test_files:
140
+ - test/app/Cablefile
141
+ - test/app/cabling/base/blog.rb
142
+ - test/app/cabling/init.rb
143
+ - test/app/config/templates/blog.yml
144
+ - test/app_cabling_test.rb
145
+ - test/boboot.rb
146
+ - test/boot_test.rb
147
+ - test/cablefile_test.rb
148
+ - test/cabler_test.rb
149
+ - test/cabling/base/blog.rb
150
+ - test/cabling/init.rb
151
+ - test/cabling_values_test.rb
152
+ - test/cli_lock_test.rb
153
+ - test/cli_test.rb
154
+ - test/configure_test.rb
155
+ - test/db_methods_test.rb
156
+ - test/migrate_legacy_test.rb
157
+ - test/migrate_test.rb
158
+ - test/test_apply/config/blog.yml
159
+ - test/test_helper.rb
data/Manifest DELETED
@@ -1,19 +0,0 @@
1
- README
2
- Rakefile
3
- bin/cable
4
- lib/palmade/cableguy.rb
5
- lib/palmade/cableguy/builders.rb
6
- lib/palmade/cableguy/builders/cable_chmod.rb
7
- lib/palmade/cableguy/builders/cable_copy.rb
8
- lib/palmade/cableguy/builders/cable_custom.rb
9
- lib/palmade/cableguy/builders/cable_mkdir.rb
10
- lib/palmade/cableguy/builders/cable_move.rb
11
- lib/palmade/cableguy/builders/cable_symlink.rb
12
- lib/palmade/cableguy/builders/cable_template.rb
13
- lib/palmade/cableguy/cable.rb
14
- lib/palmade/cableguy/cable_configurator.rb
15
- lib/palmade/cableguy/cabler.rb
16
- lib/palmade/cableguy/configurator.rb
17
- lib/palmade/cableguy/templatebinding.rb
18
- lib/palmade/hash.rb
19
- Manifest
data/README DELETED
@@ -1 +0,0 @@
1
- Build config files for your rails apps
@@ -1,44 +0,0 @@
1
- module Palmade::Cableguy
2
- class Runner
3
- def self.run(app_root, cmd, options)
4
- if options[:path].nil?
5
- if ENV.include?("CABLING_PATH")
6
- options[:path] = ENV["CABLING_PATH"]
7
- elsif File.exist?(File.expand_path('~/cabling'))
8
- options[:path] = File.expand_path('~/cabling')
9
- elsif File.exist?("/var/cabling")
10
- options[:path] = "/var/cabling"
11
- elsif File.exist?("/etc/cabling")
12
- options[:path] = "/etc/cabling"
13
- else
14
- raise "You don't seem to have any paths for cabling.\n"
15
- end
16
- end
17
-
18
- if options[:target].nil?
19
- if ENV.include?("CABLING_TARGET")
20
- options[:target] = ENV["CABLING_TARGET"]
21
- else
22
- options[:target] = 'development'
23
- end
24
- end
25
-
26
- if options[:location].nil?
27
- if ENV.include?("CABLING_LOCATION")
28
- options[:location] = ENV["CABLING_LOCATION"]
29
- else
30
- options[:location] = options[:target]
31
- end
32
- end
33
-
34
- ca = Cabler.new(app_root, options)
35
-
36
- case cmd
37
- when 'migrate'
38
- ca.boot.migrate
39
- else
40
- ca.boot.configure
41
- end
42
- end
43
- end
44
- end