mm 0.2.2 → 0.2.3

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: 2c4ffe0f3b812f6e0c9c94de543b24fb5d452acd
4
- data.tar.gz: d0e8454697b490acad7bfb32630aa38278afec12
3
+ metadata.gz: fe8563d98296fa20a0e4a6288d6d6019cadbc0a7
4
+ data.tar.gz: 13f5d55ed96576c46c91f7917e4f3bb4bec23e7c
5
5
  SHA512:
6
- metadata.gz: 69d12260024c9ca22e2b3bdad13d64695e8bb5f8c82d0df2f9b4496bc8d92842b971171cb57fc42cd4bdb650506cd74300b27eaf6d5ceef421b4aff95dd5cd21
7
- data.tar.gz: 8ff650a3d08ea5933b9e50bcda6a9c092fd7ff958335a66216daf86ca41127d209b09f85ab6cfaf31c14328be662967027e66073b8878c7312acf8b900e395c3
6
+ metadata.gz: 6ed6865e5379779c2bc39182ed1293760dd0a77318742f8761412f922d277a2b9df858ede3c8a16a2f878e41be031c6d46e9c8b015b8794862dbf2bf0fdbcd1f
7
+ data.tar.gz: 0704d00be644cb1fe421358bb0c39c156277d60f4d3bc14062afebe1a45cb42e23d5aced3f9826a3f64132ac708b26d15ab8719edc2d84fe8d3c54b0bb084153
data/bin/mm CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "rubygems"
4
- require "#{File.dirname(__FILE__)}/../lib/turbine"
4
+ require File.expand_path(File.join(File.dirname(__FILE__), "../lib/turbine"))
5
5
 
6
6
  Turbine::Application.new.run(ARGV.map { |e| e.dup })
@@ -4,6 +4,7 @@ module Turbine
4
4
  PRECISION = 2 # decimal places for rounding
5
5
  end
6
6
 
7
+ require "turbine/version"
7
8
  require "turbine/timer"
8
9
  require "turbine/queue"
9
10
  require "turbine/commands/init"
@@ -2,6 +2,7 @@ require "pathname"
2
2
  require "highline"
3
3
  require "restclient"
4
4
  require "json"
5
+ require "rainbow"
5
6
 
6
7
  module Turbine
7
8
  class Application
@@ -59,7 +60,8 @@ module Turbine
59
60
  end
60
61
 
61
62
  def read_file(name)
62
- File.read("#{self.class.config_dir}/#{name}")
63
+ file = "#{self.class.config_dir}/#{name}"
64
+ File.read(file) if File.exists?(file)
63
65
  end
64
66
 
65
67
  def write_file(name, mode="w")
@@ -1,6 +1,14 @@
1
1
  module Turbine
2
2
  module CommandRunner
3
3
  def setup
4
+ version = read_file("VERSION")
5
+ if version.nil? || version != Turbine::VERSION
6
+ if prompt.agree(Rainbow("The project's momentum configuration is out of date.").red +
7
+ " Would you like to update it?\nWARNING This will overwrite any custom changes made to standard mm commands in this project's `.turbine` folder.", true)
8
+ update_version
9
+ update_standard_commands
10
+ end
11
+ end
4
12
  end
5
13
 
6
14
  def run(argv)
@@ -26,7 +34,7 @@ module Turbine
26
34
 
27
35
  if command && respond_to?(command)
28
36
  send(command)
29
- else
37
+ else
30
38
  prompt.say("Unknown command: #{command}")
31
39
  end
32
40
 
@@ -64,4 +72,4 @@ module Turbine
64
72
  end
65
73
  end
66
74
  end
67
-
75
+
@@ -6,21 +6,9 @@ module Turbine
6
6
  module StandardCommands
7
7
  include FileUtils
8
8
 
9
- def setup
10
- option_parser.on("--update", "Update") do
11
- params[:update] = true
12
- end
13
- end
14
-
15
9
  def init
16
10
  current_dir = File.dirname(__FILE__)
17
11
 
18
- if params[:update] == true
19
- update_standard_commands(current_dir)
20
- prompt.say "Standard commands updated"
21
- return
22
- end
23
-
24
12
  mkdir_p(".turbine")
25
13
  mkdir_p(".turbine/log")
26
14
  mkdir_p(".turbine/commands")
@@ -32,9 +20,9 @@ module Turbine
32
20
 
33
21
  raise if key.nil?
34
22
 
35
-
36
23
  write_file("log/#{key}.json") { |f| f << [].to_json }
37
24
 
25
+
38
26
  write_file("config.rb") do |f|
39
27
  template = File.read("#{current_dir}/../../../data/config.rb.erb")
40
28
  f << ERB.new(template).result(binding)
@@ -48,14 +36,21 @@ module Turbine
48
36
  f << { project_name => url }.to_json
49
37
  end
50
38
 
51
- update_standard_commands(current_dir)
39
+ update_standard_commands
40
+ update_version
52
41
  end
53
42
 
54
43
  private
55
44
 
56
- def update_standard_commands(current_dir)
45
+ def update_standard_commands
46
+ current_dir = File.dirname(__FILE__)
47
+
57
48
  cp_r("#{current_dir}/standard",
58
49
  "#{self.class.config_dir}/commands/")
59
50
  end
51
+
52
+ def update_version
53
+ write_file("VERSION") { |f| f << Turbine::VERSION }
54
+ end
60
55
  end
61
56
  end
@@ -2,10 +2,11 @@ Turbine::Application.extension do
2
2
  def start
3
3
  timer = Turbine::Timer.new
4
4
  if timer.running?
5
- prompt.say "Timer already started, please stop or rewind first"
5
+ prompt.say Rainbow("WARNING:").red +
6
+ " Timer already started, please stop or rewind first"
6
7
  else
7
8
  timer.write_timestamp
8
- prompt.say "Timer started at #{Time.now}"
9
+ prompt.say Rainbow("Timer started at #{Time.now}").green
9
10
  end
10
11
  end
11
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -10,48 +10,48 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-16 00:00:00.000000000 Z
13
+ date: 2015-05-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: 1.6.20
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 1.6.20
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rest-client
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: 1.7.2
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: 1.7.2
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: json
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  description: CLI for Madriska Momentum
@@ -93,12 +93,12 @@ require_paths:
93
93
  - lib
94
94
  required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []