reup 0.2.2 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a682ef14b48957b8ab43c979d69a3b25934c0251
4
- data.tar.gz: c3f8da0d1d5ae9aa1b651d89f346bd002a05b97b
3
+ metadata.gz: 90325825af95f75e1a566aae5e5b032147489a35
4
+ data.tar.gz: a189400ae9b62bc9aa6ac102737621727f256742
5
5
  SHA512:
6
- metadata.gz: 1aae2a1a34eec186aa73c1d8675f112b0ccfb8a8aeac9f929a74fddf8dc46c786a88056e6955b8440a206c7b74caed4a24d5504c9de7e3d8ceb3dc81d92282ce
7
- data.tar.gz: 49cfa880ccfa9347102b5e5f3c251aa00ce4ad93e69fd9cbef74adfe077be9fddc932e7cce036c4b483c5be2398e9fc2d8f0941c1afe3097587626fa1b45a1eb
6
+ metadata.gz: 3521ac2266e80578b8623ebdc50868063e755d331fd198711f0dd9db5c231722199c20efbdff7d42bcc96c5b3d3e48b18bf63c0325d24f6d032f8e1b8f787b94
7
+ data.tar.gz: ae196a78a7cc899c8c710423df930d9ba692db5642ad8d22d4a93929afacdcc9eb67d73772fa2e54c8daca42da0a226d5e15d8f36c1518057caa1c5eebae9f3f
data/bin/reup CHANGED
@@ -1,22 +1,45 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
+ require_relative "../lib/reup"
3
4
  require "slop"
4
5
  require "cocaine"
5
6
 
6
- require_relative "../lib/reup/version"
7
- require_relative "../lib/reup/helpers"
8
-
9
- include Reup::Helpers
7
+ include Reup
10
8
 
11
9
  options = Slop.parse do |option|
12
10
  option.bool "-r", "--resetdb", "resets the database"
13
11
  option.string "-b", "--branch", "checkout branch"
12
+ option.bool "-f", "--force", "force an action"
13
+ option.bool "-i", "--init", "initialize local settings file to #{USER_SETTINGS_PATH}"
14
+ option.bool "-h", "--help", "print this dialog"
14
15
  option.on "-v", "--version", "print the version" do
15
16
  puts Reup::VERSION
16
17
  exit
17
18
  end
18
19
  end
19
20
 
21
+ if options.help?
22
+ puts options
23
+ exit
24
+ end
25
+
26
+ if options.init?
27
+ puts "Initializing user settings file..."
28
+ if File.exist? USER_SETTINGS_PATH
29
+ if options.force?
30
+ puts "Overwriting existing settings file..."
31
+ FileUtils.rm USER_SETTINGS_PATH
32
+ else
33
+ puts "The file #{USER_SETTINGS_PATH} already exists. Use --force to override."
34
+ exit
35
+ end
36
+ end
37
+ initialize_user_settings
38
+ puts "Local settings file initialized to #{USER_SETTINGS_PATH}"
39
+ exit
40
+ end
41
+
42
+
20
43
  wasChange = detect_change_to(watch_files) do
21
44
  run "git checkout #{options[:branch]}", quiet: true if options.branch?
22
45
  run "git pull"
@@ -0,0 +1,13 @@
1
+ require_relative "reup/helpers"
2
+ require_relative "reup/version"
3
+ require_relative "reup/user_settings"
4
+ require "fileutils"
5
+
6
+ module Reup
7
+ DEFAULT_SETTINGS_PATH = File.expand_path "../reup/.reup.yaml", __FILE__
8
+ USER_SETTINGS_PATH = File.expand_path ".reup.yaml", Dir.home
9
+ end
10
+
11
+ include Reup
12
+ include Reup::Helpers
13
+ include Reup::UserSettings
@@ -21,4 +21,5 @@ rails:
21
21
  - Gemfile
22
22
  db:
23
23
  reset_command: "bundle exec rake db:migrate:reset"
24
+ migrate_command: "bundle exec rake db:migrate"
24
25
 
@@ -3,7 +3,8 @@ require "yaml"
3
3
  module Reup
4
4
  module Helpers
5
5
 
6
- ENV_FILE = File.expand_path "../env.yaml", __FILE__
6
+ DEFAULT_ENV_FILE = File.expand_path "../.reup.yaml", __FILE__
7
+ USER_ENV_FILE = File.expand_path ".reup.yaml", Dir.home
7
8
 
8
9
  ###########################################################################
9
10
  # Executable helpers
@@ -48,7 +49,13 @@ module Reup
48
49
  end
49
50
 
50
51
  def env_file
51
- @env_file ||= YAML.load_file ENV_FILE
52
+ @env_file ||= (
53
+ if File.exist? USER_ENV_FILE
54
+ YAML.load_file USER_ENV_FILE
55
+ else
56
+ YAML.load_file DEFAULT_ENV_FILE
57
+ end
58
+ )
52
59
  end
53
60
 
54
61
  def watch_files
@@ -0,0 +1,7 @@
1
+ module Reup
2
+ module UserSettings
3
+ def initialize_user_settings
4
+ FileUtils.cp DEFAULT_SETTINGS_PATH, USER_SETTINGS_PATH
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Reup
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Toniazzo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocaine
@@ -113,8 +113,9 @@ files:
113
113
  - bin/reup
114
114
  - bin/setup
115
115
  - lib/reup.rb
116
- - lib/reup/env.yaml
116
+ - lib/reup/.reup.yaml
117
117
  - lib/reup/helpers.rb
118
+ - lib/reup/user_settings.rb
118
119
  - lib/reup/version.rb
119
120
  - reup.gemspec
120
121
  homepage: https://github.com/jutonz/reup