ro_thor 0.2.7 → 0.2.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dafa19021d16dbfe29bec34846f6bae9b936fd52
4
- data.tar.gz: 5bcbe31bb1d3ea1679d55129d306ca643182d388
3
+ metadata.gz: 9a89eaec74757ed5b7d6f6dfbc19ecf07cfd06eb
4
+ data.tar.gz: a7888146d0c8e14f640a6dde8f7c1df53f370a82
5
5
  SHA512:
6
- metadata.gz: ee6c7e7127748ac8e8d668cfe02652722ae7b479aaae1f42afe7cc01415c94e90acad78614f772c18f91ad21dd818cbe268dc3af46cc11b41123eb5ea1d83258
7
- data.tar.gz: 9728da772c41bf010ee5ff329f89e6de510a714dd9c5bb1a209d54322b0aa8a967bc111665ae49fcb5ea93e7d2c14398c0874f51f4cbc0b54f96fd4debaf6b8b
6
+ metadata.gz: a9451328b5f0455ec365b8ee272015920ed5edd970a5f6cc84159bb34952a26e15f9814e46cbfb49483c231e45a5ac39b2dcddc4c5c2a56f7f3559567f28c84d
7
+ data.tar.gz: 2eb253567f3be13468eba74f8f19465350d4c2af4c993bd83a15f155c36d7e8f40c0f6f4377125a6b1b828430a2f024eccf59491ce01d1bc898ffb4b5a3c382c
data/lib/ro_thor.rb CHANGED
@@ -25,7 +25,15 @@ class RoThor < Thor
25
25
  def sys(*args, &blk)
26
26
  cmd = args.join(" ")
27
27
  puts "run '#{cmd}'"
28
- system cmd
28
+ if spork?
29
+ bash cmd
30
+ else
31
+ system cmd
32
+ end
33
+ end
34
+
35
+ def spork?(*args, &blk)
36
+ defined? ::Spork and Spork.using_spork?
29
37
  end
30
38
 
31
39
  def rt?(*args, &blk)
@@ -33,11 +41,15 @@ class RoThor < Thor
33
41
  end
34
42
 
35
43
  def vg?(*args, &blk)
36
- ENV['USER'] == 'vagrant'
44
+ ENV['USER'] == 'vagrant'
45
+ end
46
+
47
+ def rmt?(*args, &blk)
48
+ rt? or vg?
37
49
  end
38
50
 
39
51
  def read(f, *args, &blk)
40
- if rt?
52
+ if rmt?
41
53
  bash "sudo cp -f #{f} #{buffer}"
42
54
  File.read(buffer)
43
55
  else
@@ -64,7 +76,7 @@ class RoThor < Thor
64
76
  end
65
77
 
66
78
  def write(f, *args, &blk)
67
- if rt? or vg?
79
+ if rmt?
68
80
  File.binwrite(buffer, *args, &blk)
69
81
  pr = Pathname.new(f).parent
70
82
  bash("sudo mkdir -p #{pr}; sudo cp -f #{buffer} #{f}")
@@ -5,6 +5,7 @@ class TryArr < RoThor
5
5
  args, opts = args.ro_opts
6
6
  return opts
7
7
  end
8
+
8
9
  end
9
10
 
10
11
  describe "RoThor.new" do
@@ -16,5 +17,10 @@ describe "RoThor.new" do
16
17
  r = o.opts "key:val k2:v2"
17
18
  expect(r).to eq({key: "val", k2: 'v2'})
18
19
  end
20
+
21
+ it 'match mysql conf' do
22
+ r = RoFile.read(RoRspec.spec('mysql/my.cnf'))
23
+ expect(r).to match(%r{#{k}\s+\=.*$})
24
+ end
19
25
  end
20
26
 
data/spec/mysql/my.cnf ADDED
@@ -0,0 +1,129 @@
1
+ #
2
+ # The MySQL database server configuration file.
3
+ #
4
+ # You can copy this to one of:
5
+ # - "/etc/mysql/my.cnf" to set global options,
6
+ # - "~/.my.cnf" to set user-specific options.
7
+ #
8
+ # One can use all long options that the program supports.
9
+ # Run program with --help to get a list of available options and with
10
+ # --print-defaults to see which it would actually understand and use.
11
+ #
12
+ # For explanations see
13
+ # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
14
+
15
+ # This will be passed to all mysql clients
16
+ # It has been reported that passwords should be enclosed with ticks/quotes
17
+ # escpecially if they contain "#" chars...
18
+ # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
19
+ [client]
20
+ port = 3306
21
+ socket = /var/run/mysqld/mysqld.sock
22
+
23
+ # Here is entries for some specific programs
24
+ # The following values assume you have at least 32M ram
25
+
26
+ # This was formally known as [safe_mysqld]. Both versions are currently parsed.
27
+ [mysqld_safe]
28
+ socket = /var/run/mysqld/mysqld.sock
29
+ nice = 0
30
+
31
+ [mysqld]
32
+ #
33
+ # * Basic Settings
34
+ #
35
+ user = mysql
36
+ pid-file = /var/run/mysqld/mysqld.pid
37
+ socket = /var/run/mysqld/mysqld.sock
38
+ port = 3306
39
+ basedir = /usr
40
+ datadir = /var/lib/mysql
41
+ tmpdir = /tmp
42
+ lc-messages-dir = /usr/share/mysql
43
+ skip-external-locking
44
+ character_set_server = utf8
45
+ collation_server = utf8_unicode_ci
46
+ #
47
+ # Instead of skip-networking the default is now to listen only on
48
+ # localhost which is more compatible and is not less secure.
49
+ # bind-address = localhost
50
+ #
51
+ # * Fine Tuning
52
+ #
53
+ key_buffer = 16M
54
+ max_allowed_packet = 16M
55
+ thread_stack = 192K
56
+ thread_cache_size = 8
57
+ # This replaces the startup script and checks MyISAM tables if needed
58
+ # the first time they are touched
59
+ myisam-recover = BACKUP
60
+ max_connections = 100000
61
+ #table_cache = 64
62
+ #thread_concurrency = 10
63
+ #
64
+ # * Query Cache Configuration
65
+ #
66
+ query_cache_limit = 1M
67
+ query_cache_size = 16M
68
+ #
69
+ # * Logging and Replication
70
+ #
71
+ # Both location gets rotated by the cronjob.
72
+ # Be aware that this log type is a performance killer.
73
+ # As of 5.1 you can enable the log at runtime!
74
+ general_log_file = /var/log/mysql/mysql.log
75
+ general_log = 1
76
+ #
77
+ # Error log - should be very few entries.
78
+ #
79
+ log_error = /var/log/mysql/error.log
80
+ #
81
+ # Here you can see queries with especially long duration
82
+ log_slow_queries = /var/log/mysql/mysql-slow.log
83
+ long_query_time = 2
84
+ log-queries-not-using-indexes
85
+ #
86
+ # The following can be used as easy to replay backup logs or for replication.
87
+ # note: if you are setting up a replication slave, see README.Debian about
88
+ # other settings you may need to change.
89
+ #server-id = 1
90
+ #log_bin = /var/log/mysql/mysql-bin.log
91
+ expire_logs_days = 10
92
+ max_binlog_size = 100M
93
+ #binlog_do_db = include_database_name
94
+ #binlog_ignore_db = include_database_name
95
+ #
96
+ # * InnoDB
97
+ #
98
+ # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
99
+ # Read the manual for more InnoDB related options. There are many!
100
+ #
101
+ # * Security Features
102
+ #
103
+ # Read the manual, too, if you want chroot!
104
+ # chroot = /var/lib/mysql/
105
+ #
106
+ # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
107
+ #
108
+ # ssl-ca=/etc/mysql/cacert.pem
109
+ # ssl-cert=/etc/mysql/server-cert.pem
110
+ # ssl-key=/etc/mysql/server-key.pem
111
+
112
+
113
+
114
+ [mysqldump]
115
+ quick
116
+ quote-names
117
+ max_allowed_packet = 16M
118
+
119
+ [mysql]
120
+ #no-auto-rehash # faster start of mysql but no tab completition
121
+
122
+ [isamchk]
123
+ key_buffer = 16M
124
+
125
+ #
126
+ # * IMPORTANT: Additional settings that can override those from this file!
127
+ # The files must end with '.cnf', otherwise they'll be ignored.
128
+ #
129
+ !includedir /etc/mysql/conf.d/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ro_thor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -34,6 +34,7 @@ files:
34
34
  - lib/ro_thor.rb
35
35
  - lib/ro_thor/array.rb
36
36
  - spec/lib/core_ext/array_spec.rb
37
+ - spec/mysql/my.cnf
37
38
  - spec/spec_helper.rb
38
39
  homepage: ''
39
40
  licenses: []
@@ -61,3 +62,4 @@ summary: ''
61
62
  test_files:
62
63
  - spec/lib/core_ext/array_spec.rb
63
64
  - spec/spec_helper.rb
65
+ - spec/mysql/my.cnf