ferry 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f65ccb6129a5a31a15a726e2424f438b9482e3f
4
- data.tar.gz: 75f2cd24f3a7ea2f382c194fe4fecd983082879d
3
+ metadata.gz: 2ef76e573bfc80a57098b2952267ed933fbfc2ad
4
+ data.tar.gz: bb302f11d288ad5f9ce8755f6c1f9caef43dba06
5
5
  SHA512:
6
- metadata.gz: 060a53ed43bbed7094f6967d05979b7ddc51aa73dbb68fddf0f3e0c5258d567baabeacfba94cbfb163830496d86623475f32554ae56153f02c2adbd1134081d7
7
- data.tar.gz: 425d84ab59ebf43283db4b3eec9a916d7dbf485e2ead0e6198c9f8ebc8ed5480e30915d97cae2f053fbce6108f213b5919254abdd7d50782cb69413bc3630e20
6
+ metadata.gz: bf58e8ce129262b23cc641c9d690bf19d8b078530c8f8b774136dc84f03bd1b37f150c2a2c28a5950b5a6db4a8b7e2043fd844882da3a1a1c7313b173a2d3819
7
+ data.tar.gz: befe88acf30a6e55483a3349a98e42f8fe61b61b74223aaf57b5325e9b5f5d8930bbaaac0208fd0491e47940cacf0008c9ae249bee9fe48e0d8c911b8795d881
data/README.md CHANGED
@@ -12,20 +12,18 @@ See the [ferry_demo](http://github.com/cmu-is-projects/ferry_demo) app or our [G
12
12
  Rails Migration and Manipulation use cases
13
13
  - Exporting data to various file formats (.csv, .yml, .sql)
14
14
  - Importing data from various file formats
15
- - Migrating data to third party hosts (Amazon S3, Oracle)
16
- - Migrating data to a different database
15
+ - Migrating data to third party services (Amazon S3, Oracle) and different databases
17
16
 
18
17
  Coming soon ...
19
18
  - Configurable Migration Scripting
20
19
  - The idea behind this feature is for developers to provide options for arguments in an executable script that contains the configuration and necessary tasks/ actions for the operations of whatever data migration or manipulation they are seeking to carry out.
21
- - Similar to how [capistrano's](https://github.com/capistrano/capistrano) configures deploy.rb.
20
+ - Similar to how [capistrano](https://github.com/capistrano/capistrano) configures deploy.rb.
22
21
  - Data Visualization
23
22
  - With inspiration from [d3](http://d3js.org), we are hoping to create functionality that allows developers to deploy informative and visually appealing graphs and documents that can be shared over an internal network to be broadcasted to servers for display either on internal office displays or to URL's ... all from executing a simple command-line statement.
24
23
  - We will be making use of [d3](http://d3js.org) for visualizations and are looking for current solutions to this business need and if there are any successful or not-so-successful solutions out there to compete with.
25
24
 
26
25
  ## Some current development items
27
26
  #### Please feel free to open an issue or pull request with your suggestions
28
- - Database-switcher guide tool
29
27
  - 3rd party connections
30
28
  - Configurability
31
29
  - Allowing user to write own rake tasks (e.g. importing and exporting data to S3 or related services)
data/bin/ferry CHANGED
@@ -3,20 +3,23 @@ require 'ferry'
3
3
 
4
4
  OptionParser.new do |opts|
5
5
  options = {}
6
- opts.banner = "See full documentation at http://cmu-is-projects.github.io/ferry"
6
+ opts.banner = "See more documentation at http://cmu-is-projects.github.io/ferry"
7
7
 
8
- opts.on("--to_csv ENVIRONMENT TABLE", 'Exports table to csv file in db/csv/[your db environment]/[your table]') do |opt|
8
+ opts.on('--db_switch ENVIRONMENT ADAPTER', 'Switches specified database env to a new adapter') do |opt|
9
9
  raise "too many arguments for input" unless ARGV.length <= 1
10
10
  raise "please enter a field for environment and table" unless ARGV.length == 1
11
- exporter = Ferry::Exporter.new
12
- exporter.to_csv(opt, ARGV[0])
11
+ questionmaster = Ferry::Utilities.new
12
+ if questionmaster.continue?("Are you sure you want to switch to a #{ARGV[0]} database in your #{opt} env? It could result in installing software that impacts your project.")
13
+ switcher = Ferry::Switcher.new
14
+ switcher.to_new_db_type(opt, ARGV[0])
15
+ end
13
16
  end
14
17
 
15
- opts.on("--to_yaml ENVIRONMENT TABLE", 'Exports table to yaml file in db/yaml/[your db environment]/[your table]') do |opt|
18
+ opts.on("--to_csv ENVIRONMENT TABLE", 'Exports table to csv file in db/csv/[your db environment]/[your table]') do |opt|
16
19
  raise "too many arguments for input" unless ARGV.length <= 1
17
20
  raise "please enter a field for environment and table" unless ARGV.length == 1
18
21
  exporter = Ferry::Exporter.new
19
- exporter.to_yaml(opt, ARGV[0])
22
+ exporter.to_csv(opt, ARGV[0])
20
23
  end
21
24
 
22
25
  opts.on('--import ENVIRONMENT TABLE FILEPATH', 'Imports data from specified file into table and environment of your specification') do |opt|
@@ -26,19 +29,21 @@ OptionParser.new do |opts|
26
29
  importer.import(opt, ARGV[0], ARGV[1])
27
30
  end
28
31
 
29
- opts.on('--db_switch ENVIRONMENT ADAPTER', 'Switches specified database env to a new adapter') do |opt|
32
+ opts.on('-i', '--init', 'Initializes ferry.rb file in config directory') do |opt|
33
+ filemaker = Ferry::Utilities.new
34
+ filemaker.make_starter_file
35
+ end
36
+
37
+ opts.on("--to_yaml ENVIRONMENT TABLE", 'Exports table to yaml file in db/yaml/[your db environment]/[your table]') do |opt|
30
38
  raise "too many arguments for input" unless ARGV.length <= 1
31
39
  raise "please enter a field for environment and table" unless ARGV.length == 1
32
- questionmaster = Ferry::Utilities.new
33
- if questionmaster.continue?("Are you sure you want to switch to a #{ARGV[0]} database in your #{opt} env? It could result in installing software that impacts your project.")
34
- switcher = Ferry::Switcher.new
35
- switcher.to_new_db_type(opt, ARGV[0])
36
- end
40
+ exporter = Ferry::Exporter.new
41
+ exporter.to_yaml(opt, ARGV[0])
37
42
  end
38
43
 
39
- opts.on('-i', '--init', 'Initializes ferry.rb file in config directory') do |opt|
40
- filemaker = Ferry::Utilities.new
41
- filemaker.make_starter_file
44
+ opts.on( "-v", "--version", String, "Prints version of Ferry." ) do |opt|
45
+ ferry_utils = Ferry::Utilities.new
46
+ ferry_utils.print_version
42
47
  end
43
48
 
44
49
  opts.on_tail('-h', '--help', 'Shows this message') do
data/lib/ferry.rb CHANGED
@@ -4,7 +4,6 @@ require 'enumerator'
4
4
  require 'ferry/exporter'
5
5
  require 'ferry/importer'
6
6
  require 'ferry/utilities'
7
- require 'ferry/switcher'
8
7
  require 'ferry/version'
9
8
  require 'highline/import'
10
9
  require 'progressbar'
@@ -18,17 +18,6 @@ module Ferry
18
18
  end
19
19
  end
20
20
 
21
- def continue?(prompt = "Are you sure", default = false)
22
- a = ''
23
- s = default ? '[Y/n]' : '[y/N]'
24
- d = default ? 'y' : 'n'
25
- until %w[y n].include? a
26
- a = ask("#{prompt} #{s} ") { |q| q.limit = 1; q.case = :downcase }
27
- a = d if a.length == 0
28
- end
29
- a == 'y'
30
- end
31
-
32
21
  def make_starter_file
33
22
  if !File.exist?("lib/tasks/ferry.rake")
34
23
  install_dir = `bundle show ferry`.chomp
@@ -40,5 +29,9 @@ module Ferry
40
29
  puts "/lib/tasks/ferry.rake already exists - but you knew that already ... didn't you?"
41
30
  end
42
31
  end
32
+
33
+ def print_version
34
+ puts "Ferry #{Ferry::VERSION}"
35
+ end
43
36
  end
44
37
  end
data/lib/ferry/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ferry
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Corletti
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-01-29 00:00:00.000000000 Z
13
+ date: 2015-02-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -192,7 +192,6 @@ files:
192
192
  - lib/ferry.rb
193
193
  - lib/ferry/exporter.rb
194
194
  - lib/ferry/importer.rb
195
- - lib/ferry/switcher.rb
196
195
  - lib/ferry/utilities.rb
197
196
  - lib/ferry/version.rb
198
197
  - script/mysql2_install.sh
@@ -1,31 +0,0 @@
1
- require_relative 'utilities'
2
-
3
- module Ferry
4
- class Switcher < Utilities
5
- def to_new_db_type(which_db_env, switch_to_db_type)
6
- if ['sqlite', 'postgresql', 'mysql'].include?(switch_to_db_type)
7
- info = YAML::load(IO.read("config/database.yml"))
8
- current_db_type = info[which_db_env]["adapter"]
9
- puts "switching the #{which_db_env} database's adapter"
10
- puts "current_db_type: #{current_db_type}"
11
- puts "to_new_db_type: #{switch_to_db_type}"
12
- if ['postgresql', 'mysql'].include?(switch_to_db_type)
13
- info[which_db_env]["adapter"] = switch_to_db_type
14
- puts "switching #{which_db_env} env to #{switch_to_db_type} ... "
15
- File.open("config/database.yml", "w") {|f| f.write info.to_yaml}
16
- puts "switched #{which_db_env} env to #{switch_to_db_type} in database.yml"
17
- call = %x(bundle show ferry).chomp
18
- %x(chmod 4755 #{call}/script/#{switch_to_db_type}_install.sh)
19
- %x(#{call}/script/#{switch_to_db_type}_install.sh)
20
- puts "installed necessary dependencies for #{which_db_env} env to #{switch_to_db_type}"
21
- elsif switch_to_db_type == 'sqlite'
22
- puts "#{switch_to_db_type} already installed on mac!"
23
- else
24
- puts "#{switch_to_db_type} is currently unsupported"
25
- end
26
- else
27
- puts "#{switch_to_db_type} is currently unsupported or db type does not exist"
28
- end
29
- end
30
- end
31
- end